Skip to content

Commit

Permalink
lsp: No code lenses if there are parse errors
Browse files Browse the repository at this point in the history
Fixes StyraInc#1123

Signed-off-by: Charlie Egan <[email protected]>
  • Loading branch information
charlieegan3 committed Jan 20, 2025
1 parent ace0a5c commit 50014ee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,11 @@ func (l *LanguageServer) handleTextDocumentInlayHint(params types.TextDocumentIn
}

func (l *LanguageServer) handleTextDocumentCodeLens(ctx context.Context, params types.CodeLensParams) (any, error) {
parseErrors, ok := l.cache.GetParseErrors(params.TextDocument.URI)
if ok && len(parseErrors) > 0 {
return []types.CodeLens{}, nil
}

contents, module, ok := l.cache.GetContentAndModule(params.TextDocument.URI)
if !ok {
return nil, nil // return a null response, as per the spec
Expand Down

0 comments on commit 50014ee

Please sign in to comment.