-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Changes from 1 commit
6125671
f08a5bf
ef6475c
17b1f0b
67439dd
abedfff
459ce44
72bfa94
cdc4af0
0129cf9
8688718
8b0ab70
4c9e102
d9c5e91
fc4d027
08ef6af
2dc17b0
bab99d7
b7dee99
a8cb329
5894f85
c5cfb24
b7d7541
41b3004
8dec2d3
5a55a7e
74fb03f
818811e
7b96f00
bc3c42e
697ace6
2216402
8fe2597
4d8a9b0
b416267
055f94d
6cc5a97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
// single quotes | ||
console.write_line_raw("import './run/001_hel\t'"); | ||
console.expect("Hello World"); | ||
// double quotes | ||
console.write_line_raw("import { output } from \"./run/045_out\t\""); | ||
console.expect("\"./run/045_output.ts\""); | ||
console.write_line_raw("output('testing output');"); | ||
console.expect("testing output"); | ||
}); | ||
let context = TestContextBuilder::default().use_temp_cwd().build(); | ||
let temp_dir = context.temp_dir(); | ||
temp_dir.create_dir_all("subdir"); | ||
temp_dir.write("./subdir/my_file.ts", ""); | ||
temp_dir.create_dir_all("run"); | ||
temp_dir.write("./run/hello.ts", "console.log('Hello World');"); | ||
temp_dir.write( | ||
"./run/output.ts", | ||
r#"export function output(text: string) { | ||
console.log(text); | ||
} | ||
"#, | ||
); | ||
context | ||
.new_command() | ||
.args_vec(["repl", "-A"]) | ||
.with_pty(|mut console| { | ||
// single quotes | ||
console.write_line_raw("import './run/hel\t'"); | ||
console.expect("Hello World"); | ||
// double quotes | ||
console.write_line_raw("import { output } from \"./run/out\t\""); | ||
console.expect("\"./run/output.ts\""); | ||
console.write_line_raw("output('testing output');"); | ||
console.expect("testing output"); | ||
}); | ||
|
||
// ensure when the directory changes that the suggestions come from the cwd | ||
util::with_pty(&["repl", "-A"], |mut console| { | ||
console.write_line("Deno.chdir('./subdir');"); | ||
console.expect("undefined"); | ||
console.write_line_raw("import '../run/001_hel\t'"); | ||
console.expect("Hello World"); | ||
}); | ||
context | ||
.new_command() | ||
.args_vec(["repl", "-A"]) | ||
.with_pty(|mut console| { | ||
console.write_line("Deno.chdir('./subdir');"); | ||
console.expect("undefined"); | ||
console.write_line_raw("import '../run/he\t'"); | ||
console.expect("Hello World"); | ||
}); | ||
} | ||
|
||
#[test] | ||
|
@@ -283,10 +302,15 @@ fn let_redeclaration() { | |
|
||
#[test] | ||
fn repl_cwd() { | ||
util::with_pty(&["repl", "-A"], |mut console| { | ||
console.write_line("Deno.cwd()"); | ||
console.expect("testdata"); | ||
}); | ||
let context = TestContextBuilder::default().use_temp_cwd().build(); | ||
let temp_dir = context.temp_dir(); | ||
context | ||
.new_command() | ||
.args_vec(["repl", "-A"]) | ||
.with_pty(|mut console| { | ||
console.write_line("Deno.cwd()"); | ||
console.expect(temp_dir.path().file_name().unwrap().to_str().unwrap()); | ||
}); | ||
} | ||
|
||
#[test] | ||
|
@@ -384,18 +408,30 @@ fn multiline() { | |
|
||
#[test] | ||
fn import() { | ||
util::with_pty(&["repl", "-A"], |mut console| { | ||
console.write_line("import('./subdir/auto_print_hello.ts')"); | ||
console.expect("hello!"); | ||
}); | ||
let context = TestContextBuilder::default() | ||
.use_copy_temp_dir("./subdir") | ||
.build(); | ||
context | ||
.new_command() | ||
.args_vec(["repl", "-A"]) | ||
.with_pty(|mut console| { | ||
console.write_line("import('./subdir/auto_print_hello.ts')"); | ||
console.expect("hello!"); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn import_declarations() { | ||
util::with_pty(&["repl", "-A"], |mut console| { | ||
console.write_line("import './subdir/auto_print_hello.ts'"); | ||
console.expect("hello!"); | ||
}); | ||
let context = TestContextBuilder::default() | ||
.use_copy_temp_dir("./subdir") | ||
.build(); | ||
context | ||
.new_command() | ||
.args_vec(["repl", "-A"]) | ||
.with_pty(|mut console| { | ||
console.write_line("import './subdir/auto_print_hello.ts'"); | ||
console.expect("hello!"); | ||
}); | ||
} | ||
|
||
#[test] | ||
|
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.