Skip to content

Commit 2c6b70b

Browse files
committed
migrate to emmy_lsp_types
1 parent d5f05b1 commit 2c6b70b

File tree

10 files changed

+68
-56
lines changed

10 files changed

+68
-56
lines changed

Cargo.lock

Lines changed: 47 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ serde = { version = "1.0.219", features = ["derive"] }
1919
serde_json = "1.0.141"
2020
rowan = { version = "0.16.1" }
2121
notify = { version = "8.1.0", features = ["serde"] }
22-
lsp-types = { version = "0.97.0", features = ["proposed"]}
22+
lsp_types = { version = "0.1.0", package = "emmy_lsp_types" }
2323
schemars = "1.0.2"
2424
regex = "1"
2525
internment = { version = "0.8.6", features = ["arc"] }

crates/emmylua_check/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ emmylua_parser.workspace = true
1818
# external
1919
serde.workspace = true
2020
serde_json.workspace = true
21-
lsp-types.workspace = true
21+
lsp_types.workspace = true
2222
log.workspace = true
2323
fern.workspace = true
2424
rowan.workspace = true

crates/emmylua_code_analysis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ emmylua_diagnostic_macro.workspace = true
2727
# external
2828
serde.workspace = true
2929
serde_json.workspace = true
30-
lsp-types.workspace = true
30+
lsp_types.workspace = true
3131
schemars.workspace = true
3232
rowan.workspace = true
3333
regex.workspace = true

crates/emmylua_doc_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ emmylua_parser.workspace = true
2323
# external
2424
serde.workspace = true
2525
serde_json.workspace = true
26-
lsp-types.workspace = true
26+
lsp_types.workspace = true
2727
rowan.workspace = true
2828
walkdir.workspace = true
2929
tera.workspace = true

crates/emmylua_ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ lsp-server.workspace = true
2525
tokio.workspace = true
2626
serde.workspace = true
2727
serde_json.workspace = true
28-
lsp-types.workspace = true
28+
lsp_types.workspace = true
2929
log.workspace = true
3030
fern.workspace = true
3131
chrono.workspace = true

crates/emmylua_ls/src/context/lsp_features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl LspFeatures {
4646

4747
pub fn supports_refresh_diagnostic(&self) -> bool {
4848
if let Some(workspace) = &self.client_capabilities.workspace {
49-
if let Some(diagnostic) = &workspace.diagnostic {
49+
if let Some(diagnostic) = &workspace.diagnostics {
5050
if let Some(supports) = diagnostic.refresh_support {
5151
return supports;
5252
}

crates/emmylua_ls/src/handlers/diagnostic/workspace_diagnostic.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ pub async fn on_pull_workspace_diagnostic(
1717
return WorkspaceDiagnosticReport { items: vec![] };
1818
}
1919
let version = workspace_manager.get_workspace_version();
20+
let client_id = workspace_manager.client_config.client_id;
2021
workspace_manager.update_workspace_version(WorkspaceDiagnosticLevel::None, false);
2122
drop(workspace_manager);
2223

24+
if client_id.is_vscode() && context.lsp_features().supports_refresh_diagnostic() {
25+
context.client().refresh_workspace_diagnostics();
26+
}
27+
2328
// let emmyrc = context.analysis().read().await.get_emmyrc();
2429
let file_diagnostics = match status {
2530
WorkspaceDiagnosticLevel::None => Vec::new(),

crates/emmylua_ls/src/handlers/test_lib/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl ProviderVirtualWorkspace {
329329
let mut items = result
330330
.iter()
331331
.map(|l| VirtualLocation {
332-
file: l.uri.path().segments().next_back().unwrap().to_string(),
332+
file: l.uri.get_file_path().unwrap().to_string_lossy().to_string(),
333333
line: l.range.start.line,
334334
})
335335
.collect::<Vec<_>>();
@@ -418,10 +418,13 @@ impl ProviderVirtualWorkspace {
418418
pos: item.position.character,
419419
ref_file: match &item.label {
420420
InlayHintLabel::LabelParts(parts) => match parts.first() {
421-
Some(part) => part
422-
.location
423-
.as_ref()
424-
.map(|loc| loc.uri.path().segments().next_back().unwrap().to_string()),
421+
Some(part) => part.location.as_ref().map(|loc| {
422+
loc.uri
423+
.get_file_path()
424+
.unwrap()
425+
.to_string_lossy()
426+
.to_string()
427+
}),
425428
None => None,
426429
},
427430
InlayHintLabel::String(_) => None,
@@ -563,7 +566,7 @@ impl ProviderVirtualWorkspace {
563566
.into_iter()
564567
.map(|(uri, edits)| {
565568
Ok((
566-
uri.path().segments().next_back().or_fail()?.to_string(),
569+
uri.get_file_path().unwrap().to_string_lossy().to_string(),
567570
edits,
568571
))
569572
})

tools/schema_json_gen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ emmylua_code_analysis.workspace = true
1111
schemars.workspace = true
1212
serde.workspace = true
1313
serde_json.workspace = true
14-
lsp-types.workspace = true
14+
lsp_types.workspace = true

0 commit comments

Comments
 (0)