mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
30 lines
607 B
Go
30 lines
607 B
Go
package analyzer
|
|
|
|
import (
|
|
"config-lsp/common"
|
|
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
func analyzeBlocks(
|
|
ctx *analyzerContext,
|
|
) {
|
|
for _, block := range ctx.document.GetAllBlocks() {
|
|
if block == nil {
|
|
continue
|
|
}
|
|
|
|
// Check if block is empty
|
|
if block.GetOptions().Size() == 0 {
|
|
ctx.diagnostics = append(ctx.diagnostics, protocol.Diagnostic{
|
|
Range: block.GetEntryOption().LocationRange.ToLSPRange(),
|
|
Message: "This block is empty",
|
|
Severity: &common.SeverityHint,
|
|
Tags: []protocol.DiagnosticTag{
|
|
protocol.DiagnosticTagUnnecessary,
|
|
},
|
|
})
|
|
}
|
|
}
|
|
}
|