Skip to content

Commit

Permalink
lsp: show parse errors in diagnostics (#1408)
Browse files Browse the repository at this point in the history
Unsure when this was lost, but this is an important behavior to have
back!

Signed-off-by: Charlie Egan <[email protected]>
  • Loading branch information
charlieegan3 authored Feb 11, 2025
1 parent 06af4df commit b29e759
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2516,9 +2516,12 @@ func (l *LanguageServer) handleWorkspaceDidChangeWatchedFiles(
}

func (l *LanguageServer) sendFileDiagnostics(ctx context.Context, fileURI string) error {
fileDiags, ok := l.cache.GetFileDiagnostics(fileURI)
if !ok {
fileDiags = []types.Diagnostic{}
// first, set the diagnostics for the file to the current parse errors
fileDiags, _ := l.cache.GetParseErrors(fileURI)

// if there are no parse errors, then we can check for lint errors
if len(fileDiags) == 0 {
fileDiags, _ = l.cache.GetFileDiagnostics(fileURI)
}

resp := types.FileDiagnostics{
Expand Down

0 comments on commit b29e759

Please sign in to comment.