Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completions #34

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Completions #34

wants to merge 4 commits into from

Conversation

wkillerud
Copy link
Collaborator

@wkillerud wkillerud commented Jan 4, 2025

Sets up the server capability and a handler for completion requests.

I've run into an issue with how strict the current parser is:
https://github.com/sass/dart-sass-language-server/pull/34/files#diff-dfd87bf70431e0c34c7d859b41e81359474d0cff8488684c8796738aed0c3e72R87-R119

.a {
  display: /* [1] */ ;
}

/* [1] Here the parser throws (Error: Expected expression).
   Since we don't have a Stylesheet we can't tell what the context/AstNode is at this position.
   We would like to know that we're in a Declaration with the name "display", with no children,
   so we can provide completion items for the allowed values for the display property.

   In this particular case we could probably work around it by looking at the raw string,
   but strings have their own limitations and problems (how to handle scope for Sass variables
   for instance). */

It makes perfect sense for a compiler to be this strict, but (especially for this feature) the language server needs the parser to run in a mode where it does its best to recover from these errors and returns the Stylesheet in whatever state it currently is, errors and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completions aka IntelliSense
1 participant