Sublime Text tab closes auto-complete window - autocomplete

I hope it's a short question.
When I start typing in Sublime Text 2/3 the auto-completion window appears. If I press tab I start cycling through the options I have which is exactly what I want. However, at the same time as soon as I have pressed tab the auto-completion popup closes.
Is there some option to make the popup stay alive, showing me the item I am currently at. (the same behavior as with a down key). So I would like to achieve something in between the down key and tab key behavior.
Hope I have described the issue precise enough. If something is not clear - I will be happy to provide more details.
Thanks!

I don't quite understand the behavior you're looking for but these are the available completion settings in Preferences.sublime-settings:
{
// When enabled, pressing tab will insert the best matching completion.
// When disabled, tab will only trigger snippets or insert a tab.
// Shift+tab can be used to insert an explicit tab when tab_completion is
// enabled.
"tab_completion": true,
// Enable auto complete to be triggered automatically when typing.
"auto_complete": true,
// The maximum file size where auto complete will be automatically triggered.
"auto_complete_size_limit": 4194304,
// The delay, in ms, before the auto complete window is shown after typing
"auto_complete_delay": 50,
// Controls what scopes auto complete will be triggered in
"auto_complete_selector": "source - comment",
// Additional situations to trigger auto complete
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
// By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
"auto_complete_commit_on_tab": false,
// Controls if auto complete is shown when snippet fields are active.
// Only relevant if auto_complete_commit_on_tab is true.
"auto_complete_with_fields": false
}
You may be able to get the behavior you desire by customizing them.

if you use AutoSave plugin, it will be the cause of fast-closing popup window. Try to disable this extension.

Override the Tab Key Binding
I found the following to provide the solution. It just invokes the auto complete again, resulting in the next option to be selected.
{ "keys": ["tab"],
"command": "auto_complete",
"context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab", "operand": false }
]
}
Remember to add a comma if this isn't your only key binding.

I had the same issue- found this solution in their forums:
Add this to your keymap file:
{ "keys": ["tab"], "command": "insert", "args": {"characters": "\t"}, "context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.tab_completion", "operator": "equal", "operand": false }
]
}

Related

How can I disable the type indication in VS Code?

Consider this function here, how can I disable the auto generated grey text showing the type scheme of the function?
From the OCaml Platform page:
Disable code lens
Code lens are type information displayed over a symbol. In the
screenshot below, code lens is grey text t -> Sandbox.t.
You can disable code lens for all extensions, i.e., in whole VS Code,
set this settings in your settings.json:
"editor.codeLens": false
Or if you only want to disable it
for OCaml:
"[ocaml]": { "editor.codeLens": false }

disable the click event on echarts tree chart individual node

Is there any possibility of disabling the click not to further collapse the tree or close the tree. This is the example the echarts example. See this link. I am trying this since long time. The documentation is not clear. Can anybody help me out on this? I dont want the end user to click on the circles to expand or collapse.
https://echarts.apache.org/examples/en/editor.html?c=tree-radial
Just disable mouse events with silent: true.
series: [{
//...
silent: true,
//...
}]
There is a property expandAndCollapse inside series, default value is true. Set it to false which does exactly what you asked.

How to focus a custom view when writing a VS Code extension?

I need help with my VS Code extension. I've written a custom view which works just fine, however I'd like to activate / focus / bring into view that view by using a keyboard shortcut or a context menu command. I am unable to find how to use the VS code API to achieve that.
context.subscriptions.push(vscode.commands.registerCommand('extensionId.showView', () =>
{
// how to do that?
}));
I know this can be done, because one can display the file explorer by using this code snppet:
vscode.commands.executeCommand('workbench.view.search');
But how would you do that for a custom tree view?
You should be able to use the new focus option that was added to TreeView.reveal() in 1.25 for that. The method requires you to pass a tree item to be revealed, so it's more of a workaround for not being able to focus the view itself directly, but you could simply pass the first / root node.
treeView.reveal(item, {focus: true});
Note that focus in this case means keyboard focus. If you just want to bring it into view, calling reveal() without the focus option is good enough.
To obtain a TreeView instance, you need to call vscode.window.createTreeView() with your view ID and provider.
I think, it is also possible to use
vscode.commands.executeCommand("exampleView.focus")
using the exampleView declared in package.json:
...
"views": {
"exampleView": [
{
"id": "exampleView",
"name": "Example View"
}
]
},
...
as #Empiire said, focus command in the form of : vscode.commands.executeCommand
and adding the '.focus' at the end of the id of the view that was declared in the package.json works!
You can also provide an object as parameter such as { preserveFocus: true } to show without disturbing the current focus.
eamodio does it like that in gitlens : https://github.com/gitkraken/vscode-gitlens/blob/417587d0dfcda89e9e2d723f8b662d7cf9008c8f/src/webviews/webviewViewBase.ts#L85

