2024-09-12 23:25:56 +02:00

32 lines
580 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)
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
}