Skip to content

Commit

Permalink
fix(lsp): update tsconfig after refreshing settings on init (denoland…
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored and zifeo committed Nov 22, 2023
1 parent f7c63c5 commit 77d38b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
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",
},
"",
],
"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

0 comments on commit 77d38b9

Please sign in to comment.