visual-studio-codeintellisensevscode-snippets

How to get automatic intellisense after expanding a snippet in VSCode?


I I try to write code more faster, but I have a trouble. I use Astro.js with TypeScript and VSCode with Astro extension.

When I write some prop (attribute) in my component tag I get intellisense dropdown with available props this component.

First intellisense dropdown

After accept iconDirection I get iconDirection="" with 2 cursor places (I think it some snippet logic).

After accept hint

It decision don't show a next intellisense suggest.

After that I exite from "snippet itinerary", remove quote symbols and write them again. And only this way I get a second intellisense with available values current prop.

What I'm waiting in second hint

General question: How I can write it more faster?, i.e.:

  1. Type i
  2. Select some proposed prop (attribute)
  3. And at once get second dropdown with available values
  4. Select some value

Or:

  1. How to toggle off ="" after accept intellisense variant?
  2. How get intellisense in snippet after cursor placed (automatically dropdown, not with shortcuts!)?

I've tried setting the quotes in VSCode to not automatically put them, but it doesn't affect the intellisense tooltips being expanded. They are still expanded along with the ="". I tried to call tooltips through key combinations, but they are called a little incorrectly (a full set of tooltips, instead of several values). I tried (and am still trying) to find a solution for editing tooltips into the form I need.

UPD: I partially solve the problem by adding this settings:

"editor.snippetSuggestions": "bottom",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.quickSuggestions": {
  "other": true,
  "comments": false,
  "strings": true
},

But this forces me to use shortcuts and does not show tooltips automatically =(


Solution

  • As far as I know, VS Code doesn't support this normally (automatically triggering suggestions after accepting another suggestion or inserting a snippet without the user typing anything to trigger quick suggestions). Maintainers seem to agree. See this exchange (quoting Johannes Rieken):

    Is your expectation that VS Code asks for completions right after accepting one completion item?

    VS Code doesn't do that... Auto triggering suggestion only happens on typing (word starts or trigger characters). However, you can use editor.action.triggerSuggest as command on a suggestion to "manually" retrigger suggest after inserting one.

    In that second paragraph, I believe he's referring to CompletionItem's command property- I.e. that solution would have to be hard-coded, which has to be done on a per extension / CompletionItemProvider / CompletionItem basis.

    I suppose if you really wanted a feature like that, you could raise a feature-request issue ticket.

    But I'd personally just suggest binding triggering autocomplete to something really easy to reach. I personally use alt+a (thumb + pinky, though I rebind my caps-lock to ctrl, so it would be just as easy with the default ctrl/cmd+space).