Skip to content

Commit 5c2bd2b

Browse files
authored
Improve importing logic (#950)
1 parent 12eb224 commit 5c2bd2b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/commands/compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async function importFile(file: CurrentFile, ignoreConflict?: boolean): Promise<
9999
checkChangedOnServer(file, true);
100100
})
101101
.catch((error) => {
102-
if (error.statusCode == 409) {
102+
if (error?.statusCode == 409) {
103103
return vscode.window
104104
.showErrorMessage(
105105
`Failed to import '${file.name}': The version of the file on the server is newer.

src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
626626
}
627627
} else if (file.uri.scheme === "file") {
628628
if (isImportableLocalFile(file)) {
629-
// This local file is in the exported file tree, so it's a non-InterSystems file that's
630-
// part of a CSP application, so import it on save
629+
// This local file is part of a CSP application
630+
// or matches our export settings, so import it on save
631631
return importFileOrFolder(file.uri, true);
632632
}
633633
}

src/utils/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export function isImportableLocalFile(file: vscode.TextDocument): boolean {
130130
return true;
131131
}
132132
} else {
133-
return true;
133+
// Non-CSP or DFI files cannot be in subdirectories
134+
return !filePath.includes(path.sep);
134135
}
135136
}
136137
return false;

0 commit comments

Comments
 (0)