Skip to content

Commit 4be0cd7

Browse files
Minor bug fixes (#412)
- Fix prompt for to show --allow-no-subscription when asking to change tenant. - Fix Repos bug where first time users of a workspace can't read /Repos/me. Users need to go to the UI and create a repo for the /Repos/me to be visible. After first creation, it is always visible. The fix is to make users go to the workspace home when they click "Create Repo". - Fix a bug where to kill a full-sync task, the user had to kill the terminal manually. - Change autocompletion for globals prompt to allow for cases where builtins is already installed.
1 parent e7943d0 commit 4be0cd7

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

packages/databricks-vscode/src/cli/BricksTasks.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import {withLogContext} from "@databricks/databricks-sdk/dist/logging";
1818
import {Loggers} from "../logger";
1919
import {Context, context} from "@databricks/databricks-sdk/dist/context";
2020

21-
enum TaskSyncType {
22-
syncFull = "sync-full",
23-
sync = "sync",
24-
}
21+
export const TaskSyncType = {
22+
syncFull: "sync-full",
23+
sync: "sync",
24+
} as const;
25+
type TaskSyncType = (typeof TaskSyncType)[keyof typeof TaskSyncType];
26+
2527
const cliToTaskSyncType = new Map<SyncType, TaskSyncType>([
2628
["full", TaskSyncType.syncFull],
2729
["incremental", TaskSyncType.sync],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export class AzureCliCheck implements Disposable {
238238
public async loginAzureCli(tenant = ""): Promise<boolean> {
239239
let message = 'You need to run "az login" to login with Azure.';
240240
if (tenant) {
241-
message = `You need to tun "az login -t ${tenant}" to login with Azure.`;
241+
message = `You need to tun "az login --allow-no-subscriptions -t ${tenant}" to login with Azure.`;
242242
}
243243
const choice = await window.showInformationMessage(
244244
message,

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class ConnectionCommands implements Disposable {
207207
wsClient,
208208
rootDirPath.path
209209
);
210-
if (!rootDir) {
210+
if (!rootDir && workspaceConfigs.enableFilesInWorkspace) {
211211
const created = await (
212212
await WorkspaceFsEntity.fromPath(wsClient, `/Users/${me}`)
213213
)?.mkdir(rootDirPath.path);
@@ -268,7 +268,14 @@ export class ConnectionCommands implements Disposable {
268268
return;
269269
}
270270
if (!workspaceConfigs.enableFilesInWorkspace) {
271-
UrlUtils.openExternal((await rootDir?.url) ?? "");
271+
UrlUtils.openExternal(
272+
(await rootDir?.url) ??
273+
(
274+
await this.connectionManager
275+
.workspaceClient?.apiClient?.host
276+
)?.href ??
277+
""
278+
);
272279
return;
273280
}
274281
const created = await this.wsfsCommands.createFolder(

packages/databricks-vscode/src/language/ConfigureAutocomplete.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ interface IPythonExtension {
5252

5353
const importString = "from databricks.sdk.runtime import *";
5454

55-
type StepResult = "Skip" | "Cancel" | "Error" | undefined;
55+
type StepResult = "Skip" | "Cancel" | "Error" | "Silent" | undefined;
5656

5757
interface Step {
5858
fn: (dryRun: boolean) => Promise<StepResult>;
@@ -147,8 +147,7 @@ export class ConfigureAutocomplete implements Disposable {
147147
),
148148
},
149149
{
150-
fn: async (dryRun = false) => this.updateExtraPaths(dryRun),
151-
required: true,
150+
fn: async () => this.updateExtraPaths(),
152151
},
153152
{
154153
fn: async (dryRun = false) => this.addBuiltinsFile(dryRun),
@@ -162,8 +161,8 @@ export class ConfigureAutocomplete implements Disposable {
162161
}
163162

164163
const choice = await window.showInformationMessage(
165-
"To allow autocompletion for Databricks specific globals (like dbutils), we need to install pyspark and add (or modify) __builtins__.pyi file to your project",
166-
"Continue",
164+
"Do you want to configure autocompletion for Databricks specific globals (dbutils etc)?",
165+
"Configure",
167166
"Cancel"
168167
);
169168

@@ -219,7 +218,7 @@ export class ConfigureAutocomplete implements Disposable {
219218
terminal.show();
220219
}
221220

222-
private async updateExtraPaths(dryRun = false): Promise<StepResult> {
221+
private async updateExtraPaths(): Promise<StepResult> {
223222
const extraPaths =
224223
workspace
225224
.getConfiguration("python")
@@ -228,9 +227,6 @@ export class ConfigureAutocomplete implements Disposable {
228227
path.join("resources", "python", "stubs")
229228
);
230229
if (extraPaths.includes(stubPath)) {
231-
return "Skip";
232-
}
233-
if (dryRun) {
234230
return;
235231
}
236232
extraPaths.push(stubPath);

packages/databricks-vscode/src/sync/CodeSynchronizer.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Disposable, Event, EventEmitter, TaskExecution, tasks} from "vscode";
2-
import {SyncTask} from "../cli/BricksTasks";
2+
import {SyncTask, TaskSyncType} from "../cli/BricksTasks";
33
import {CliWrapper} from "../cli/CliWrapper";
44
import {ConnectionManager} from "../configuration/ConnectionManager";
55

@@ -36,14 +36,20 @@ export class CodeSynchronizer implements Disposable {
3636
}),
3737
tasks.onDidStartTask((e) => {
3838
const {type, task} = e.execution.task.definition;
39-
if (type === "databricks" && task === "sync") {
39+
if (
40+
type === "databricks" &&
41+
Object.values(TaskSyncType).includes(task)
42+
) {
4043
this.currentTaskExecution = e.execution;
4144
this._onDidChangeStateEmitter.fire(this.state);
4245
}
4346
}),
4447
tasks.onDidEndTask((e) => {
4548
const {type, task} = e.execution.task.definition;
46-
if (type === "databricks" && task === "sync") {
49+
if (
50+
type === "databricks" &&
51+
Object.values(TaskSyncType).includes(task)
52+
) {
4753
this.currentTaskExecution = undefined;
4854
this._onDidChangeStateEmitter.fire(this.state);
4955
}

0 commit comments

Comments
 (0)