-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #77
Conversation
✅ Deploy Preview for sass-site-oddbird ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@mirisuzanne and @stacyk - could you try out the Autocomplete here and see if it works well and as expected? |
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.
- At-rules: works great
- Built in module names: only works with e.g.
"sass:math"
, not'sass:math'
. Should probably work with single-quotes as well? - Built in variables: works great
- Built in functions: works great
Good catch! Fixed. |
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.
@jamesnw Works great! Obviously it would be ideal if we could get some of these values (e.g. at-rules, modules, etc) dynamically from Sass itself. I assume you looked into that and they're not being exposed currently? It might even be worth mentioning that to Natalie to see what she thinks.
const atRuleKeywords = [ | ||
'use', | ||
'forward', | ||
'import', | ||
'mixin', | ||
'include', | ||
'function', | ||
'extend', | ||
'error', | ||
'warn', | ||
'debug', | ||
'at-root', | ||
'if', | ||
'else', | ||
'each', | ||
'for', | ||
'while', | ||
]; |
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.
Do we want to add @media
, @supports
, and @keyframes
here? And maybe also add autocomplete for other CSS at-rules?
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.
I think css at-rules would be good to consider supporting. Hopefully there's a clear enough division between that and auto-completing css properties/values, so this doesn't become a very slippery scope slope.
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.
I think that probably should go upstream into @codemirror/lang-css- that shouldn't be too challenging, I don't think.
We are already getting auto-completion of css properties and values from that package.
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.
Makes sense -- add a comment or file a new issue so we don't lose track?
|
||
const builtinModules: ModuleDefinition[] = [ | ||
{ | ||
name: 'color', |
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.
Is there a reason we're not including the color
functions (e.g. adjust
, scale
, etc) here?
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.
I'm holding out hope there's a way to get this from Sass directly, as this is a long list, and will be changing once the CSS Color 4 changes are made in Sass.
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.
Makes sense -- add a comment so we don't forget?
@jamesnw Will this story (or any future stories) include autocompleting CSS properties? For instance, in the SCSS panel, if I type
I was expecting to see |
The issue is the missing |
@jamesnw I'm not sure the full scope of this story or if it is even unexpected, but I noticed when I type |
I'm literally LOL |
This is another instance of confusing the parser. Without the end quote, the parser doesn't know it's a StringLiteral, and thinks it's a pseudoclass. I pushed a change that should address it. |
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.
The update you made for the autocomplete without the final quote works great!
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.
👏
@@ -11,7 +11,7 @@ import { | |||
historyKeymap, | |||
indentWithTab, | |||
} from '@codemirror/commands'; | |||
import {css as langCss} from '@codemirror/lang-css'; | |||
import {css as langCss, cssCompletionSource} from '@codemirror/lang-css'; |
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.
Unused import?
import {css as langCss, cssCompletionSource} from '@codemirror/lang-css'; | |
import {css as langCss} from '@codemirror/lang-css'; |
const atRuleKeywords = [ | ||
'use', | ||
'forward', | ||
'import', | ||
'mixin', | ||
'include', | ||
'function', | ||
'extend', | ||
'error', | ||
'warn', | ||
'debug', | ||
'at-root', | ||
'if', | ||
'else', | ||
'each', | ||
'for', | ||
'while', | ||
]; |
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.
Makes sense -- add a comment or file a new issue so we don't lose track?
|
||
const builtinModules: ModuleDefinition[] = [ | ||
{ | ||
name: 'color', |
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.
Makes sense -- add a comment so we don't forget?
Moving to sass repo- sass#1166 |
Description
Adds Sass-specific Autocomplete
Related Issue(s)
#78
Steps to test/reproduce
Go to Playground, type in Sass-specific words.
@use
,@debug
, etc.@use "sass:math"
, for instancemath.$pi
math.clamp