Search code examples
visual-studio-codeautocompletesvelteintellisense

How to prevent intellisense completion in .svelte files in VScode


When I am writing code in a .svelte file, if I press the . key (full stop/period) the intellisense autocompletes. So if I write an import statement in a scrip tag with a relative path such as:

import "../../styles/style.css"

I have to press escape after every first . to prevent the intellisense completing the statement with the top most result. This happens in .svelte files but not .js files.

I can't find a keyboard shortcut, VScode setting or 'Svelte for VScode' extension setting that is causing this, the . is not bound on it's own to any single action, and I don't want to turn off intellisense completely. Any suggestions on how to fix?


Solution

  • This does not happen by default. You probably have disabled auto closing quotes.

    The Svelte extension has issues if things are not properly closed (e.g. component tags), this is a known problem. If you have an incomplete import statement import ', the typed text is interpreted as regular JS which will insert the completion on entering ..

    Close the string first and then type the path.