mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
25 lines
637 B
Go
25 lines
637 B
Go
package openssh
|
|
|
|
import (
|
|
"config-lsp/common"
|
|
|
|
"github.com/tliron/glsp"
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
// Todo: Implement incremental parsing
|
|
func TextDocumentDidChange(context *glsp.Context, params *protocol.DidChangeTextDocumentParams) error {
|
|
content := params.ContentChanges[0].(protocol.TextDocumentContentChangeEventWhole).Text
|
|
|
|
Parser.Clear()
|
|
diagnostics := DiagnoseParser(context, params.TextDocument.URI, content)
|
|
|
|
if len(diagnostics) > 0 {
|
|
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
|
} else {
|
|
common.ClearDiagnostics(context, params.TextDocument.URI)
|
|
}
|
|
|
|
return nil
|
|
}
|