wkillerud / some-sass

Improved support for SCSS, Sass indented and SassDoc. Workspace awareness and full support for Sass modules.
https://wkillerud.github.io/some-sass/
60 stars 6 forks source link

Colour Decorators is duplicated when defining the values #233

Closed yCodeTech closed 2 months ago

yCodeTech commented 2 months ago

In which editor is this a problem?

Visual Studio Code

Describe the bug

The colour decorators are duplicated when defining colour values to variables but are not duplicated when using the colour variables.

I have rolled back a couple of versions and found that it functions correctly in v3.6.4; all version afterwards the decorators are shown twice. Please refer to the screenshot below for the bug in action in the latest version (v3.9.0).

image

What's the expected result?

The colour decorator is shown only once.

Link to minimal reproducible example

No response

Participation

niksy commented 2 months ago

Same issue in Sublime Text.

wkillerud commented 2 months ago

Strange, this is what I'm seeing in VS Code (left) and Sublime Text (right) with the current release (3.9.0 of the extension, 1.8.0 of the language server).

screenshot showing both editors with no duplicate color decorators

Does the same happen if you turn off other extensions? And can you share your settings if you use anything other than the defaults?

niksy commented 2 months ago

This happens in Sublime Text if you have CSS and Sass language server active for the current context.

I’ve added information about this and how to bypass it in LSP-sass, but this works best with workspaces, and conflicts with situations where you could have CSS and Sass files in project and then you wouldn’t have color information for CSS files.

This is also an issue with how links work for @use and @forward, you would get double definitions and you would need to choose from provided links. And as mentioned, this doubles down to how SFC such as the one in Vue works where you also need to disabled those capabilities.

Disabling colorProvider for Sass language server removes color hints for Sass variables so this can’t be focused only on Sass language server context, it must be applied to CSS language server to work properly.

One possibility is if Sass language server could fully extend CSS language server so you get all completions and property types and then CSS language server could be disabled for Sass files. I don’t know if that’s possible or is that something that conflicts with how VS Code implementation works.

wkillerud commented 2 months ago

I see, thanks for elaborating @niksy – that makes sense. I'll try to reproduce again in Sublime (and double check my own settings in Code – maybe I turned off something of the built-in stuff 😅).

One possibility is if Sass language server could fully extend CSS language server so you get all completions and property types and then CSS language server could be disabled for Sass files. I don’t know if that’s possible or is that something that conflicts with how VS Code implementation works.

This has been on my "maybe some day" list for a while, to make this language server "fully operational" if you will 😄 Especially now, since we have all those features for the Indented syntax. The code is there, it's "just" a matter of turning it on for SCSS and CSS as well.

It is possible for a user to turn off the built-in CSS features in Code. Another option is to have settings for features that conflict with the VS Code CSS language server, and have them default off only for the VS Code extension/language client.

yCodeTech commented 2 months ago

In VS Code, the built-in CSS Language Features that also provides colour/color picker for the colour values. Disabling this built-in extension removes the 2nd colour picker, but also removes other css related intellisense, so this isn't feasible.

I can see there is a setting within Some Sass "Suggest All from Open Document" to enable it's code suggestions from this extension. Disabling this also removes the 2nd colour picker, but considering I don't know what other suggestions/intellisense I'm disabling for SCSS with Some Sass, then this also isn't feasible. (Plus I don't have any duplicate suggestions that I can see, so there is no other reason to disable this.)

Another option is to have settings for features that conflict with the VS Code CSS language server, and have them default off only for the VS Code extension/language client.

I think this would be the best way to go. A completely separate setting to disable the duplicated colour picker would be perfect, and ensures all other extension suggestions are enabled.

wkillerud commented 2 months ago

I shipped a quick fix for VS Code and opened #236 for the longer-term improvements we discussed 👍