Skip to content

Commit

Permalink
fix: log but don't send back file read errors in documentSymbol handle (
Browse files Browse the repository at this point in the history
#678)

Fixes #677

Signed-off-by: Anders Eknert <anders@styra.com>
  • Loading branch information
anderseknert authored Apr 24, 2024
1 parent 03c38aa commit 55a1294
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,12 +746,16 @@ func (l *LanguageServer) handleTextDocumentDocumentSymbol(

contents, ok := l.cache.GetFileContents(params.TextDocument.URI)
if !ok {
return nil, fmt.Errorf("failed to get file contents for uri %q", params.TextDocument.URI)
l.logError(fmt.Errorf("failed to get file contents for uri %q", params.TextDocument.URI))

return []types.DocumentSymbol{}, nil
}

module, ok := l.cache.GetModule(params.TextDocument.URI)
if !ok {
return nil, fmt.Errorf("failed to get module for uri %q", params.TextDocument.URI)
l.logError(fmt.Errorf("failed to get module for uri %q", params.TextDocument.URI))

return []types.DocumentSymbol{}, nil
}

return documentSymbols(contents, module), nil
Expand Down

0 comments on commit 55a1294

Please sign in to comment.