on master help sign in
Simplify Display implementation for LanguageServerFeature
commitec2f9091a06d07a8c4faa7533b814bdf59e36c35 authorPhilipp Mildenberger <philipp@mildenberger.me> dateSat 18 Mar 2023, 20:32 (4 years ago) parent76b5cab
1 file changed+21−19
helix-core/src/syntax.rs+21−19
helix-core/src/syntax.rs+21−19
@@ -242,25 +242,27 @@ pub enum LanguageServerFeature {
242242
243243impl Display for LanguageServerFeature {
244244 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
245− write!(f, "{}", match self {
246− LanguageServerFeature::Format => "format",
247− LanguageServerFeature::GotoDeclaration => "goto-declaration",
248− LanguageServerFeature::GotoDefinition => "goto-definition",
249− LanguageServerFeature::GotoTypeDefinition => "goto-type-definition",
250− LanguageServerFeature::GotoReference => "goto-type-definition",
251− LanguageServerFeature::GotoImplementation => "goto-implementation",
252− LanguageServerFeature::SignatureHelp => "signature-help",
253− LanguageServerFeature::Hover => "hover",
254− LanguageServerFeature::DocumentHighlight => "document-highlight",
255− LanguageServerFeature::Completion => "completion",
256− LanguageServerFeature::CodeAction => "code-action",
257− LanguageServerFeature::WorkspaceCommand => "workspace-command",
258− LanguageServerFeature::DocumentSymbols => "document-symbols",
259− LanguageServerFeature::WorkspaceSymbols => "workspace-symbols",
260− LanguageServerFeature::Diagnostics => "diagnostics",
261− LanguageServerFeature::RenameSymbol => "rename-symbol",
262− LanguageServerFeature::InlayHints => "inlay-hints",
263− })
245+ use LanguageServerFeature::*;
246+ let feature = match self {
247+ Format => "format",
248+ GotoDeclaration => "goto-declaration",
249+ GotoDefinition => "goto-definition",
250+ GotoTypeDefinition => "goto-type-definition",
251+ GotoReference => "goto-type-definition",
252+ GotoImplementation => "goto-implementation",
253+ SignatureHelp => "signature-help",
254+ Hover => "hover",
255+ DocumentHighlight => "document-highlight",
256+ Completion => "completion",
257+ CodeAction => "code-action",
258+ WorkspaceCommand => "workspace-command",
259+ DocumentSymbols => "document-symbols",
260+ WorkspaceSymbols => "workspace-symbols",
261+ Diagnostics => "diagnostics",
262+ RenameSymbol => "rename-symbol",
263+ InlayHints => "inlay-hints",
264+ };
265+ write!(f, "{feature}",)
264266 }
265267}
266268