pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.09k stars 131 forks source link

[autocomplete-css] Support for SCSS files #542

Open savetheclocktower opened 1 year ago

savetheclocktower commented 1 year ago

Have you checked for existing feature requests?

Summary

The autocomplete-css package has two big problems: (a) it doesn't seem to suggest things correctly when (legacy) Tree-sitter grammars are used, and (b) it doesn't have any code to handle SCSS syntax (as opposed to the old Sass syntax that had no braces).

The first item is low priority because we're about to phase out those grammars, and I'll make sure the modern Tree-sitter CSS grammar doesn't make the same mistake. But we should update all the Sass code paths so that they check for SCSS-specific scope names in addition to the Sass-specific scope names.

What benefits does this feature provide?

CSS autocompletion will work inside of SCSS files.

Any alternatives?

Don't think so. The whole reason there's a Sass-specific code path in the provider is that Sass blocks can be nested and CSS blocks can't. So the provider needs to know what mode it's in so that it knows whether it can suggest things like tag names.

Other examples:

No response

confused-Techie commented 1 year ago

Are you aware if the completions SCSS files need would be any different? Since our COMPLETIONS.json file doesn't have anything that's SCSS specific, so I wonder if we would want to add those in, or if we are currently only providing value completions

savetheclocktower commented 1 year ago

I don't think they would be, but I did only glance at it. I think it could reuse the logic it uses for old-style Sass files.

confused-Techie commented 1 year ago

Do you think this was covered by #601 Admittedly I didn't test SCSS much at all during that PR

savetheclocktower commented 1 year ago

No, didn't address it. The SCSS grammar is separate from the Sass grammar. There's a third-party tree-sitter library for SCSS, but it's not quite where it needs to be, so to make this work I'd have to spend some time with the builtin TM-style SCSS grammar.

confused-Techie commented 1 year ago

No, didn't address it. The SCSS grammar is separate from the Sass grammar. There's a third-party tree-sitter library for SCSS, but it's not quite where it needs to be, so to make this work I'd have to spend some time with the builtin TM-style SCSS grammar.

Thanks a ton for clarifying, just wanted to double check so we could close it if need be. Didn't realize they were separated out