Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@
"viewsWelcome": [
{
"view": "configurationView",
"contents": "In order to connect to a cluster you first have to configure your Databricks workspace:\n[Configure Databricks](command:databricks.connection.configureProject)\nTo learn more about how to use Databricks with VS Code [read our docs](https://github.com/databricks/databricks-vscode)."
"contents": "In order to connect to a cluster you first have to configure your Databricks workspace:\n[Configure Databricks](command:databricks.connection.configureProject)\nTo learn more about how to use Databricks with VS Code [read our docs](https://github.com/databricks/databricks-vscode).",
"when": "workspaceFolderCount > 0"
},
{
"view": "configurationView",
"contents": "Please open a folder to start using Databricks on VSCode.\n[Open Folder](command:vscode.openFolder)",
"when": "workspaceFolderCount == 0"
}
],
"menus": {
Expand Down
17 changes: 16 additions & 1 deletion packages/databricks-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,22 @@ import {
import {format, loggers, transports} from "winston";
import {UtilsCommands} from "./utils/UtilsCommands";

export function activate(context: ExtensionContext): PublicApi {
export function activate(context: ExtensionContext): PublicApi | undefined {
const a = workspace.workspaceFolders;
if (
workspace.workspaceFolders === undefined ||
workspace.workspaceFolders?.length === 0
) {
window.showErrorMessage("Open a folder to use Databricks extension");
/*
We force the user to open a folder from the databricks sidebar view. Returning
here blocks all other commands from running.
Since the workspace is reloaded when a folder is opened, the activation function
is called again. Therefore this won't block the activation of the extension on a
valid workspace.
*/
return undefined;
Comment thread
kartikgupta-db marked this conversation as resolved.
}
NamedLogger.getOrCreate(
ExposedLoggers.SDK,
{
Expand Down