Skip to content

Commit 259702b

Browse files
committed
Merge branch 'main' into DH-18347_panels-dont-show
2 parents 237c094 + 4fd2604 commit 259702b

18 files changed

+276
-124
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ npx vsce ls
9797

9898
#### Pre-Release Versions
9999
1. Make sure you are in a clean branch whose HEAD points to the commit to publish.
100+
1. `npm install` to ensure npm packages up to date
100101
1. Make sure you are logged in with `vsce` using a personal access token for a user in the https://dev.azure.com/deephaven-oss/ org. `npx vsce login deephaven`
101102
1. Run `npm run publish:prerelease`
102103

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ Once installed, there will be a new icon in the `activity bar` (the sidebar cont
1010

1111
![VS Code Activity Bar](./docs/assets/dh-activity-bar.gif)
1212

13-
The "SERVERS" tree will show the status of any configured servers. To run a script against a running server, simply click the `Run Deephaven File` action at the top of a file supported by the server (`python` or `groovy`).
13+
The "SERVERS" tree will show the status of any configured servers.
14+
15+
16+
## Running Code
17+
To run a script against a running server, simply click the `Run Deephaven File` action at the top of a file supported by the server (`python` or `groovy`).
1418

1519
![Connect to Community Server](./docs/assets/dhc-connect-to-server.gif)
1620

1721
A new connection will show up in the "CONNECTIONS" tree, and the "PANELS" should show any variables exposed on the connection. To disconnect, hover over the connection item and click the trash icon.
1822

23+
### Markdown Code Blocks
24+
Python and Groovy codeblocks in Markdown files can be run by clicking the "Run Deephaven Block" action directly above the codeblock.
25+
26+
![Markdown Codeblocks](docs/assets/markdown-codeblocks.png)
27+
1928
## Configuration
2029

2130
A single Community server `http://localhost:10000/` is configured by default and doesn't require any additional config. Additional connections can be configured in `VS Code` settings.
@@ -28,6 +37,8 @@ Community servers can be configured via the `"deephaven.coreServers"` setting in
2837

2938
![Community Server Settings](./docs/assets/add-community-server.gif)
3039

40+
#### Self-signed SSL Certificates
41+
If you are running a Community server with a self-signed SSL certificate, vscode will need to be run in an environment that has the `NODE_EXTRA_CA_CERTS` environment variable set to the path of the cert that was used to sign your cert. Depending on your setup, this could be the server certificate or a CA certificate.
3142

3243
### Enterprise Servers
3344
Enterprise servers can be configured via the `"deephaven.enterpriseServers"` setting in `VS Code` user or workspace settings.
135 KB
Loading

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vscode-deephaven",
3-
"version": "0.1.21",
3+
"version": "0.1.23",
44
"displayName": "Deephaven VS Code",
55
"description": "",
66
"publisher": "deephaven",
@@ -147,6 +147,11 @@
147147
"title": "Run Deephaven File",
148148
"icon": "$(run-all)"
149149
},
150+
{
151+
"command": "vscode-deephaven.runMarkdownCodeblock",
152+
"title": "Run Deephaven Markdown Codeblock",
153+
"icon": "$(run)"
154+
},
150155
{
151156
"command": "vscode-deephaven.runSelection",
152157
"title": "Run Deephaven Selected Lines",
@@ -677,6 +682,10 @@
677682
"command": "vscode-deephaven.runCode",
678683
"when": "editorLangId == python || editorLangId == groovy"
679684
},
685+
{
686+
"command": "vscode-deephaven.runMarkdownCodeblock",
687+
"when": "false"
688+
},
680689
{
681690
"command": "vscode-deephaven.runSelection",
682691
"when": "editorLangId == python || editorLangId == groovy"
@@ -866,7 +875,7 @@
866875
},
867876
"devDependencies": {
868877
"@deephaven-enterprise/jsapi-types": "^1.20240723.124-beta",
869-
"@deephaven/jsapi-types": "^1.0.0-dev0.36.1",
878+
"@deephaven/jsapi-types": "^1.0.0-dev0.37.3",
870879
"@types/node": "22.5.4",
871880
"@types/vscode": "^1.91.0",
872881
"@types/ws": "^8.5.10",
119 KB
Binary file not shown.

src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const REFRESH_SERVER_CONNECTION_TREE_CMD = cmd(
3131
);
3232
export const REFRESH_VARIABLE_PANELS_CMD = cmd('refreshVariablePanels');
3333
export const RUN_CODE_COMMAND = cmd('runCode');
34+
export const RUN_MARKDOWN_CODEBLOCK_CMD = cmd('runMarkdownCodeBlock');
3435
export const RUN_SELECTION_COMMAND = cmd('runSelection');
3536
export const SEARCH_CONNECTIONS_CMD = cmd('searchConnections');
3637
export const SEARCH_PANELS_CMD = cmd('searchPanels');

src/controllers/ConnectionController.ts

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
createConnectionQuickPickOptions,
1515
createConnectStatusBarItem,
1616
getConsoleType,
17-
getEditorForUri,
1817
isSupportedLanguageId,
1918
Logger,
2019
updateConnectionStatusBarItem,
@@ -135,7 +134,11 @@ export class ConnectionController extends ControllerBase implements Disposable {
135134

136135
const editor = vscode.window.activeTextEditor;
137136

138-
if (editor == null || !isSupportedLanguageId(editor.document.languageId)) {
137+
if (
138+
editor == null ||
139+
(!isSupportedLanguageId(editor.document.languageId) &&
140+
editor.document.languageId !== 'markdown')
141+
) {
139142
this._connectStatusBarItem.hide();
140143
return;
141144
}
@@ -158,7 +161,8 @@ export class ConnectionController extends ControllerBase implements Disposable {
158161

159162
connectEditor = async (
160163
connectionOrServer: ConnectionState | ServerState,
161-
editor: vscode.TextEditor
164+
uri: vscode.Uri,
165+
languageId: string
162166
): Promise<void> => {
163167
updateConnectionStatusBarItem(this._connectStatusBarItem, 'connecting');
164168

@@ -167,7 +171,7 @@ export class ConnectionController extends ControllerBase implements Disposable {
167171
if ('url' in connectionOrServer) {
168172
const cn = await this._serverManager.connectToServer(
169173
connectionOrServer.url,
170-
getConsoleType(editor.document.languageId)
174+
getConsoleType(languageId)
171175
);
172176

173177
if (cn == null) {
@@ -179,7 +183,11 @@ export class ConnectionController extends ControllerBase implements Disposable {
179183
}
180184

181185
try {
182-
await this._serverManager.setEditorConnection(editor, connectionOrServer);
186+
await this._serverManager.setEditorConnection(
187+
uri,
188+
languageId,
189+
connectionOrServer
190+
);
183191
} catch (err) {
184192
updateConnectionStatusBarItem(this._connectStatusBarItem, 'disconnected');
185193

@@ -202,27 +210,27 @@ export class ConnectionController extends ControllerBase implements Disposable {
202210

203211
/**
204212
* Get or create a connection for the given uri.
205-
* @param uri
213+
* @param uri Uri to get or create a connection for.
214+
* @param languageId Language id to use for the connection.
206215
*/
207216
getOrCreateConnection = async (
208-
uri: vscode.Uri
217+
uri: vscode.Uri,
218+
languageId: string
209219
): Promise<ConnectionState | null> => {
210220
assertDefined(this._outputChannel, 'outputChannel');
211221
assertDefined(this._serverManager, 'serverManager');
212222
assertDefined(this._toaster, 'toaster');
213223

214-
const editor = await getEditorForUri(uri);
215-
216224
// Get existing connection for the editor
217-
let dhService = await this._serverManager.getEditorConnection(editor);
225+
let dhService = await this._serverManager.getEditorConnection(uri);
218226

219227
if (dhService != null) {
220228
return dhService;
221229
}
222230

223231
const supportingConnections = await getConnectionsForConsoleType(
224232
this._serverManager.getConnections(),
225-
editor.document.languageId as ConsoleType
233+
languageId as ConsoleType
226234
);
227235

228236
const availableServers = this._serverManager.getServers({
@@ -233,29 +241,29 @@ export class ConnectionController extends ControllerBase implements Disposable {
233241
if (supportingConnections.length === 1 && availableServers.length === 0) {
234242
// If we only have 1 supporting connection, and no available servers, use
235243
// the available connection.
236-
await this.connectEditor(supportingConnections[0], editor);
244+
await this.connectEditor(supportingConnections[0], uri, languageId);
237245
} else if (
238246
// If there are no active connections that can support the editor, and we
239247
// only have 1 available server, just connect to it instead of prompting the
240248
// user to select an available server / connection.
241249
supportingConnections.length === 0 &&
242250
availableServers.length === 1
243251
) {
244-
await this.connectEditor(availableServers[0], editor);
252+
await this.connectEditor(availableServers[0], uri, languageId);
245253
} else {
246254
// If there are multiple options to select, prompt the user to select one.
247-
const isSelected = await this.onPromptUserToSelectConnection();
255+
const isSelected = await this.onPromptUserToSelectConnection(languageId);
248256

249257
// User cancelled the selection or an error occurred
250258
if (!isSelected) {
251259
return null;
252260
}
253261
}
254262

255-
dhService = await this._serverManager.getEditorConnection(editor);
263+
dhService = await this._serverManager.getEditorConnection(uri);
256264

257265
if (dhService == null) {
258-
const logMsg = `No active connection found supporting '${editor.document.languageId}' console type.`;
266+
const logMsg = `No active connection found supporting '${languageId}' console type.`;
259267
logger.debug(logMsg);
260268
this._outputChannel.appendLine(logMsg);
261269
this._toaster.error(logMsg);
@@ -341,12 +349,20 @@ export class ConnectionController extends ControllerBase implements Disposable {
341349
* 2. A list of running servers composed of:
342350
* - DHC servers that don't yet have a connection
343351
* - All running DHE servers
352+
* @param languageId Optional language id to use for the connection. Defaults
353+
* to the language id of the active editor.
344354
*/
345-
onPromptUserToSelectConnection = async (): Promise<boolean> => {
355+
onPromptUserToSelectConnection = async (
356+
languageId?: string
357+
): Promise<boolean> => {
346358
assertDefined(vscode.window.activeTextEditor, 'activeTextEditor');
347359
assertDefined(this._serverManager, 'serverManager');
348360

349361
const editor = vscode.window.activeTextEditor;
362+
const uri = editor.document.uri;
363+
if (languageId == null) {
364+
languageId = editor.document.languageId;
365+
}
350366

351367
const updateStatusPromise = this._serverManager.updateStatus();
352368

@@ -382,12 +398,11 @@ export class ConnectionController extends ControllerBase implements Disposable {
382398
const connectionsForConsoleType: ConnectionState[] =
383399
await getConnectionsForConsoleType(
384400
this._serverManager.getConnections(),
385-
editor.document.languageId as ConsoleType
401+
languageId as ConsoleType
386402
);
387403

388-
const editorActiveConnectionUrl = this._serverManager.getUriConnection(
389-
editor.document.uri
390-
)?.serverUrl;
404+
const editorActiveConnectionUrl =
405+
this._serverManager.getUriConnection(uri)?.serverUrl;
391406

392407
let selectedCnResult: ConnectionState | ServerState | null = null;
393408

@@ -396,7 +411,7 @@ export class ConnectionController extends ControllerBase implements Disposable {
396411
createConnectionQuickPickOptions(
397412
[...runningDHCServersWithoutConnections, ...runningDHEServers],
398413
connectionsForConsoleType,
399-
editor.document.languageId,
414+
languageId,
400415
editorActiveConnectionUrl
401416
)
402417
);
@@ -405,7 +420,7 @@ export class ConnectionController extends ControllerBase implements Disposable {
405420
return false;
406421
}
407422

408-
await this.connectEditor(selectedCnResult, editor);
423+
await this.connectEditor(selectedCnResult, uri, languageId);
409424

410425
return true;
411426
} catch (err) {

0 commit comments

Comments
 (0)