microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.49k stars 28.97k forks source link

Discuss the use of space as IntelliSense trigger character #67714

Closed jrieken closed 5 years ago

jrieken commented 5 years ago

This is caused by OmniSharp because they define (space) as IntelliSense trigger character. That causes snippets to show up.

Originally posted by @jrieken in https://github.com/Microsoft/vscode/issues/66443#issuecomment-459648527

eterlan commented 5 years ago

For unity coder it's really bad idea, if he wants to use both snippet and Intellisense. But I'm not sure why nobody discuss it, maybe it's good for others?

So, I think an option to choose whether white space should be a trigger character is a good design, if it's not to hard to implement?

Have a nice day! 😄

r-mc2 commented 5 years ago

I also agree, space should not be allowed to be an Intellisense trigger.

I'm having a similar experience although I do not know which plugin I'm using that is causing the issue as I do not use Omnisharp. Every time I type a space in my code/comments/strings/anywhere Intellisense pops up showing it's listing of suggestions (including VSCode's built-ins (e.g. regions)).

It is beyond frustrating to have to escape out of the menu each time, more so when the suggestion list covers some portion of code I was just looking at. The situation gets worse when both Intellisense pops up under these conditions as well as the code-hints that also get displayed (e.g. function signatures and what arguments are valid). So now there are two items popped up covering more of the screen and needing two escape presses to clear it, all of which was not desired simply due to me adding spaces to my file.

My thoughts for this would be to blacklist the space character from being an option or provide the user a setting for their own choice of blacklisted Suggestion characters.

nerdmax commented 5 years ago

I also agree, space should not be allowed to be an Intellisense trigger.

I'm having a similar experience although I do not know which plugin I'm using that is causing the issue as I do not use Omnisharp. Every time I type a space in my code/comments/strings/anywhere Intellisense pops up showing it's listing of suggestions (including VSCode's built-ins (e.g. regions)).

It is beyond frustrating to have to escape out of the menu each time, more so when the suggestion list covers some portion of code I was just looking at. The situation gets worse when both Intellisense pops up under these conditions as well as the code-hints that also get displayed (e.g. function signatures and what arguments are valid). So now there are two items popped up covering more of the screen and needing two escape presses to clear it, all of which was not desired simply due to me adding spaces to my file.

My thoughts for this would be to blacklist the space character from being an option or provide the user a setting for their own choice of blacklisted Suggestion characters.

+1

jrieken commented 5 years ago

@r-mc2 Any idea what extension is caused this? Do you mind sharing the list of extensions that you have installed?

nerdmax commented 5 years ago

@jrieken I've installed HTML Snippets, JavaScript (ES6) code snippets, JavaScript Snippet Pack, Jest Snippets, TSLint Snippets.

jrieken commented 5 years ago

As a mitigation I have pushed a change so that no snippets show when IntelliSense is triggered via the space-character

Gama11 commented 5 years ago

Having space as a trigger character can be extremely useful - in the Haxe extension we use this to auto-trigger completion after keywords such as import, extends, implements, override, cast...

jrieken commented 5 years ago

@Gama11 What you describe is a pretty cool feature but there is a better way to support that. With your keyword completion items can provide a command that should be executed after the item is selected. Use editor.action.triggerSuggest and the editor will re-invoke IntelliSense without your provider being pinged on every space that has been typed. Would that work for you?

Gama11 commented 5 years ago

We already do that as well, but you don't always (want to) select the keyword from completion. :) The thing is that sometimes it's easier / more natural to type it out, particularly if you're a fast typer or it's a short keyword (Haxe has to and from as keywords in some type declarations).

Considering that has been working fine, I'd like to keep supporting both.

jrieken commented 5 years ago

/cc @rchande

r-mc2 commented 5 years ago

Sorry for the delay @jrieken

And a number of themes, but those shouldn't be relevant to the constant Intellisense popups. To note, these were working fine together before I updated Code an update or two back (perhaps one of them snuck in for a hint character?)

rchande commented 5 years ago

@jrieken Triggering intellisense on space is a pretty crucial part of the C# IDE experience. For example, if the user types List<string> x = new|, after they type space, the list automatically comes up with List<string> preselected. We have a bunch of features like that ingrained in our users' muscle memory and removing the ability to trigger completion on space would be a big regression for us.

As I mentioned in https://github.com/OmniSharp/omnisharp-vscode/issues/2765, I think the best fix would be to extend the snippets subsystem to allow a text-mate grammar to control when snippets activate--that could at least let C# exclude them from comments.

I think allowing users to control whether a snippet-only list is allowed to be displayed on typing is probably a reasonable solution.

rchande commented 5 years ago

@jrieken Another approach would be to allow disabling snippets on a per-language basis. Some C# extension users reported that globally disabling snippets wasn't a good solution for them because, though they don't need C# snippets, they do use them in other languages.

jrieken commented 5 years ago

Closing as folks have valid reasons for doing this. To mitigate this I have pushed a change that prevents snippet completions when IntelliSense is triggered via space (https://github.com/Microsoft/vscode/commit/9175a0612c3c183c06988e197d4639d4b5b0742d)