-
Notifications
You must be signed in to change notification settings - Fork 40
VSCode: Make plugin extensible #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| index.d.ts | ||
| index.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Databricks Extension for VSCode Interfaces and Types | ||
|
|
||
| Package with types and interfaces required for extending the Databricks VSCode extension. | ||
|
|
||
| ## How to extend the Databricks VSCode extension | ||
|
|
||
| ### Importing and using the API | ||
|
|
||
| package.json | ||
|
|
||
| ```json | ||
| { | ||
| ... | ||
| "extensionDependencies": [ | ||
| "databricks.databricks-vscode" | ||
| ], | ||
| "devDependencies": { | ||
| ... | ||
| "@databricks/databricks-vscode-types": "*", | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| src/extension.ts | ||
|
|
||
| ```js | ||
| import {PublicApi} from "@databricks/databricks-vscode-types"; | ||
|
|
||
| export async function activate(context: vscode.ExtensionContext) { | ||
| const dbExtension = | ||
| extensions.getExtension < PublicApi > "databricks.databricks-vscode"; | ||
|
|
||
| if (!dbExtension) { | ||
| throw new Error("Databricks extension not installed"); | ||
| } | ||
| await dbExtension.activate(); | ||
| const dbApi = dbExtension.exports; | ||
| //... | ||
| } | ||
| ``` | ||
|
|
||
| ### Adding a view to the Databricks activity bar | ||
|
|
||
| ```js | ||
| "contributes" { | ||
| // ... | ||
| "views": { | ||
| "databricksBar": [ | ||
| { | ||
| "id": "databricksJobs", | ||
| "name": "Jobs" | ||
| }, | ||
| // ... | ||
| ], | ||
| // ... | ||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import {ApiClient} from "@databricks/databricks-sdk"; | ||
| import {Cluster} from "@databricks/databricks-sdk"; | ||
| import {Event} from "vscode"; | ||
| export type ConnectionState = "CONNECTED" | "CONNECTING" | "DISCONNECTED"; | ||
|
|
||
| export interface PublicApi { | ||
| connectionManager: { | ||
| onDidChangeState: Event<ConnectionState>; | ||
|
|
||
| get profile(): string | undefined; | ||
| get me(): string | undefined; | ||
| get state(): ConnectionState; | ||
| get cluster(): Cluster | undefined; | ||
| get apiClient(): ApiClient | undefined; | ||
|
|
||
| waitForConnect(): Promise<void>; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "@databricks/databricks-vscode-types", | ||
| "version": "1.0.0", | ||
| "description": "Package with types and interfaces to develop extensions to the Databricks VSCode plugin", | ||
| "main": "index.js", | ||
| "types": "index.d.ts", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/databricks/databricks-vscode.git" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "bugs": { | ||
| "url": "https://github.com/databricks/databricks-vscode/issues" | ||
| }, | ||
| "homepage": "https://github.com/databricks/databricks-vscode#readme", | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "watch": "tsc -w" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/vscode": "^1.69.1", | ||
| "typescript": "^4.8.3" | ||
| }, | ||
| "dependencies": { | ||
| "@databricks/databricks-sdk": "workspace:^" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "module": "CommonJS", | ||
| "target": "ES2020", | ||
| "declaration": true, | ||
| "esModuleInterop": true, | ||
| "isolatedModules": true, | ||
| "lib": ["ES2020", "ES2021.String"], | ||
| "rootDir": ".", | ||
| "strict": true /* enable all strict type-checking options */ | ||
| }, | ||
| "include": ["*.ts"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "name": "databricks", | ||
| "name": "databricks-vscode", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to update workspace names in the manual workflow for integration tests in internal repo as well. Adding a ticket for that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks! |
||
| "displayName": "Databricks for Visual Studio Code", | ||
| "description": "IDE support for Databricks", | ||
| "publisher": "databricks", | ||
|
|
@@ -64,6 +64,7 @@ | |
| "onDebugResolve:databricks-workflow" | ||
| ], | ||
| "main": "out/extension.js", | ||
| "types": "out/extension.d.ts", | ||
| "contributes": { | ||
| "commands": [ | ||
| { | ||
|
|
@@ -452,7 +453,7 @@ | |
| "test:unit": "yarn run build && node ./out/test/runTest.js", | ||
| "test:integ:clean": "yarn run clean && rm -rf /tmp/vscode-test-databricks /tmp/databricks-vscode-test-extensions", | ||
| "test:integ:prepare": "CODE_VERSION=1.69.1 && yarn run package && extest get-vscode --code_version $CODE_VERSION --storage /tmp/vscode-test-databricks && extest get-chromedriver --code_version 1.69.1 --storage /tmp/vscode-test-databricks", | ||
| "test:integ:install-vsix": "extest install-vsix --storage /tmp/vscode-test-databricks -f databricks-0.0.1.vsix -e /tmp/databricks-vscode-test-extensions", | ||
| "test:integ:install-vsix": "extest install-vsix --storage /tmp/vscode-test-databricks -f databricks-vscode*.vsix -e /tmp/databricks-vscode-test-extensions", | ||
| "test:integ:run": "yarn run build && node out/test/e2e/scripts/e2e.js -e /tmp/databricks-vscode-test-extensions --storage /tmp/vscode-test-databricks --code_settings src/test/e2e/settings.json 'out/**/*.e2e.js'", | ||
| "test:integ": "yarn run test:integ:prepare && yarn run test:integ:install-vsix && yarn run test:integ:run", | ||
| "test:cov": "nyc yarn run test:unit", | ||
|
|
@@ -461,6 +462,7 @@ | |
| }, | ||
| "dependencies": { | ||
| "@databricks/databricks-sdk": "*", | ||
| "@databricks/databricks-vscode-types": "workspace:^", | ||
| "@vscode/debugadapter": "^1.57.0", | ||
| "@vscode/webview-ui-toolkit": "^1.0.1" | ||
| }, | ||
|
|
@@ -505,4 +507,4 @@ | |
| ], | ||
| "report-dir": "coverage" | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still needs brackets?