-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(lsp): support npm workspaces and fix some resolution issues #24627
Conversation
"textDocument/hover", | ||
json!({ | ||
|
||
// project1 resolution |
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.
This is #24598
let discover_result = match scope.to_file_path() { | ||
Ok(scope_dir_path) => { | ||
let paths = [scope_dir_path]; | ||
Workspace::discover( |
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 name Workspace
is a little confusing because it actually contains information about where it started discovery from. Maybe we should rename it to WorkspaceContext
or something like that? denoland/deno_config#93
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 agree
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.
denoland/deno_config#94 -- We can also now re-org this to cache the workspace loading between discoveries.
I have an example of npm workspaces working without byonm, but failing with it in the lsp for some reason. This should be good enough for the first pass though. |
@@ -11917,6 +11917,11 @@ fn lsp_node_modules_dir() { | |||
|
|||
assert!(!temp_dir.path().join("node_modules").exists()); | |||
|
|||
// a lockfile will be created here because someone did an explicit cache | |||
let lockfile_path = temp_dir.path().join("deno.lock"); | |||
assert!(lockfile_path.exists()); |
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.
Running deno cache creates a lockfile here so I think this is ok because it aligns with that now?
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.
Yes, I agree
}, | ||
"newText": "''", | ||
"newText": "'')", |
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.
Bug fix. Should be no semis here.
cached_deno_config_fs: &(dyn DenoConfigFs + Sync), | ||
deno_json_cache: &(dyn DenoJsonCache + Sync), | ||
pkg_json_cache: &(dyn PackageJsonCache + Sync), |
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.
Sidenote: maybe we could create a wrapper like deno_unsync
that would cheat the type system and not require these Sync
trait bounds?
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.
LGTM
@@ -11917,6 +11917,11 @@ fn lsp_node_modules_dir() { | |||
|
|||
assert!(!temp_dir.path().join("node_modules").exists()); | |||
|
|||
// a lockfile will be created here because someone did an explicit cache | |||
let lockfile_path = temp_dir.path().join("deno.lock"); | |||
assert!(lockfile_path.exists()); |
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.
Yes, I agree
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.
LGTM
Workspace cache for deno_config is in denoland/deno_config#95 -- I will follow up and land that in a separate PR. |
Makes the lsp use the same code as the rest of the cli.
Makes the lsp use the same code as the rest of the cli.
Closes #24598
Closes #24505