Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r--helix-lsp/src/client.rs78
1 files changed, 17 insertions, 61 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 22a8dd89..c901ad33 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -176,29 +176,6 @@ impl Client {
self.did_change_workspace(vec![workspace_for_uri(root_uri)], Vec::new())
}
- /// Merge FormattingOptions with 'config.format' and return it
- fn get_merged_formatting_options(
- &self,
- options: lsp::FormattingOptions,
- ) -> lsp::FormattingOptions {
- let config_format = self
- .config
- .as_ref()
- .and_then(|cfg| cfg.get("format"))
- .and_then(|fmt| HashMap::<String, lsp::FormattingProperty>::deserialize(fmt).ok());
-
- if let Some(mut properties) = config_format {
- // passed in options take precedence over 'config.format'
- properties.extend(options.properties);
- lsp::FormattingOptions {
- properties,
- ..options
- }
- } else {
- options
- }
- }
-
#[allow(clippy::type_complexity, clippy::too_many_arguments)]
pub fn start(
cmd: &str,
@@ -372,7 +349,6 @@ impl Client {
Some(OneOf::Left(true) | OneOf::Right(_))
),
LanguageServerFeature::Diagnostics => true, // there's no extra server capability
- LanguageServerFeature::PullDiagnostics => capabilities.diagnostic_provider.is_some(),
LanguageServerFeature::RenameSymbol => matches!(
capabilities.rename_provider,
Some(OneOf::Left(true)) | Some(OneOf::Right(_))
@@ -603,9 +579,6 @@ impl Client {
did_rename: Some(true),
..Default::default()
}),
- diagnostic: Some(lsp::DiagnosticWorkspaceClientCapabilities {
- refresh_support: Some(true),
- }),
..Default::default()
}),
text_document: Some(lsp::TextDocumentClientCapabilities {
@@ -683,10 +656,6 @@ impl Client {
}),
..Default::default()
}),
- diagnostic: Some(lsp::DiagnosticClientCapabilities {
- dynamic_registration: Some(false),
- related_document_support: Some(true),
- }),
publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
version_support: Some(true),
tag_support: Some(lsp::TagSupport {
@@ -1199,7 +1168,23 @@ impl Client {
_ => return None,
};
- let options = self.get_merged_formatting_options(options);
+ // merge FormattingOptions with 'config.format'
+ let config_format = self
+ .config
+ .as_ref()
+ .and_then(|cfg| cfg.get("format"))
+ .and_then(|fmt| HashMap::<String, lsp::FormattingProperty>::deserialize(fmt).ok());
+
+ let options = if let Some(mut properties) = config_format {
+ // passed in options take precedence over 'config.format'
+ properties.extend(options.properties);
+ lsp::FormattingOptions {
+ properties,
+ ..options
+ }
+ } else {
+ options
+ };
let params = lsp::DocumentFormattingParams {
text_document,
@@ -1225,8 +1210,6 @@ impl Client {
_ => return None,
};
- let options = self.get_merged_formatting_options(options);
-
let params = lsp::DocumentRangeFormattingParams {
text_document,
range,
@@ -1237,32 +1220,6 @@ impl Client {
Some(self.call::<lsp::request::RangeFormatting>(params))
}
- pub fn text_document_diagnostic(
- &self,
- text_document: lsp::TextDocumentIdentifier,
- previous_result_id: Option<String>,
- ) -> Option<impl Future<Output = Result<lsp::DocumentDiagnosticReportResult>>> {
- let capabilities = self.capabilities();
-
- // Return early if the server does not support pull diagnostic.
- let identifier = match capabilities.diagnostic_provider.as_ref()? {
- lsp::DiagnosticServerCapabilities::Options(cap) => cap.identifier.clone(),
- lsp::DiagnosticServerCapabilities::RegistrationOptions(cap) => {
- cap.diagnostic_options.identifier.clone()
- }
- };
-
- let params = lsp::DocumentDiagnosticParams {
- text_document,
- identifier,
- previous_result_id,
- work_done_progress_params: lsp::WorkDoneProgressParams::default(),
- partial_result_params: lsp::PartialResultParams::default(),
- };
-
- Some(self.call::<lsp::request::DocumentDiagnosticRequest>(params))
- }
-
pub fn text_document_document_highlight(
&self,
text_document: lsp::TextDocumentIdentifier,
@@ -1503,7 +1460,6 @@ impl Client {
query,
work_done_progress_params: lsp::WorkDoneProgressParams::default(),
partial_result_params: lsp::PartialResultParams::default(),
- ..Default::default()
};
Some(self.call::<lsp::request::WorkspaceSymbolRequest>(params))