Skip to content

Commit

Permalink
find all references: show error if code contains syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellourbani committed Sep 29, 2024
1 parent d7c9c69 commit 3747969
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,19 @@ export class Handler {
return new abaplint.LanguageServer(this.reg).gotoDefinition(params);
}

public onReferences(params: LServer.TextDocumentPositionParams): LServer.Location[] {
return new abaplint.LanguageServer(this.reg).references(params);
public onReferences(params: LServer.TextDocumentPositionParams): LServer.Location[] | undefined {
const server = new abaplint.LanguageServer(this.reg);
const references = server.references(params);
if (!references.length) {
const doc = this.reg.getFileByName(params.textDocument.uri);
const obj = doc && this.reg.findObjectForFile(doc);
const diagnostic = obj && this.reg.findIssuesObject(obj)
.find(d => d.getFilename() === params.textDocument.uri && d.getSeverity() === abaplint.Severity.Error);
if (diagnostic) {
this.connection.window.showErrorMessage("Reference search failed due to syntax errors");
}
}
return references;
}

public async onDocumentFormatting(params: LServer.DocumentFormattingParams,
Expand Down

0 comments on commit 3747969

Please sign in to comment.