Skip to content

Commit 471e2aa

Browse files
(De)Attach sync destination and cluster on project.json update (#104)
1 parent d93b6f9 commit 471e2aa

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

packages/databricks-vscode/src/configuration/ProjectConfigFileWatcher.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Disposable, workspace} from "vscode";
1+
import {Disposable, Uri, workspace} from "vscode";
22
import {ConnectionManager} from "./ConnectionManager";
33
import {ProjectConfigFile} from "./ProjectConfigFile";
44

@@ -24,6 +24,28 @@ export class ProjectConfigFileWatcher implements Disposable {
2424
if (configFile.profile !== connectionManager.profile) {
2525
connectionManager.login();
2626
}
27+
if (connectionManager.cluster?.id !== configFile.clusterId) {
28+
if (configFile.clusterId) {
29+
connectionManager.attachCluster(configFile.clusterId);
30+
} else {
31+
connectionManager.detachCluster();
32+
}
33+
}
34+
if (
35+
connectionManager.syncDestination?.path.path !==
36+
configFile.workspacePath
37+
) {
38+
if (configFile.workspacePath) {
39+
connectionManager.attachSyncDestination(
40+
Uri.from({
41+
scheme: "dbws",
42+
path: configFile.workspacePath,
43+
})
44+
);
45+
} else {
46+
connectionManager.detachSyncDestination();
47+
}
48+
}
2749
}, this),
2850
fileSystemWatcher.onDidDelete((e) => {
2951
connectionManager.logout();

0 commit comments

Comments
 (0)