-
Notifications
You must be signed in to change notification settings - Fork 233
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
[Playground] Autocomplete #1166
Conversation
✅ Deploy Preview for sass-lang ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@nex3 I have a few options for getting the current list of module functions and variables. Essentially, I'm able to generate a list of the values using Sass,
Do you have any preference on this, or other ideas? I didn't see a clear way of parsing this from the existing documentation. |
Can you pass the result of |
That worked well! |
} | ||
|
||
type CompletionInfo = { | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document members
} | ||
`; | ||
|
||
const modMap: ModuleDefinition[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be cleaner to make this a Record<string, ModuleDefinition>
with the module names as keys? Then instead of some Array.prototype.reduce
stuff, you could use a simpler mapRecord<I, O>(record: Record<T, I>, mapper: (I) => O): Record<T, O>
utility function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially it could be cleaner in the cases where I'm reducing things into Record<ModuleName, CompletionSource>
, but the metadata is being used in other ways as well. I'm generally a fan of keeping data in flat arrays of objects, as it tends to be the most versatile.
}; | ||
} | ||
|
||
const moduleVariableCompletions = Object.freeze( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably for a follow-up PR, but it's worth thinking about ways to extract the documentation for variables and functions from source/documentation/modules/*.md
so we can include them in these autocompletions.
Adds Sass-specific autocomplete to the Playground, specifically-
@codemirror/lang-css
package in https://github.com/codemirror/lang-css/releases/tag/6.3.0 via Bump @codemirror/lang-css from 6.2.1 to 6.3.0 #1172, not here)@use "sass:math"
, for instancemath
math.$pi
math.clamp