aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Mildenberger2023-03-18 19:32:34 +0000
committerPhilipp Mildenberger2023-05-18 19:48:32 +0000
commitec2f9091a06d07a8c4faa7533b814bdf59e36c35 (patch)
treeae20390893b1d479e0fe872a8bb84bfa4ae23d8c
parent76b5cab52479daf25ffa0af798c1ebcf6a4f0004 (diff)
Simplify Display implementation for LanguageServerFeature
-rw-r--r--helix-core/src/syntax.rs40
1 files changed, 21 insertions, 19 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index a4e6d990..ce26a1bc 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -242,25 +242,27 @@ pub enum LanguageServerFeature {
impl Display for LanguageServerFeature {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "{}", match self {
- LanguageServerFeature::Format => "format",
- LanguageServerFeature::GotoDeclaration => "goto-declaration",
- LanguageServerFeature::GotoDefinition => "goto-definition",
- LanguageServerFeature::GotoTypeDefinition => "goto-type-definition",
- LanguageServerFeature::GotoReference => "goto-type-definition",
- LanguageServerFeature::GotoImplementation => "goto-implementation",
- LanguageServerFeature::SignatureHelp => "signature-help",
- LanguageServerFeature::Hover => "hover",
- LanguageServerFeature::DocumentHighlight => "document-highlight",
- LanguageServerFeature::Completion => "completion",
- LanguageServerFeature::CodeAction => "code-action",
- LanguageServerFeature::WorkspaceCommand => "workspace-command",
- LanguageServerFeature::DocumentSymbols => "document-symbols",
- LanguageServerFeature::WorkspaceSymbols => "workspace-symbols",
- LanguageServerFeature::Diagnostics => "diagnostics",
- LanguageServerFeature::RenameSymbol => "rename-symbol",
- LanguageServerFeature::InlayHints => "inlay-hints",
- })
+ use LanguageServerFeature::*;
+ let feature = match self {
+ Format => "format",
+ GotoDeclaration => "goto-declaration",
+ GotoDefinition => "goto-definition",
+ GotoTypeDefinition => "goto-type-definition",
+ GotoReference => "goto-type-definition",
+ GotoImplementation => "goto-implementation",
+ SignatureHelp => "signature-help",
+ Hover => "hover",
+ DocumentHighlight => "document-highlight",
+ Completion => "completion",
+ CodeAction => "code-action",
+ WorkspaceCommand => "workspace-command",
+ DocumentSymbols => "document-symbols",
+ WorkspaceSymbols => "workspace-symbols",
+ Diagnostics => "diagnostics",
+ RenameSymbol => "rename-symbol",
+ InlayHints => "inlay-hints",
+ };
+ write!(f, "{feature}",)
}
}