Sublime Forum

Dev Build 2055

#1

Dev Build 2055 is out now.

Tab completion has received an overhaul, and is now on by default. The changes are:

  • It’s no longer case sensitive. The ranking function takes case into account though, so it will prefer matches that match the case you input. e.g., ‘sr’ , ‘SR’, and ‘sR’ can all complete to different things, depending on what the candidates are.
  • A tab can always be inserted by pressing the tab key twice. There is a downside to this, with regards to snippets: if you insert a snippet, then press tab immediately to traverse to the next field, the snippet will be reverted and a tab will be inserted. You can work around this by issuing another command between the two tabs, such as typing or pressing an arrow key. This behaviour can be removed by editing the key bindings.
  • If pressing tab doesn’t insert the completion you want it to, then you can press Ctrl+Space immediately afterwards, the completion will be backed out, and the auto complete window will be shown.
  • Tab completion no longer makes use of the Ctrl+Space selection history. This means it won’t learn what you want, but the tradeoff is more deterministic behaviour. The old behaviour was causing confusing completions to be inserted in some circumstances.

There are also a couple of frequently requested items in this build:

  • There’s now a global setting, remember_open_files, to have the last set of files not re-opened at startup.
  • The disclosure buttons (i.e., the triangles) in the sidebar now have much bigger hit regions, making pressing them less error prone
0 Likes

#2

First thing I’ve noticed so far is horizontal scrolling is no longer as smooth as it was in 2054.

0 Likes

#3

Thanks for this new build Jon, case-insensitive completion and the new way to correct false completion is nice.

I’ve an issue with how it work, it look inconsistent:
If you create a new file (Text) and press the tab key, the first two keypress insert tab each time, but afterward you have to press tab 2 times to insert one tab.
Same when you type a word, press tab to insert a tab, but you have to press two times for the second tab to be inserted.

startup, version: 2055 windows x64 channel: dev

0 Likes

#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