mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
feat(ssh_config): Use formatted option key for formatting
This commit is contained in:
parent
cdb463c4d7
commit
ed57871b4f
@ -3,6 +3,7 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"config-lsp/common/formatting"
|
"config-lsp/common/formatting"
|
||||||
"config-lsp/handlers/ssh_config/ast"
|
"config-lsp/handlers/ssh_config/ast"
|
||||||
|
"config-lsp/handlers/ssh_config/fields"
|
||||||
hostparser "config-lsp/handlers/ssh_config/host-parser"
|
hostparser "config-lsp/handlers/ssh_config/host-parser"
|
||||||
matchparser "config-lsp/handlers/ssh_config/match-parser"
|
matchparser "config-lsp/handlers/ssh_config/match-parser"
|
||||||
"config-lsp/utils"
|
"config-lsp/utils"
|
||||||
@ -30,7 +31,7 @@ func formatSSHOption(
|
|||||||
var key string
|
var key string
|
||||||
|
|
||||||
if option.Key != nil {
|
if option.Key != nil {
|
||||||
key = string(option.Key.Key)
|
key = fields.FieldsNameFormattedMap[option.Key.Key]
|
||||||
} else {
|
} else {
|
||||||
key = ""
|
key = ""
|
||||||
}
|
}
|
||||||
@ -58,11 +59,12 @@ func formatSSHMatchBlock(
|
|||||||
) []protocol.TextEdit {
|
) []protocol.TextEdit {
|
||||||
edits := make([]protocol.TextEdit, 0)
|
edits := make([]protocol.TextEdit, 0)
|
||||||
|
|
||||||
|
key := fields.FieldsNameFormattedMap[matchBlock.GetEntryOption().Key.Key]
|
||||||
edits = append(edits, protocol.TextEdit{
|
edits = append(edits, protocol.TextEdit{
|
||||||
Range: matchBlock.GetEntryOption().ToLSPRange(),
|
Range: matchBlock.GetEntryOption().ToLSPRange(),
|
||||||
NewText: matchTemplate.Format(
|
NewText: matchTemplate.Format(
|
||||||
options,
|
options,
|
||||||
matchBlock.GetEntryOption().Key.Key,
|
key,
|
||||||
formatMatchToString(matchBlock.MatchValue),
|
formatMatchToString(matchBlock.MatchValue),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
@ -117,11 +119,12 @@ func formatSSHHostBlock(
|
|||||||
) []protocol.TextEdit {
|
) []protocol.TextEdit {
|
||||||
edits := make([]protocol.TextEdit, 0)
|
edits := make([]protocol.TextEdit, 0)
|
||||||
|
|
||||||
|
key := fields.FieldsNameFormattedMap[hostBlock.GetEntryOption().Key.Key]
|
||||||
edits = append(edits, protocol.TextEdit{
|
edits = append(edits, protocol.TextEdit{
|
||||||
Range: hostBlock.GetEntryOption().ToLSPRange(),
|
Range: hostBlock.GetEntryOption().ToLSPRange(),
|
||||||
NewText: matchTemplate.Format(
|
NewText: matchTemplate.Format(
|
||||||
options,
|
options,
|
||||||
hostBlock.GetEntryOption().Key.Key,
|
key,
|
||||||
formatHostToString(hostBlock.HostValue),
|
formatHostToString(hostBlock.HostValue),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user