Skip to content

Commit d44301f

Browse files
committed
Merge branch 'topic/minor-fix' into 'master'
Do not assume defined result on VS Code command See merge request eng/ide/ada_language_server!2041
2 parents c9dcb67 + 61eadcb commit d44301f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

integration/vscode/ada/src/AdaCodeLensProvider.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AdaCodeLensProvider implements CodeLensProvider {
2727
document: TextDocument,
2828
token?: CancellationToken,
2929
): ProviderResult<CodeLens[]> {
30-
const symbols = commands.executeCommand<DocumentSymbol[]>(
30+
const symbols = commands.executeCommand<DocumentSymbol[] | undefined>(
3131
'vscode.executeDocumentSymbolProvider',
3232
document.uri,
3333
);
@@ -47,6 +47,10 @@ export class AdaCodeLensProvider implements CodeLensProvider {
4747
) {
4848
// It's a main file, so let's offer Run and Debug actions on the main subprogram
4949
return symbols.then((symbols) => {
50+
if (!symbols) {
51+
return [];
52+
}
53+
5054
const functions = symbols.filter((s) => s.kind == SymbolKind.Function);
5155
if (functions.length > 0) {
5256
/**
@@ -103,6 +107,10 @@ export class AdaCodeLensProvider implements CodeLensProvider {
103107
* This is tentative deactivated code in preparation of SPARK support.
104108
*/
105109
res2 = symbols.then<CodeLens[]>((symbols) => {
110+
if (!symbols) {
111+
return [];
112+
}
113+
106114
const symbolKinds = [SymbolKind.Function];
107115
const recurseInto = [SymbolKind.Module, SymbolKind.Package, SymbolKind.Function];
108116

0 commit comments

Comments
 (0)