fix(sshd_config): Rename match_parser -> matchparser

This commit is contained in:
Myzel394 2024-09-17 23:34:39 +02:00
parent 35c722995d
commit 9ed983bf81
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
9 changed files with 29 additions and 29 deletions

View File

@ -3,7 +3,7 @@ package analyzer
import (
"config-lsp/common"
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"
"errors"
"fmt"
@ -54,7 +54,7 @@ func analyzeMatchBlocks(
}
func analyzeMatchValueNegation(
value *match_parser.MatchValue,
value *matchparser.MatchValue,
) []common.LSPError {
errs := make([]common.LSPError, 0)
@ -83,7 +83,7 @@ func analyzeMatchValueNegation(
}
func analyzeMatchValuesContainsPositiveValue(
values *match_parser.MatchValues,
values *matchparser.MatchValues,
) []common.LSPError {
if len(values.Values) == 0 {
return nil

View File

@ -4,7 +4,7 @@ import (
"config-lsp/common"
commonparser "config-lsp/common/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"
"github.com/emirpasic/gods/maps/treemap"
@ -109,10 +109,10 @@ func (s *sshParserListener) ExitEntry(ctx *parser.EntryContext) {
if s.sshContext.isKeyAMatchBlock {
// Add new match block
var match *match_parser.Match
var match *matchparser.Match
if s.sshContext.currentOption.OptionValue != nil {
matchParser := match_parser.NewMatch()
matchParser := matchparser.NewMatch()
errors := matchParser.Parse(
s.sshContext.currentOption.OptionValue.Value.Raw,
location.Start.Line,

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import (
"config-lsp/common"

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import (
"config-lsp/common"

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import (
"config-lsp/common"

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import "slices"

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import (
"config-lsp/common"

View File

@ -1,4 +1,4 @@
package match_parser
package matchparser
import (
"testing"

View File

@ -3,14 +3,14 @@ package handlers
import (
sshdconfig "config-lsp/handlers/sshd_config"
"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"
)
func getMatchCompletions(
d *sshdconfig.SSHDocument,
match *match_parser.Match,
match *matchparser.Match,
cursor uint32,
) ([]protocol.CompletionItem, error) {
if match == nil || len(match.Entries) == 0 {
@ -34,31 +34,31 @@ func getMatchCriteriaCompletions() []protocol.CompletionItem {
return []protocol.CompletionItem{
{
Label: string(match_parser.MatchCriteriaTypeUser),
Label: string(matchparser.MatchCriteriaTypeUser),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeGroup),
Label: string(matchparser.MatchCriteriaTypeGroup),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeHost),
Label: string(matchparser.MatchCriteriaTypeHost),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeAddress),
Label: string(matchparser.MatchCriteriaTypeAddress),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeLocalAddress),
Label: string(matchparser.MatchCriteriaTypeLocalAddress),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeLocalPort),
Label: string(matchparser.MatchCriteriaTypeLocalPort),
Kind: &kind,
},
{
Label: string(match_parser.MatchCriteriaTypeRDomain),
Label: string(matchparser.MatchCriteriaTypeRDomain),
Kind: &kind,
},
}
@ -74,7 +74,7 @@ func getMatchAllKeywordCompletion() protocol.CompletionItem {
}
func getMatchValueCompletions(
entry *match_parser.MatchEntry,
entry *matchparser.MatchEntry,
cursor uint32,
) []protocol.CompletionItem {
value := entry.GetValueByCursor(entry.End.Character)
@ -91,19 +91,19 @@ func getMatchValueCompletions(
}
switch entry.Criteria.Type {
case match_parser.MatchCriteriaTypeUser:
case matchparser.MatchCriteriaTypeUser:
return fields.MatchUserField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeGroup:
case matchparser.MatchCriteriaTypeGroup:
return fields.MatchGroupField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeHost:
case matchparser.MatchCriteriaTypeHost:
return fields.MatchHostField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeAddress:
case matchparser.MatchCriteriaTypeAddress:
return fields.MatchAddressField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeLocalAddress:
case matchparser.MatchCriteriaTypeLocalAddress:
return fields.MatchLocalAddressField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeLocalPort:
case matchparser.MatchCriteriaTypeLocalPort:
return fields.MatchLocalPortField.FetchCompletions(line, relativeCursor)
case match_parser.MatchCriteriaTypeRDomain:
case matchparser.MatchCriteriaTypeRDomain:
return fields.MatchRDomainField.FetchCompletions(line, relativeCursor)
}