Skip to content

Commit c9f569a

Browse files
authored
Fix uncaught errors (intersystems-community#966)
1 parent 80fc321 commit c9f569a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/extension.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -661,19 +661,21 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
661661
vscode.commands
662662
.executeCommand<vscode.DocumentSymbol[]>("vscode.executeDocumentSymbolProvider", document.uri)
663663
.then((symbols) => {
664-
const cursor = event.selections[0].active;
665-
if (symbols.length == 0 || cursor.isBefore(symbols[0].range.start)) {
666-
pos = cursor.line - 1;
667-
} else {
668-
for (const symbol of symbols) {
669-
if (symbol.range.contains(cursor)) {
670-
label = symbol.name;
671-
pos = cursor.line - symbol.range.start.line;
672-
break;
664+
if (symbols != undefined) {
665+
const cursor = event.selections[0].active;
666+
if (symbols.length == 0 || cursor.isBefore(symbols[0].range.start)) {
667+
pos = cursor.line - 1;
668+
} else {
669+
for (const symbol of symbols) {
670+
if (symbol.range.contains(cursor)) {
671+
label = symbol.name;
672+
pos = cursor.line - symbol.range.start.line;
673+
break;
674+
}
673675
}
674676
}
677+
posPanel.text = `${label}${pos > 0 ? "+" + pos : ""}^${routine}`;
675678
}
676-
posPanel.text = `${label}${pos > 0 ? "+" + pos : ""}^${routine}`;
677679
});
678680
});
679681

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function generateFileContent(fileName: string, sourceContent: Buffer): {
4545
} else if (["int", "inc", "mac"].includes(fileExt)) {
4646
sourceLines.shift();
4747
const routineName = fileName.split(".").slice(0, -1).join(".");
48-
const routineType = `[ type = ${fileExt}]`;
48+
const routineType = fileExt != "mac" ? `[Type=${fileExt.toUpperCase()}]` : "";
4949
return {
5050
content: [`ROUTINE ${routineName} ${routineType}`, ...sourceLines],
5151
enc: false,

0 commit comments

Comments
 (0)