mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-19 07:25:27 +02:00
42 lines
729 B
Go
42 lines
729 B
Go
package analyzer
|
|
|
|
import (
|
|
"config-lsp/common"
|
|
"config-lsp/handlers/sshd_config"
|
|
"config-lsp/handlers/sshd_config/indexes"
|
|
"config-lsp/utils"
|
|
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
func Analyze(
|
|
d *sshdconfig.SSHDocument,
|
|
) []protocol.Diagnostic {
|
|
errors := analyzeOptionsAreValid(d)
|
|
|
|
if len(errors) > 0 {
|
|
return utils.Map(
|
|
errors,
|
|
func(err common.LSPError) protocol.Diagnostic {
|
|
return err.ToDiagnostic()
|
|
},
|
|
)
|
|
}
|
|
|
|
indexes, indexErrors := indexes.CreateIndexes(*d.Config)
|
|
_ = indexes
|
|
|
|
errors = append(errors, indexErrors...)
|
|
|
|
if len(errors) > 0 {
|
|
return utils.Map(
|
|
errors,
|
|
func(err common.LSPError) protocol.Diagnostic {
|
|
return err.ToDiagnostic()
|
|
},
|
|
)
|
|
}
|
|
|
|
return nil
|
|
}
|