Since a recent update of VSCode, you might have noticed that IntelliSense works somewhat different. Well, that’s because VSCode thought to do a good, useful update for you .. but apparently for AL development, it turns out to be quite contra productive..
You all probably know why CTRL+Space is for? It’s for forcing IntelliSense. Or the official term is “Trigger Suggest“. In a context-aware intellisense, it’s very useful to get suggestions on which keywords can be used in a certain context.
Since one of the latest updates of VSCode, the default behaviour has somewhat changed. When you “trigger suggest” (press CTRL+Space), it will point to the last one used.
Like in this example, I use the snippet “tprocedure”, and when I use the CTRL+Space to start coding, you will see it will jump straight to the “tprocedure”-item in the list, just because I just used it:
In a context-aware in IntelliSense, this just doesn’t make any sense.
You can fix this
VSCode wouldn’t be VSCode if you couldn’t fix this behaviour. And I have a strong feeling you would like to fix it ;-). It’s simple, just add following setting in your settings.json (File / Preferences / Settings):
As the tooltip explains: Editor.suggestSelection controls how the suggestions are pre-selected when showing the suggest list. In this case it will always select the first suggestion.
This means it will always suggest the first item in the IntellSense-list. Just the way you would expect (in my opinion). Let’s see what this means for our example:
Thanks Esben & Stan
When I was doing my session in Bangkok last week, Esben and Stan saw me struggling with this, and gave me the solution. :-). Thanks so much!