sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.21k stars 196 forks source link

No Autocompletion for Stylus in vscode #664

Open Pytal opened 3 years ago

Pytal commented 3 years ago

Describe the bug

Autocompletion does not work when writing styles with stylus in a sapper project.

To Reproduce Steps to reproduce the behavior:

  1. Scaffold a sapper project and install stylus

    npm add -D stylus
  2. Setup svelte-preprocess in svelte.config.js

    
    const sveltePreprocess = require('svelte-preprocess')

module.exports = { preprocess: sveltePreprocess() }


3. Install the [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) and [language-stylus](https://marketplace.visualstudio.com/items?itemName=sysoev.language-stylus) extensions

4. Write styles and trigger completion suggestions
```svelte
<style lang='stylus'>
  main {
    display: flex;
  }
</style>

Expected behavior

Autocompletion suggestions for CSS properties should appear just as when writing css or scss.

System (please complete the following information):

Monkatraz commented 3 years ago

I did a quick-check as I thought my PR https://github.com/sveltejs/language-tools/pull/657 would've fixed this (I added source.stylus to the extension's package.json as it was missing) and yet it appears it hasn't. Normally, this should be all you need to do for autocomplete to work in an embedded language, or at least I thought so? Taking an educated guess, I bet the issue is with the Stylus extension itself not working within embedded blocks for whatever reason.

dummdidumm commented 3 years ago

source.stylus is only related to the highlighting in this context, the autocompletion has to be implemented separately through a language server/client.

Monkatraz commented 3 years ago

Oh, to be clear, what I mean is that the field mapping the source.stylus scope to the stylus language was missing in the package.json. What I had gathered from the VSCode docs is that you needed to assign some scope to an embedded language to get autocomplete to work. However, beyond that, I have no idea what I'm talking about and I was just documenting that my fix didn't work or was unrelated.

jeremyjacob commented 3 years ago

I have played around with this to no avail. If someone has a solution please share!