Simplify Display implementation for LanguageServerFeature

pull/2507/head
Philipp Mildenberger 2 years ago
parent 76b5cab524
commit ec2f9091a0

@ -242,25 +242,27 @@ pub enum LanguageServerFeature {
impl Display for LanguageServerFeature { impl Display for LanguageServerFeature {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", match self { use LanguageServerFeature::*;
LanguageServerFeature::Format => "format", let feature = match self {
LanguageServerFeature::GotoDeclaration => "goto-declaration", Format => "format",
LanguageServerFeature::GotoDefinition => "goto-definition", GotoDeclaration => "goto-declaration",
LanguageServerFeature::GotoTypeDefinition => "goto-type-definition", GotoDefinition => "goto-definition",
LanguageServerFeature::GotoReference => "goto-type-definition", GotoTypeDefinition => "goto-type-definition",
LanguageServerFeature::GotoImplementation => "goto-implementation", GotoReference => "goto-type-definition",
LanguageServerFeature::SignatureHelp => "signature-help", GotoImplementation => "goto-implementation",
LanguageServerFeature::Hover => "hover", SignatureHelp => "signature-help",
LanguageServerFeature::DocumentHighlight => "document-highlight", Hover => "hover",
LanguageServerFeature::Completion => "completion", DocumentHighlight => "document-highlight",
LanguageServerFeature::CodeAction => "code-action", Completion => "completion",
LanguageServerFeature::WorkspaceCommand => "workspace-command", CodeAction => "code-action",
LanguageServerFeature::DocumentSymbols => "document-symbols", WorkspaceCommand => "workspace-command",
LanguageServerFeature::WorkspaceSymbols => "workspace-symbols", DocumentSymbols => "document-symbols",
LanguageServerFeature::Diagnostics => "diagnostics", WorkspaceSymbols => "workspace-symbols",
LanguageServerFeature::RenameSymbol => "rename-symbol", Diagnostics => "diagnostics",
LanguageServerFeature::InlayHints => "inlay-hints", RenameSymbol => "rename-symbol",
}) InlayHints => "inlay-hints",
};
write!(f, "{feature}",)
} }
} }

Loading…
Cancel
Save