-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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): include all diagnosable documents on initialize #17979
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.
Reviewed halfway. Left some nitpicks. This is a very anticipated feature! eg. I just ran into this with a repo of some hundreds of files where keeping open (or forgetting to close) all files was just not a possible thing.
…to fix_lsp_open_docs_root
@@ -42,7 +41,7 @@ fn base_url_to_filename(url: &Url) -> Option<PathBuf> { | |||
} | |||
"data" | "blob" => (), | |||
scheme => { | |||
error!("Don't know how to create cache name for scheme: {}", scheme); |
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.
Now this error is more likely to happen because it might load in some random files that use a different scheme (ex. "ext:" scheme in our case). This could be especially annoying in the repl. I downgraded this to debug because it didn't seem that important to surface at an "error" level.
@@ -131,24 +131,43 @@ fn pty_complete_expression() { | |||
|
|||
#[test] | |||
fn pty_complete_imports() { | |||
util::with_pty(&["repl", "-A"], |mut console| { |
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 updated the pty tests to use a temporary cwd by defualt in util::with_pty
because otherwise now it will load too many files in that may conflict with things such as completions. Actually, thinking about it more, I should probably do the same for the lsp tests (Edit: Done)
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, it makes more sense to use temp CWD here and in the LSP tests
use test_util::testdata_path; | ||
use test_util::TestContextBuilder; | ||
use tower_lsp::lsp_types as lsp; | ||
|
||
#[test] | ||
fn lsp_startup_shutdown() { | ||
let mut client = LspClientBuilder::new().build(); | ||
let context = TestContextBuilder::new().use_temp_cwd().build(); |
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 this should be the default actually and it should opt out of using a temp cwd. I will look into this in a future PR and it would allow me to revert a lot of this.
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, so exciting to have this finally fixed. I'm sure users will be very happy about this change.
assert_eq!( | ||
config.enabled_root_urls(), | ||
vec![ | ||
root_dir1.join("sub_dir").unwrap(), | ||
root_dir1.join("test.ts").unwrap(), | ||
root_dir2.join("other.ts").unwrap(), | ||
root_dir3 | ||
] | ||
); |
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.
Nice tests
@@ -7216,3 +7216,56 @@ Deno.test({ | |||
|
|||
client.shutdown(); | |||
} | |||
|
|||
#[test] | |||
fn lsp_closed_file_find_references() { |
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.
Great!
@@ -131,24 +131,43 @@ fn pty_complete_expression() { | |||
|
|||
#[test] | |||
fn pty_complete_imports() { | |||
util::with_pty(&["repl", "-A"], |mut console| { |
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, it makes more sense to use temp CWD here and in the LSP tests
Closes denoland/vscode_deno#797 Closes #11190 Closes denoland/vscode_deno#811 Closes denoland/vscode_deno#761 Closes denoland/vscode_deno#585 Closes denoland/vscode_deno#561 Closes denoland/vscode_deno#410
This seems to have introduced a regression as described in #18538 |
Closes denoland/vscode_deno#797
Closes #11190
Closes denoland/vscode_deno#811
Closes denoland/vscode_deno#761
Closes denoland/vscode_deno#585
Closes denoland/vscode_deno#561
Closes denoland/vscode_deno#410