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
fix(vscode): respect unocss.root
#1169
Conversation
✅ Deploy Preview for unocss ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
/cc @QiroNT |
I guess bug in here unocss/packages/vscode/src/index.ts Lines 21 to 28 in 47a861d
Although the project does not contain any unocss config files, the registerAutoComplete and registerAnnotations functions are called, and the ContextLoader creates the default context.
|
Hi, @TrickyPi thanks for your comment. I updated a commit. The extension shouldn't be activated when the config file is not found under This is my first PR on |
unocss.root
unocss.root
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.
These are my ideas.
packages/vscode/src/annotation.ts
Outdated
const id = doc.uri.fsPath | ||
if (!id.startsWith(cwd)) |
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 guess it's unnecessary.
packages/vscode/src/autocomplete.ts
Outdated
const id = doc.uri.fsPath | ||
if (!id.startsWith(cwd)) |
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.
As above.
@@ -19,12 +19,17 @@ export async function activate(ext: ExtensionContext) { | |||
log.appendLine(`UnoCSS for VS Code v${version} ${process.cwd()}`) | |||
|
|||
const contextLoader = new ContextLoader(cwd) | |||
|
|||
const hasConfig = await contextLoader.loadContextInDirectory(cwd) | |||
if (!hasConfig) |
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 load
function in loadContextInDirectory
may be called twice, because new ContextLoader
calls loadContextInDirectory by default, so it's better to call contextLoader.loadContextInDirectory
after contextLoader.ready
, and this call will hit the contextsMap
cache (the cache value is null
)
Yes |
After v0.40.0, configuring
unocss.root
does not work, decorations and tooltips are displayed in all files.close #1183