Latest proposed LSP 3.16.0

Needs: https://github.com/gluon-lang/lsp-types/pull/183
This commit is contained in:
kjeremy 2020-10-21 14:57:55 -04:00
parent 35ed3d2c00
commit 5cb6fafd36
9 changed files with 39 additions and 24 deletions

4
Cargo.lock generated
View file

@ -852,9 +852,9 @@ dependencies = [
[[package]]
name = "lsp-types"
version = "0.82.0"
version = "0.83.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db895abb8527cf59e3de893ab2acf52cf904faeb65e60ea6f373e11fe86464e8"
checksum = "25e0bd4b95038f2c23bda332ba0ca684e8dda765db1f9bdb63dc4c3e01f3b456"
dependencies = [
"base64",
"bitflags",

View file

@ -21,7 +21,7 @@ env_logger = { version = "0.8.1", default-features = false }
itertools = "0.9.0"
jod-thread = "0.1.0"
log = "0.4.8"
lsp-types = { version = "0.82.0", features = ["proposed"] }
lsp-types = { version = "0.83.0", features = ["proposed"] }
parking_lot = "0.11.0"
pico-args = "0.3.1"
oorandom = "11.1.2"

View file

@ -48,7 +48,7 @@ pub fn server_capabilities(client_caps: &ClientCapabilities) -> ServerCapabiliti
references_provider: Some(OneOf::Left(true)),
document_highlight_provider: Some(OneOf::Left(true)),
document_symbol_provider: Some(OneOf::Left(true)),
workspace_symbol_provider: Some(true),
workspace_symbol_provider: Some(OneOf::Left(true)),
code_action_provider: Some(code_action_provider),
code_lens_provider: Some(CodeLensOptions { resolve_provider: Some(true) }),
document_formatting_provider: Some(OneOf::Left(true)),
@ -113,6 +113,7 @@ fn code_action_capabilities(client_caps: &ClientCapabilities) -> CodeActionProvi
CodeActionKind::REFACTOR_INLINE,
CodeActionKind::REFACTOR_REWRITE,
]),
resolve_provider: None,
work_done_progress_options: Default::default(),
})
})

View file

@ -248,10 +248,12 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
range: in_macro_location.range,
severity,
code: code.clone().map(lsp_types::NumberOrString::String),
code_description: None,
source: Some(source.clone()),
message: message.clone(),
related_information: Some(information_for_additional_diagnostic),
tags: if tags.is_empty() { None } else { Some(tags.clone()) },
data: None,
};
Some(MappedRustDiagnostic {
@ -267,6 +269,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
range: location.range,
severity,
code: code.clone().map(lsp_types::NumberOrString::String),
code_description: None,
source: Some(source.clone()),
message,
related_information: if related_information.is_empty() {
@ -275,6 +278,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
Some(related_information.clone())
},
tags: if tags.is_empty() { None } else { Some(tags.clone()) },
data: None,
};
let main_diagnostic =

View file

@ -1121,10 +1121,12 @@ pub(crate) fn publish_diagnostics(
range: to_proto::range(&line_index, d.range),
severity: Some(to_proto::diagnostic_severity(d.severity)),
code: None,
code_description: None,
source: Some("rust-analyzer".to_string()),
message: d.message,
related_information: None,
tags: if d.unused { Some(vec![DiagnosticTag::Unnecessary]) } else { None },
data: None,
})
.collect();
Ok(diagnostics)

View file

