1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(lsp): allow query strings for "deno:/status.md" (#20697)

This commit is contained in:
Nayeem Rahman 2023-09-27 01:48:34 +01:00 committed by GitHub
parent 46a4bd5178
commit b433133a1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View file

@ -3735,7 +3735,9 @@ impl Inner {
let specifier = self let specifier = self
.url_map .url_map
.normalize_url(&params.text_document.uri, LspUrlKind::File); .normalize_url(&params.text_document.uri, LspUrlKind::File);
let contents = if specifier.as_str() == "deno:/status.md" { let contents = if specifier.scheme() == "deno"
&& specifier.path() == "/status.md"
{
let mut contents = String::new(); let mut contents = String::new();
let mut documents_specifiers = self let mut documents_specifiers = self
.documents .documents

View file

@ -4320,6 +4320,35 @@ fn test_lsp_code_actions_ordering() {
); );
} }
#[test]
fn lsp_status_file() {
let context = TestContextBuilder::new().use_temp_cwd().build();
let mut client = context.new_lsp_command().build();
client.initialize_default();
let res = client.write_request(
"deno/virtualTextDocument",
json!({
"textDocument": {
"uri": "deno:/status.md"
}
}),
);
let res = res.as_str().unwrap().to_string();
assert!(res.starts_with("# Deno Language Server Status"));
let res = client.write_request(
"deno/virtualTextDocument",
json!({
"textDocument": {
"uri": "deno:/status.md?1"
}
}),
);
let res = res.as_str().unwrap().to_string();
assert!(res.starts_with("# Deno Language Server Status"));
}
#[test] #[test]
fn lsp_code_actions_deno_cache() { fn lsp_code_actions_deno_cache() {
let context = TestContextBuilder::new().use_temp_cwd().build(); let context = TestContextBuilder::new().use_temp_cwd().build();