Skip to content
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): update tsconfig after refreshing settings on init #21170

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(lsp): update tsconfig after refreshing settings on init
  • Loading branch information
nayeemrmn committed Nov 11, 2023
commit 92fc4eaac2747532f21c0ac5c1550196614fdfe3
3 changes: 3 additions & 0 deletions cli/lsp/language_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3180,6 +3180,9 @@ impl tower_lsp::LanguageServer for LanguageServer {

{
let mut ls = self.0.write().await;
if let Err(err) = ls.update_tsconfig().await {
ls.client.show_message(MessageType::WARNING, err);
}
ls.refresh_documents_config().await;
ls.diagnostics_server.invalidate_all();
ls.send_diagnostics_update();
Expand Down
29 changes: 16 additions & 13 deletions cli/tests/integration/lsp_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,9 @@ fn lsp_hover_unstable_disabled() {
"uri": "file:https:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "console.log(Deno.dlopen);\n"
// IMPORTANT: If you change this API due to stabilization, also change it
// in the enabled test below.
"text": "type _ = Deno.ForeignLibraryInterface;\n"
}
}));
let res = client.write_request(
Expand All @@ -1924,7 +1926,7 @@ fn lsp_hover_unstable_disabled() {
"textDocument": {
"uri": "file:https:///a/file.ts"
},
"position": { "line": 0, "character": 19 }
"position": { "line": 0, "character": 14 }
}),
);
assert_eq!(
Expand All @@ -1933,12 +1935,13 @@ fn lsp_hover_unstable_disabled() {
"contents": [
{
"language": "typescript",
"value": "any"
}
"value": "type Deno.ForeignLibraryInterface = /*unresolved*/ any",
nayeemrmn marked this conversation as resolved.
Show resolved Hide resolved
},
"",
],
"range": {
"start": { "line": 0, "character": 17 },
"end": { "line": 0, "character": 23 }
"start": { "line": 0, "character": 14 },
"end": { "line": 0, "character": 37 }
}
})
);
Expand All @@ -1957,7 +1960,7 @@ fn lsp_hover_unstable_enabled() {
"uri": "file:https:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "console.log(Deno.ppid);\n"
"text": "type _ = Deno.ForeignLibraryInterface;\n"
}
}));
let res = client.write_request(
Expand All @@ -1966,7 +1969,7 @@ fn lsp_hover_unstable_enabled() {
"textDocument": {
"uri": "file:https:///a/file.ts"
},
"position": { "line": 0, "character": 19 }
"position": { "line": 0, "character": 14 }
}),
);
assert_eq!(
Expand All @@ -1975,14 +1978,14 @@ fn lsp_hover_unstable_enabled() {
"contents":[
{
"language":"typescript",
"value":"const Deno.ppid: number"
"value":"interface Deno.ForeignLibraryInterface"
},
"The process ID of parent process of this instance of the Deno CLI.\n\n```ts\nconsole.log(Deno.ppid);\n```",
"\n\n*@category* - Runtime Environment",
"**UNSTABLE**: New API, yet to be vetted.\n\nA foreign library interface descriptor.",
"\n\n*@category* - FFI",
],
"range":{
"start":{ "line":0, "character":17 },
"end":{ "line":0, "character":21 }
"start":{ "line":0, "character":14 },
"end":{ "line":0, "character":37 }
}
})
);
Expand Down