Skip to content

Commit

Permalink
fix: diagnostic errors were being discarded (#1929)
Browse files Browse the repository at this point in the history
Fixes #1849 

Error detection was far too aggressive, discarding legit schema.Errors.
  • Loading branch information
gak authored Jul 2, 2024
1 parent 06c88c5 commit 423ae6a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lsp/lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,20 @@ func (s *Server) post(err error) {

// Deduplicate and associate by filename.
for _, e := range ftlErrors.DeduplicateErrors(ftlErrors.UnwrapAll(err)) {
// CompilerBuildErrors are not innermost errors, so we need to check for them first.
var cbe buildengine.CompilerBuildError
if errors.As(e, &cbe) {
// CompilerBuildErrors should have emitted errors beforehand so don't alert the user again.
return
}

if !ftlErrors.Innermost(e) {
continue
}

var ce *schema.Error
var cbe buildengine.CompilerBuildError
if errors.As(e, &ce) {
filename := ce.Pos.Filename
if _, exists := errByFilename[filename]; !exists {
errByFilename[filename] = errSet{}
}
errByFilename[filename] = append(errByFilename[filename], ce)
} else if errors.As(e, &cbe) {
continue
} else {
errUnspecified = append(errUnspecified, err)
}
Expand Down

0 comments on commit 423ae6a

Please sign in to comment.