mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +02:00
37 lines
572 B
Go
37 lines
572 B
Go
package analyzer
|
|
|
|
import (
|
|
"config-lsp/handlers/fstab/shared"
|
|
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
type analyzerContext struct {
|
|
document *shared.FstabDocument
|
|
diagnostics []protocol.Diagnostic
|
|
}
|
|
|
|
func Analyze(
|
|
document *shared.FstabDocument,
|
|
) []protocol.Diagnostic {
|
|
ctx := &analyzerContext{
|
|
document: document,
|
|
}
|
|
|
|
analyzeFieldAreFilled(ctx)
|
|
|
|
if len(ctx.diagnostics) > 0 {
|
|
return ctx.diagnostics
|
|
}
|
|
|
|
analyzeValuesAreValid(ctx)
|
|
|
|
if len(ctx.diagnostics) > 0 {
|
|
return ctx.diagnostics
|
|
}
|
|
|
|
analyzeFSCKField(ctx)
|
|
|
|
return ctx.diagnostics
|
|
}
|