mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
24 lines
576 B
Go
24 lines
576 B
Go
package handlers
|
|
|
|
import (
|
|
"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()
|
|
errors := Parser.ParseFromFile(content)
|
|
|
|
if len(errors) > 0 {
|
|
SendDiagnosticsFromParserErrors(context, params.TextDocument.URI, errors)
|
|
} else {
|
|
ClearDiagnostics(context, params.TextDocument.URI)
|
|
}
|
|
|
|
|
|
return nil
|
|
}
|