Sublime Forum

Dev Build 2055

#4

And this issue from 2054 is still there:

[quote]The only strange behavior I’ve noticed is on the Goto Symbol or Goto Word panel:
-The focus is not on the right place when the panel open (highlighted item not in the visible part, you have to move with arrow up/down for the view to go to right place)[/quote]

0 Likes

#5

And how?

I use loads of multifield snippets and this killed them all. And for what? That some people had difficulties with inserting a tab. Thank you very much but I’d rather not have it.

I think the more natural behaviour would be allowing traversing a snipped with TAB as before and Ctrl+Z doing what pressing TAB for the 2nd time does now. If Ctrl+Z is pressed once you end up with what you typed plus a tab and if it is pressed twice only the original text remains.

0 Likes

#6

[quote=“qqq”]
I use loads of multifield snippets and this killed them all. And for what? That some people had difficulties with inserting a tab. Thank you very much but I’d rather not have it.

I think the more natural behaviour would be allowing traversing a snipped with TAB as before and Ctrl+Z doing what pressing TAB for the 2nd time does now. If Ctrl+Z is pressed once you end up with what you typed plus a tab and if it is pressed twice only the original text remains.[/quote]

Maybe I’m wrong but it’s only an issue if you don’t type anything in the first field of the snippets, which is probably unusual.
Actually, I don’t think there is a solution that make everyone happy. What Jon tried to achieve with tab completion look really hard to make it right in all case.

And as Jon as wrote, you could disable this behavior by editing this key bindings:

[code] { “keys”: “tab”], “command”: “replace_completion_with_tab”, “context”:

		{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
		{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
	]
},[/code]
0 Likes

#7

It’s not doing the right thing when insert_best_completion inserts a tab the first time around. I’ll fix this for the next build.

0 Likes

#8

I guess it all depends on one’s viewpoint. I myself deem a situation when you want to enter a tab after some text higly unusual. On the other hand there are a lot of common snippets which have default values in some fields you don’t often change. Example PHP:class, HTML:input.

How do you change this behaviour using your user key bindings file?

0 Likes

#9

I actually tabulate my PHP arrays and CSS to make sure it’s visible what’s doing what :smile:

0 Likes

#10

Well, it takes all sorts :smile:

The only question that bothers me now is how do I change it so that I don’t have to edit default key bindings on every build.

0 Likes

#11

[quote=“qqq”]Well, it takes all sorts :smile:

The only question that bothers me now is how do I change it so that I don’t have to edit default key bindings on every build.[/quote]

I believe you can put them in Base File.sublime-settings

:smile:

0 Likes

#12

[quote=“qqq”]
How do you change this behaviour using your user key bindings file?[/quote]

Something like this put in your “Default (XXX).sublime-keymap” of the User directory could probably work (untested):

[code] { “keys”: “tab”], “command”: “next_field”, “context”:

		{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
		{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
		{ "key": "has_next_field", "operator": "equal", "operand": true }
	]
}

[/code]
I don’t know if there’s a way to disable a keybinding (like define it with a “null” or “pass” command), something like:

[code] { “keys”: “tab”], “command”: “pass”, “context”:

		{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
		{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
	]
}

[/code]
Someone know if there is something like that ?

0 Likes

Undefine a key binding
#13

Thanks for this :smile:

0 Likes

#14

I’ve an issue with tab completion - especially within my orgmode plugin, where I use many short tab triggers (snippets) like “-t” which expands to "- TODO ". Currently I turned tab completion off by adding the following into the packages settings file:

"tab_completion": false

You can also add this to your Packages/User/Base File.sublime-settings file but I find it somehow useful in Python etc…

Jon, can you somehow give tab triggers more priority?

0 Likes

#15

What do you have in mind?

0 Likes

#16

Hard to explain. Perhaps it helps to compare both situations:

  • Having tab completion enabled “-t” expands to e.g. “-testing” where the word “testing” comes from somewhere within the file.
  • Having tab completion disabled “-t” expands to “- TODO” which has been defined as a tab trigger within a snippet.

I think the first behavior is wrong. A completion only makes sense if no tab trigger could be found/executed. Tab triggers should always have a higher prio / being checked first.

No?

0 Likes

#17

This makes sense and could solve many problems.

For example there are more than 4000 (!) PHP completions which fire off almost before you touch your keyboard. Hard to get this couple of snippets you have to work in such environment.

That’s why the first item on my to-do list on every build is:
1)delete PHP.sublime-completions file

0 Likes

#18

Snippets do have the highest priority in this sense: if a snippet has an exact match for the tab trigger, it’ll also execute first. If no snippets/completions/words match exactly, then the usual fuzzy match ranking will be used, with snippets always taking priority if the ranking for two words is equal.

0 Likes

#19

If this is the case - it’s good.

But I don’t like what happens when I press a->tab:

an exact match from Html completions (html:a) loses with Php completion (php:abs) which is not an exact match.

0 Likes

#20

Honestly I think the biggest problem is competitions being on tab. It just messes too many things up. I actually can’t think of another editor that has both completions and snippets on tab. Most have snippets on tab and completions on ctrl + spacebar or some sort of intellisense. Actually would any sort of intellisense be possible? That would be amazing and it seems like some of what would be needed is already there, like when there are multiple snippets with the same trigger and the box that pops up and lets you choose.

Also +1 for some sort of way to unbind default keybinds from the user keybinds file. Every update I have to go and unbind all the quote and brace overwrite binds as they drive me nuts.

0 Likes

#21

Please try to define a snippet that reacts on “-t”. Over here (OSX) it always tries to expand the letter “t” first and not to find and expand a snippet with “-t”. Is it due to the dash?

0 Likes

#22

That does look like a bug: the snippet should be triggering here, instead of completing from ‘t’. It should work fine without the hyphen (non-word triggers have to go through some different logic). I’ll fix the issue for the next build.

0 Likes

#23

The behavior is not correct.
Tab should try to complete only if we have not space or character like {} ] () and maybe some other before the cursor.

0 Likes