From ed57871b4fea9778f9433db00604e47655cda7d2 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Tue, 1 Oct 2024 14:52:07 +0200 Subject: [PATCH] feat(ssh_config): Use formatted option key for formatting --- handlers/ssh_config/handlers/formatting_nodes.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/handlers/ssh_config/handlers/formatting_nodes.go b/handlers/ssh_config/handlers/formatting_nodes.go index 84c3d36..2f236e2 100644 --- a/handlers/ssh_config/handlers/formatting_nodes.go +++ b/handlers/ssh_config/handlers/formatting_nodes.go @@ -3,6 +3,7 @@ package handlers import ( "config-lsp/common/formatting" "config-lsp/handlers/ssh_config/ast" + "config-lsp/handlers/ssh_config/fields" hostparser "config-lsp/handlers/ssh_config/host-parser" matchparser "config-lsp/handlers/ssh_config/match-parser" "config-lsp/utils" @@ -30,7 +31,7 @@ func formatSSHOption( var key string if option.Key != nil { - key = string(option.Key.Key) + key = fields.FieldsNameFormattedMap[option.Key.Key] } else { key = "" } @@ -58,11 +59,12 @@ func formatSSHMatchBlock( ) []protocol.TextEdit { edits := make([]protocol.TextEdit, 0) + key := fields.FieldsNameFormattedMap[matchBlock.GetEntryOption().Key.Key] edits = append(edits, protocol.TextEdit{ Range: matchBlock.GetEntryOption().ToLSPRange(), NewText: matchTemplate.Format( options, - matchBlock.GetEntryOption().Key.Key, + key, formatMatchToString(matchBlock.MatchValue), ), }) @@ -117,11 +119,12 @@ func formatSSHHostBlock( ) []protocol.TextEdit { edits := make([]protocol.TextEdit, 0) + key := fields.FieldsNameFormattedMap[hostBlock.GetEntryOption().Key.Key] edits = append(edits, protocol.TextEdit{ Range: hostBlock.GetEntryOption().ToLSPRange(), NewText: matchTemplate.Format( options, - hostBlock.GetEntryOption().Key.Key, + key, formatHostToString(hostBlock.HostValue), ), })