mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +02:00
feat(ssh_config): Check doc values in options.go
This commit is contained in:
parent
558b9b7c98
commit
0257a24668
@ -2,6 +2,7 @@ package analyzer
|
||||
|
||||
import (
|
||||
"config-lsp/common"
|
||||
docvalues "config-lsp/doc-values"
|
||||
"config-lsp/handlers/ssh_config/ast"
|
||||
"config-lsp/handlers/ssh_config/fields"
|
||||
"config-lsp/utils"
|
||||
@ -40,7 +41,7 @@ func checkOption(
|
||||
checkIsUsingDoubleQuotes(ctx, option.Key.Value, option.Key.LocationRange)
|
||||
checkQuotesAreClosed(ctx, option.Key.Value, option.Key.LocationRange)
|
||||
|
||||
_, found := fields.Options[option.Key.Key]
|
||||
docOption, found := fields.Options[option.Key.Key]
|
||||
|
||||
if !found {
|
||||
// Diagnostics will be handled by `values.go`
|
||||
@ -61,6 +62,19 @@ func checkOption(
|
||||
if option.OptionValue != nil {
|
||||
checkIsUsingDoubleQuotes(ctx, option.OptionValue.Value, option.OptionValue.LocationRange)
|
||||
checkQuotesAreClosed(ctx, option.OptionValue.Value, option.OptionValue.LocationRange)
|
||||
|
||||
invalidValues := docOption.DeprecatedCheckIsValid(option.OptionValue.Value.Value)
|
||||
|
||||
for _, invalidValue := range invalidValues {
|
||||
err := docvalues.LSPErrorFromInvalidValue(option.Start.Line, *invalidValue)
|
||||
err.ShiftCharacter(option.OptionValue.Start.Character)
|
||||
|
||||
ctx.diagnostics = append(ctx.diagnostics, protocol.Diagnostic{
|
||||
Range: err.Range.ToLSPRange(),
|
||||
Message: err.Err.Error(),
|
||||
Severity: &common.SeverityError,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if option.Separator == nil || option.Separator.Value.Value == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user