mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-19 07:25:27 +02:00
fix(sshd_config): Rename match_parser -> matchparser
This commit is contained in:
parent
35c722995d
commit
9ed983bf81
@ -3,7 +3,7 @@ package analyzer
|
|||||||
import (
|
import (
|
||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
sshdconfig "config-lsp/handlers/sshd_config"
|
sshdconfig "config-lsp/handlers/sshd_config"
|
||||||
match_parser "config-lsp/handlers/sshd_config/fields/match-parser"
|
matchparser "config-lsp/handlers/sshd_config/fields/match-parser"
|
||||||
"config-lsp/utils"
|
"config-lsp/utils"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -54,7 +54,7 @@ func analyzeMatchBlocks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func analyzeMatchValueNegation(
|
func analyzeMatchValueNegation(
|
||||||
value *match_parser.MatchValue,
|
value *matchparser.MatchValue,
|
||||||
) []common.LSPError {
|
) []common.LSPError {
|
||||||
errs := make([]common.LSPError, 0)
|
errs := make([]common.LSPError, 0)
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ func analyzeMatchValueNegation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func analyzeMatchValuesContainsPositiveValue(
|
func analyzeMatchValuesContainsPositiveValue(
|
||||||
values *match_parser.MatchValues,
|
values *matchparser.MatchValues,
|
||||||
) []common.LSPError {
|
) []common.LSPError {
|
||||||
if len(values.Values) == 0 {
|
if len(values.Values) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
commonparser "config-lsp/common/parser"
|
commonparser "config-lsp/common/parser"
|
||||||
"config-lsp/handlers/sshd_config/ast/parser"
|
"config-lsp/handlers/sshd_config/ast/parser"
|
||||||
match_parser "config-lsp/handlers/sshd_config/fields/match-parser"
|
matchparser "config-lsp/handlers/sshd_config/fields/match-parser"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/emirpasic/gods/maps/treemap"
|
"github.com/emirpasic/gods/maps/treemap"
|
||||||
@ -109,10 +109,10 @@ func (s *sshParserListener) ExitEntry(ctx *parser.EntryContext) {
|
|||||||
|
|
||||||
if s.sshContext.isKeyAMatchBlock {
|
if s.sshContext.isKeyAMatchBlock {
|
||||||
// Add new match block
|
// Add new match block
|
||||||
var match *match_parser.Match
|
var match *matchparser.Match
|
||||||
|
|
||||||
if s.sshContext.currentOption.OptionValue != nil {
|
if s.sshContext.currentOption.OptionValue != nil {
|
||||||
matchParser := match_parser.NewMatch()
|
matchParser := matchparser.NewMatch()
|
||||||
errors := matchParser.Parse(
|
errors := matchParser.Parse(
|
||||||
s.sshContext.currentOption.OptionValue.Value.Raw,
|
s.sshContext.currentOption.OptionValue.Value.Raw,
|
||||||
location.Start.Line,
|
location.Start.Line,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import "slices"
|
import "slices"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"config-lsp/common"
|
"config-lsp/common"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package match_parser
|
package matchparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -3,14 +3,14 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
sshdconfig "config-lsp/handlers/sshd_config"
|
sshdconfig "config-lsp/handlers/sshd_config"
|
||||||
"config-lsp/handlers/sshd_config/fields"
|
"config-lsp/handlers/sshd_config/fields"
|
||||||
match_parser "config-lsp/handlers/sshd_config/fields/match-parser"
|
matchparser "config-lsp/handlers/sshd_config/fields/match-parser"
|
||||||
|
|
||||||
protocol "github.com/tliron/glsp/protocol_3_16"
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getMatchCompletions(
|
func getMatchCompletions(
|
||||||
d *sshdconfig.SSHDocument,
|
d *sshdconfig.SSHDocument,
|
||||||
match *match_parser.Match,
|
match *matchparser.Match,
|
||||||
cursor uint32,
|
cursor uint32,
|
||||||
) ([]protocol.CompletionItem, error) {
|
) ([]protocol.CompletionItem, error) {
|
||||||
if match == nil || len(match.Entries) == 0 {
|
if match == nil || len(match.Entries) == 0 {
|
||||||
@ -34,31 +34,31 @@ func getMatchCriteriaCompletions() []protocol.CompletionItem {
|
|||||||
|
|
||||||
return []protocol.CompletionItem{
|
return []protocol.CompletionItem{
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeUser),
|
Label: string(matchparser.MatchCriteriaTypeUser),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeGroup),
|
Label: string(matchparser.MatchCriteriaTypeGroup),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeHost),
|
Label: string(matchparser.MatchCriteriaTypeHost),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeAddress),
|
Label: string(matchparser.MatchCriteriaTypeAddress),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeLocalAddress),
|
Label: string(matchparser.MatchCriteriaTypeLocalAddress),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeLocalPort),
|
Label: string(matchparser.MatchCriteriaTypeLocalPort),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: string(match_parser.MatchCriteriaTypeRDomain),
|
Label: string(matchparser.MatchCriteriaTypeRDomain),
|
||||||
Kind: &kind,
|
Kind: &kind,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ func getMatchAllKeywordCompletion() protocol.CompletionItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getMatchValueCompletions(
|
func getMatchValueCompletions(
|
||||||
entry *match_parser.MatchEntry,
|
entry *matchparser.MatchEntry,
|
||||||
cursor uint32,
|
cursor uint32,
|
||||||
) []protocol.CompletionItem {
|
) []protocol.CompletionItem {
|
||||||
value := entry.GetValueByCursor(entry.End.Character)
|
value := entry.GetValueByCursor(entry.End.Character)
|
||||||
@ -91,19 +91,19 @@ func getMatchValueCompletions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch entry.Criteria.Type {
|
switch entry.Criteria.Type {
|
||||||
case match_parser.MatchCriteriaTypeUser:
|
case matchparser.MatchCriteriaTypeUser:
|
||||||
return fields.MatchUserField.FetchCompletions(line, relativeCursor)
|
return fields.MatchUserField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeGroup:
|
case matchparser.MatchCriteriaTypeGroup:
|
||||||
return fields.MatchGroupField.FetchCompletions(line, relativeCursor)
|
return fields.MatchGroupField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeHost:
|
case matchparser.MatchCriteriaTypeHost:
|
||||||
return fields.MatchHostField.FetchCompletions(line, relativeCursor)
|
return fields.MatchHostField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeAddress:
|
case matchparser.MatchCriteriaTypeAddress:
|
||||||
return fields.MatchAddressField.FetchCompletions(line, relativeCursor)
|
return fields.MatchAddressField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeLocalAddress:
|
case matchparser.MatchCriteriaTypeLocalAddress:
|
||||||
return fields.MatchLocalAddressField.FetchCompletions(line, relativeCursor)
|
return fields.MatchLocalAddressField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeLocalPort:
|
case matchparser.MatchCriteriaTypeLocalPort:
|
||||||
return fields.MatchLocalPortField.FetchCompletions(line, relativeCursor)
|
return fields.MatchLocalPortField.FetchCompletions(line, relativeCursor)
|
||||||
case match_parser.MatchCriteriaTypeRDomain:
|
case matchparser.MatchCriteriaTypeRDomain:
|
||||||
return fields.MatchRDomainField.FetchCompletions(line, relativeCursor)
|
return fields.MatchRDomainField.FetchCompletions(line, relativeCursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user