Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find all references: show error if code contains syntax errors #163

Merged
merged 3 commits into from
Oct 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
marcellourbani marked this conversation as resolved.
Show resolved Hide resolved
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