@@ -3,6 +3,7 @@ package langsrv
3
3
import (
4
4
"github.com/tliron/glsp"
5
5
protocol "github.com/tliron/glsp/protocol_3_16"
6
+ "github.com/vknabel/lithia/parser"
6
7
)
7
8
8
9
func textDocumentDidChange (context * glsp.Context , params * protocol.DidChangeTextDocumentParams ) error {
@@ -17,18 +18,13 @@ func textDocumentDidChange(context *glsp.Context, params *protocol.DidChangeText
17
18
}
18
19
}
19
20
entry .item .Text = text
21
+ syntaxErrs := make ([]parser.SyntaxError , 0 )
20
22
fileParser , errs := entry .parser .Parse ("default-module" , string (params .TextDocument .URI ), text )
21
- if len (errs ) > 0 {
22
- publishSyntaxErrorDiagnostics (context , params .TextDocument .URI , uint32 (params .TextDocument .Version ), errs )
23
- return nil
24
- }
23
+ syntaxErrs = append (syntaxErrs , errs ... )
25
24
sourceFile , errs := fileParser .ParseSourceFile ()
26
- if len (errs ) > 0 {
27
- publishSyntaxErrorDiagnostics (context , params .TextDocument .URI , uint32 (params .TextDocument .Version ), errs )
28
- return nil
29
- }
25
+ syntaxErrs = append (syntaxErrs , errs ... )
30
26
langserver .documentCache .documents [params .TextDocument .URI ].fileParser = fileParser
31
27
langserver .documentCache .documents [params .TextDocument .URI ].sourceFile = sourceFile
32
- publishSyntaxErrorDiagnostics (context , params .TextDocument .URI , uint32 (params .TextDocument .Version ), nil )
28
+ publishSyntaxErrorDiagnostics (context , params .TextDocument .URI , uint32 (params .TextDocument .Version ), syntaxErrs )
33
29
return nil
34
30
}
0 commit comments