-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use the LSP from workspace #9
Conversation
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.
Just a question, then I think we can try to release a new version
!f["dependencies"]["@biomejs/biome"].is_null() | ||
|| !f["devDependencies"]["@biomejs/biome"].is_null() |
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.
Wouldn't this error if dependencies
or devDependencies
fields aren't inside the package.json
?
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 tested a bit, it will return null if one of the fields is non-existent. But feel free to test it again.
// This is a workaround, as reading the file from wasm doesn't work. | ||
// Instead we try to read the `package.json`, see if `@biomejs/biome` is installed | ||
let package_json = worktree | ||
.read_text_file("package.json") |
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.
Check the existence of the LSP binary in the workspace with fs::metadata
doesn't work, probably because of wasm. Instead, we can read the package.json
with worktree::read_text_file
and find out if the user has included the @biomejs/biome
as part of dependencies
or devDependencies
.
Originally I was trying to read the node_modules/@biomejs/biome/package.json
with worktree::read_text_file
, just to check if the user already installed the package, but it doesn't work for some reason.
The extension will use the LSP in the workspace (installed by the user), and then fallback to the default LSP if it doesn't exist.
Related #6