@ -709,7 +709,16 @@ pub(crate) fn call_hierarchy_item(
let detail = target.description.clone();
let kind = symbol_kind(target.kind);
let (uri, range, selection_range) = location_info(snap, target)?;
Ok(lsp_types::CallHierarchyItem { name, kind, tags: None, detail, uri, range, selection_range })
Ok(lsp_types::CallHierarchyItem {
name,
kind,
tags: None,
detail,
uri,
range,
selection_range,
data: None,
})
}
pub(crate) fn code_action_kind(kind: AssistKind) -> lsp_types::CodeActionKind {

View file

@ -2409,32 +2409,32 @@
}
},
"vscode-jsonrpc": {
"version": "6.0.0-next.5",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0-next.5.tgz",
"integrity": "sha512-IAgsltQPwg/pXOPsdXgbUTCaO9VSKZwirZN5SGtkdYQ/R3VjeC4v00WTVvoNayWMZpoC3O9u0ogqmsKzKhVasQ=="
"version": "6.0.0-next.6",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0-next.6.tgz",
"integrity": "sha512-w3w1T9tGsInSbGyv2kpi4o6ciMIyfVkM+kAvkxEv4zIv3fs69q3Qyt7ZMLiXnaRFXecIOY2ALDKwIMi0n2IwHQ=="
},
"vscode-languageclient": {
"version": "7.0.0-next.9",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.9.tgz",
"integrity": "sha512-lFO+rN/i72CM2va6iKXq1lD7pJg8J93KEXf0w0boWVqU+DJhWzLrV3pXl8Xk1nCv//qOAyhlc/nx2KZCTeRF/A==",
"version": "7.0.0-next.10",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.10.tgz",
"integrity": "sha512-J9Hp64j1aaQfXlhMPGI1XAcdsIcSNPAL6022JElzgxsfAydmQfZeKCCNdyybjhmZ+xrep2yoVRAeD5TZFP7y6g==",
"requires": {
"semver": "^6.3.0",
"vscode-languageserver-protocol": "3.16.0-next.7"
"vscode-languageserver-protocol": "3.16.0-next.8"
}
},
"vscode-languageserver-protocol": {
"version": "3.16.0-next.7",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.7.tgz",
"integrity": "sha512-tOjrg+K3RddJ547zpC9/LAgTbzadkPuHlqJFFWIcKjVhiJOh73XyY+Ngcu9wukGaTsuSGjJ0W8rlmwanixa0FQ==",
"version": "3.16.0-next.8",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.8.tgz",
"integrity": "sha512-AWMc7vVN7xuTpQf6A7yvaYjxyKEeMBQWJpkcRgT3EFAYU8PXJK2NCL0wPrgHH2soF/bErxJwajA1vNtCqrsRsg==",
"requires": {
"vscode-jsonrpc": "6.0.0-next.5",
"vscode-languageserver-types": "3.16.0-next.3"
"vscode-jsonrpc": "6.0.0-next.6",
"vscode-languageserver-types": "3.16.0-next.4"
}
},
"vscode-languageserver-types": {
"version": "3.16.0-next.3",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.3.tgz",
"integrity": "sha512-s/z5ZqSe7VpoXJ6JQcvwRiPPA3nG0nAcJ/HH03zoU6QaFfnkcgPK+HshC3WKPPnC2G08xA0iRB6h7kmyBB5Adg=="
"version": "3.16.0-next.4",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.4.tgz",
"integrity": "sha512-NlKJyGcET/ZBCCLBYIPaGo2c37R03bPYeWXozUtnjyye7+9dhlbMSODyoG2INcQf8zFmB4qhm2UOJjgYEgPCNA=="
},
"vscode-test": {
"version": "1.4.0",

View file

@ -36,7 +36,7 @@
},
"dependencies": {
"node-fetch": "^2.6.1",
"vscode-languageclient": "7.0.0-next.9"
"vscode-languageclient": "7.0.0-next.10"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^13.0.2",

View file

@ -75,12 +75,11 @@ export async function sendRequestWithRetry<TParam, TRet>(
log.warn("LSP request timed out", { method: reqType.method, param, error });
throw error;
}
if (error.code === lc.ErrorCodes.RequestCancelled) {
if (error.code === lc.LSPErrorCodes.RequestCancelled) {
throw error;
}
if (error.code !== lc.ErrorCodes.ContentModified) {
if (error.code !== lc.LSPErrorCodes.ContentModified) {
log.warn("LSP request failed", { method: reqType.method, param, error });
throw error;
}