In Filemaker, after searching *within* search results, how can I return to my previous search results?

I'm creating an inventory database in Filemaker Pro Advanced (v15) for my little café, and I've made a little red button that appears in the header if any of our items drop down below a certain level, so when I click that button, it shows just those items that need reordering.
It performs that action by running a script like so:
Go to Layout [ “Inventory Reorders Required” (Inventory) ]
Enter Find Mode [ Pause: Off ]
Set Field [ Inventory::Availability ; "Reorder Required" ]
Perform Find []
Sort Records [ Restore ; With dialog: Off ]
It then goes to a duplicated layout whose only difference (aside from color change) is, the button changes to a "show all" function, which is how I want it to act from the main page.
Enter Browse Mode [ Pause: Off ]
Go to Layout [ “Inventory” (Inventory) ]
Show All Records
Sort Records [ Restore ; With dialog: Off ]
If I do a search—for instance, for "coffee beans,"—clicking that little red button from the search results will narrow the search to just the coffee beans that need reordering—NOT all products that need reordering—again, just how I want it to act.
My question is: Like how I have the button set to return to showing all items when clicked from the main page, I'd like it to return to showing all search results when clicked from the search results page. But I can't find any way to do that. My "solution" so far has been to just disable that button from appearing on the search results layout, but it'd sure be a handy feature to have if we can make it work.
Any chance you could open the reorder layout in a new window, preserving your old found set in the background and operating on the new found set in the foreground? Then when the user is done with the reorder window, they can close it (or the button can close the window) and the user will be left with the original found set.
The simplest way could be to just open a new window when you click the red button and show your filtered output. Then, just close the window to return to the window with your previous results. In FileMaker 16, you could have used a card window for this also.
Otherwise, http://www.soliantconsulting.com/blog/2016/03/recreating-a-filemaker-found-set describes several methods of restoring found sets.

Dojo: dijit.form.select won't fire "onClick" event the first time clicked

I've been through the Dojo docs as well as the API and tried Google but can't find a solution to my problem, I hope anybody here can help me out.
I'm trying to create a dijit.form.select programmatically (using Dojo 1.4) and connect to the "onClick"-event of the widget.
Here's a part of my code:
var dataSelect = new dijit.form.Select({
id : "myselect",
name : "myselect",
labelAttr: "label",
labelType: "html"
},
"selectid");
dataSelect.addOption({value: "value", label: "first item label"});
dojo.connect(dataSelect, "onClick", function() {
alert("clicked!");
});
What it does: A select-box is created replacing an input-field with the ID "selectid", an option "first item label" is created. Everythings all right until here.
Then I connect to the "onClick"-event of the select, which is supposed to load more options via AJAX (but will just display an alert for testing purposes in this example).
The problem: When I click on the little arrow next to the dropdown, the event is fired (OK). But when I click on the select box itself (the area containing the option), the event is NOT fired the first time I click it (unless I clicked on the arrow before).
When I click the select box a second time (and every time after that), the event will fire!
I've tried to use "onFocus" instead of "onClick" which does work, but then the dropdown will not open when first clicked, even if I use the "openDropDown"-function (which does work when connecting to "onClick"!).
Is it me, did I run into a Dojo bug or is it a strange feature I just don't get?
Any help is appreciated.
Greetings,
Select0r
Here is a cross-browser solution:
var sizeSelect = new dijit.form.Select({
id: "sizeSelect",
name: "state",
options: size,
onChange: function(val) {
dojo.style(dojo.byId("textInput"), {"fontSize":val});
}
}, "sizeSelect");
Try to connect not to the widget itself but to it's dom node:
dojo.connect(dataSelect.domNode, "onclick", function() {
alert("clicked!");
});
Select (which extends _HasDropDown) has fancy code to handle:
mouse down on select widget
mouse move to one of the options
mouse up
Maybe that's canceling the click event.
Maybe you can connect to _loadChildren() instead.
The root cause for this issue is that the _onDropDownMouseDown method of dijit._HasDropDown will manipulate the dom node, which cause the e.target of onmousedown and onmouseup changes for the first initialization.
As we know, the onclick event will be triggered only when the target of onmousedown and onmouseup are the same target.
So in this case, the onclick event is not triggered.
It seems that in Dojo 1.5, the problem still remains.