Skip to content
Draft
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
75 changes: 63 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,34 @@
"icon": "$(close)"
},
{
"command": "vscode-deephaven.addRemoteFileSource",
"title": "Add to Deephaven remote file sources",
"command": "vscode-deephaven.addGroovyRemoteFileSource",
"title": "Add to Deephaven Groovy remote file sources",
"icon": "$(add)"
},
{
"command": "vscode-deephaven.removeRemoteFileSource",
"title": "Remove from Deephaven remote file sources",
"command": "vscode-deephaven.removeGroovyRemoteFileSource",
"title": "Remove from Deephaven Groovy remote file sources",
"icon": "$(remove)"
},
{
"command": "vscode-deephaven.addPythonRemoteFileSource",
"title": "Add to Deephaven Python remote file sources",
"icon": "$(add)"
},
{
"command": "vscode-deephaven.removePythonRemoteFileSource",
"title": "Remove from Deephaven Python remote file sources",
"icon": "$(remove)"
},
{
"command": "vscode-deephaven.deleteVariable",
"title": "Delete Deephaven Variable",
"icon": "$(trash)"
},
{
"command": "vscode-deephaven.revealInExplorer",
"title": "Reveal in Explorer",
"icon": "$(eye)"
}
],
"icons": {
Expand Down Expand Up @@ -807,16 +822,28 @@
"when": "false"
},
{
"command": "vscode-deephaven.addRemoteFileSource",
"command": "vscode-deephaven.addGroovyRemoteFileSource",
"when": "false"
},
{
"command": "vscode-deephaven.removeRemoteFileSource",
"command": "vscode-deephaven.removeGroovyRemoteFileSource",
"when": "false"
},
{
"command": "vscode-deephaven.addPythonRemoteFileSource",
"when": "false"
},
{
"command": "vscode-deephaven.removePythonRemoteFileSource",
"when": "false"
},
{
"command": "vscode-deephaven.deleteVariable",
"when": "false"
},
{
"command": "vscode-deephaven.revealInExplorer",
"when": "false"
}
],
"editor/context": [
Expand Down Expand Up @@ -845,12 +872,22 @@
],
"explorer/context": [
{
"command": "vscode-deephaven.addRemoteFileSource",
"command": "vscode-deephaven.addGroovyRemoteFileSource",
"group": "deephaven",
"when": "explorerResourceIsFolder"
},
{
"command": "vscode-deephaven.removeRemoteFileSource",
"command": "vscode-deephaven.removeGroovyRemoteFileSource",
"group": "deephaven",
"when": "explorerResourceIsFolder"
},
{
"command": "vscode-deephaven.addPythonRemoteFileSource",
"group": "deephaven",
"when": "explorerResourceIsFolder"
},
{
"command": "vscode-deephaven.removePythonRemoteFileSource",
"group": "deephaven",
"when": "explorerResourceIsFolder"
}
Expand Down Expand Up @@ -941,14 +978,28 @@
"group": "inline@2"
},
{
"command": "vscode-deephaven.addRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canAddRemoteFileSource",
"command": "vscode-deephaven.addGroovyRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canAddRemoteFileSource:groovy",
"group": "inline"
},
{
"command": "vscode-deephaven.removeRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canRemoveRemoteFileSource",
"command": "vscode-deephaven.removeGroovyRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canRemoveRemoteFileSource:groovy",
"group": "inline"
},
{
"command": "vscode-deephaven.addPythonRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canAddRemoteFileSource:python",
"group": "inline"
},
{
"command": "vscode-deephaven.removePythonRemoteFileSource",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem == canRemoveRemoteFileSource:python",
"group": "inline"
},
{
"command": "vscode-deephaven.revealInExplorer",
"when": "view == vscode-deephaven.view.remoteImportSourceTree && viewItem != root && viewItem != languageRoot"
}
]
},
Expand Down
Binary file added releases/vscode-deephaven-1.0.10-remote.0.vsix
Binary file not shown.
15 changes: 13 additions & 2 deletions src/common/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,16 @@ export const SEARCH_PANELS_CMD = cmd('searchPanels');
export const SELECT_CONNECTION_COMMAND = cmd('selectConnection');
export const START_SERVER_CMD = cmd('startServer');
export const STOP_SERVER_CMD = cmd('stopServer');
export const ADD_REMOTE_FILE_SOURCE_CMD = cmd('addRemoteFileSource');
export const REMOVE_REMOTE_FILE_SOURCE_CMD = cmd('removeRemoteFileSource');
export const ADD_GROOVY_REMOTE_FILE_SOURCE_CMD = cmd(
'addGroovyRemoteFileSource'
);
export const REMOVE_GROOVY_REMOTE_FILE_SOURCE_CMD = cmd(
'removeGroovyRemoteFileSource'
);
export const ADD_PYTHON_REMOTE_FILE_SOURCE_CMD = cmd(
'addPythonRemoteFileSource'
);
export const REMOVE_PYTHON_REMOTE_FILE_SOURCE_CMD = cmd(
'removePythonRemoteFileSource'
);
export const REVEAL_IN_EXPLORER_CMD = cmd('revealInExplorer');
2 changes: 2 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export const ICON_ID = {
connected: 'vm-connect',
connecting: 'sync~spin',
disconnected: 'plug',
groovy: 'coffee',
python: 'dh-python',
runAll: 'run-all',
runSelection: 'run',
runningCode: 'sync~spin',
Expand Down
101 changes: 87 additions & 14 deletions src/controllers/ExtensionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
} from '@deephaven-enterprise/auth-nodejs';
import { NodeHttp2gRPCTransport } from '@deephaven/jsapi-nodejs';
import {
ADD_REMOTE_FILE_SOURCE_CMD,
ADD_GROOVY_REMOTE_FILE_SOURCE_CMD,
ADD_PYTHON_REMOTE_FILE_SOURCE_CMD,
CLEAR_SECRET_STORAGE_CMD,
CREATE_NEW_TEXT_DOC_CMD,
DELETE_VARIABLE_CMD,
Expand All @@ -22,7 +23,9 @@ import {
REFRESH_REMOTE_IMPORT_SOURCE_TREE_CMD,
REFRESH_SERVER_CONNECTION_TREE_CMD,
REFRESH_SERVER_TREE_CMD,
REMOVE_REMOTE_FILE_SOURCE_CMD,
REMOVE_GROOVY_REMOTE_FILE_SOURCE_CMD,
REMOVE_PYTHON_REMOTE_FILE_SOURCE_CMD,
REVEAL_IN_EXPLORER_CMD,
RUN_CODE_COMMAND,
RUN_MARKDOWN_CODEBLOCK_CMD,
RUN_SELECTION_COMMAND,
Expand All @@ -39,6 +42,8 @@ import {
import {
deserializeRange,
getEditorForUri,
getGroovyTopLevelPackageName,
getPythonTopLevelModuleFullname,
getTempDir,
isInstanceOf,
isSerializedRange,
Expand Down Expand Up @@ -80,6 +85,9 @@ import {
PYTHON_FILE_PATTERN,
SecretService,
ServerManager,
PYTHON_IGNORE_TOP_LEVEL_FOLDER_NAMES,
GROOVY_FILE_PATTERN,
GROOVY_IGNORE_TOP_LEVEL_FOLDER_NAMES,
} from '../services';
import type {
IDisposable,
Expand Down Expand Up @@ -115,6 +123,8 @@ import type {
VariableDefintion,
RemoteImportSourceTreeElement,
RemoteImportSourceTreeFolderElement,
GroovyPackageName,
PythonModuleFullname,
} from '../types';
import { ServerConnectionTreeDragAndDropController } from './ServerConnectionTreeDragAndDropController';
import { ConnectionController } from './ConnectionController';
Expand Down Expand Up @@ -187,7 +197,9 @@ export class ExtensionController implements IDisposable {
private _dhcServiceFactory: IDhcServiceFactory | null = null;
private _dheJsApiCache: IAsyncCacheService<URL, DheType> | null = null;
private _dheServiceFactory: IDheServiceFactory | null = null;
private _pythonWorkspace: FilteredWorkspace | null = null;
private _groovyWorkspace: FilteredWorkspace<GroovyPackageName> | null = null;
private _pythonWorkspace: FilteredWorkspace<PythonModuleFullname> | null =
null;
private _remoteFileSourceService: RemoteFileSourceService | null = null;
private _secretService: ISecretService | null = null;
private _serverManager: IServerManager | null = null;
Expand Down Expand Up @@ -369,13 +381,27 @@ export class ExtensionController implements IDisposable {
*/
initializeRemoteFileSourcing = (): void => {
assertDefined(this._toaster, 'toaster');

this._groovyWorkspace = new FilteredWorkspace(
GROOVY_FILE_PATTERN,
'groovy',
getGroovyTopLevelPackageName,
GROOVY_IGNORE_TOP_LEVEL_FOLDER_NAMES,
this._toaster
);
this._context.subscriptions.push(this._groovyWorkspace);

this._pythonWorkspace = new FilteredWorkspace(
PYTHON_FILE_PATTERN,
'python',
getPythonTopLevelModuleFullname,
PYTHON_IGNORE_TOP_LEVEL_FOLDER_NAMES,
this._toaster
);
this._context.subscriptions.push(this._pythonWorkspace);

this._remoteFileSourceService = new RemoteFileSourceService(
this._groovyWorkspace,
this._pythonWorkspace
);
this._context.subscriptions.push(this._remoteFileSourceService);
Expand Down Expand Up @@ -704,6 +730,9 @@ export class ExtensionController implements IDisposable {
initializeCommands = (): void => {
assertDefined(this._connectionController, 'connectionController');

/** Reveal in Explorer */
this.registerCommand(REVEAL_IN_EXPLORER_CMD, this.onRevealInExplorer);

/** Clear secret storage */
this.registerCommand(CLEAR_SECRET_STORAGE_CMD, this.onClearSecretStorage);

Expand Down Expand Up @@ -752,12 +781,20 @@ export class ExtensionController implements IDisposable {
this.onRefreshRemoteImportSourceTree
);
this.registerCommand(
ADD_REMOTE_FILE_SOURCE_CMD,
this.onAddRemoteFileSource
ADD_GROOVY_REMOTE_FILE_SOURCE_CMD,
this.onAddRemoteFileSource.bind(this, 'groovy')
);
this.registerCommand(
REMOVE_REMOTE_FILE_SOURCE_CMD,
this.onRemoveRemoteFileSource
REMOVE_GROOVY_REMOTE_FILE_SOURCE_CMD,
this.onRemoveRemoteFileSource.bind(this, 'groovy')
);
this.registerCommand(
ADD_PYTHON_REMOTE_FILE_SOURCE_CMD,
this.onAddRemoteFileSource.bind(this, 'python')
);
this.registerCommand(
REMOVE_PYTHON_REMOTE_FILE_SOURCE_CMD,
this.onRemoveRemoteFileSource.bind(this, 'python')
);

/** Search connections */
Expand Down Expand Up @@ -788,6 +825,7 @@ export class ExtensionController implements IDisposable {
*/
initializeWebViews = (): void => {
assertDefined(this._dheClientCache, 'dheClientCache');
assertDefined(this._groovyWorkspace, 'groovyWorkspace');
assertDefined(this._pythonWorkspace, 'pythonWorkspace');
assertDefined(this._panelService, 'panelService');
assertDefined(this._serverManager, 'serverManager');
Expand Down Expand Up @@ -849,6 +887,7 @@ export class ExtensionController implements IDisposable {

// Remote import source tree
this._remoteImportSourceTreeProvider = new RemoteImportSourceTreeProvider(
this._groovyWorkspace,
this._pythonWorkspace
);
this._remoteImportSourceTreeView =
Expand Down Expand Up @@ -940,6 +979,7 @@ export class ExtensionController implements IDisposable {
};

onAddRemoteFileSource = async (
languageId: 'groovy' | 'python',
folderElementOrUri:
| RemoteImportSourceTreeFolderElement
| vscode.Uri
Expand All @@ -948,23 +988,33 @@ export class ExtensionController implements IDisposable {
// Sometimes view/item/context commands pass undefined instead of a value.
// Just ignore. microsoft/vscode#283655
if (folderElementOrUri == null) {
logger.debug('onAddRemoteFileSource', 'folderElementOrUri is undefined');
logger.debug(
'onAddRemoteFileSource',
languageId,
'folderElementOrUri is undefined'
);
return;
}

assertDefined(this._pythonWorkspace, 'pythonWorkspace');
const workspace =
languageId === 'groovy' ? this._groovyWorkspace : this._pythonWorkspace;

assertDefined(workspace, `${languageId}Workspace`);

await this._pythonWorkspace.refresh();
// supress notifications since `markFolder` will raise notifications.
// this avoids sending data to the server that will change anyway
await workspace.refresh(true);

const uri =
folderElementOrUri instanceof vscode.Uri
? folderElementOrUri
: folderElementOrUri.uri;

this._pythonWorkspace.markFolder(uri);
workspace.markFolder(uri);
};

onRemoveRemoteFileSource = async (
languageId: 'groovy' | 'python',
folderElementOrUri:
| RemoteImportSourceTreeFolderElement
| vscode.Uri
Expand All @@ -975,20 +1025,27 @@ export class ExtensionController implements IDisposable {
if (folderElementOrUri == null) {
logger.debug(
'onRemoveRemoteFileSource',
languageId,
'folderElementOrUri is undefined'
);
return;
}

assertDefined(this._pythonWorkspace, 'pythonWorkspace');
const workspace =
languageId === 'groovy' ? this._groovyWorkspace : this._pythonWorkspace;

assertDefined(workspace, `${languageId}Workspace`);

await this._pythonWorkspace.refresh();
// supress notifications since `unmarkFolder` will raise notifications.
// this avoids sending data to the server that will change anyway
await workspace.refresh(true);

const uri =
folderElementOrUri instanceof vscode.Uri
? folderElementOrUri
: folderElementOrUri.uri;
this._pythonWorkspace.unmarkFolder(uri);

workspace.unmarkFolder(uri);
};

/**
Expand Down Expand Up @@ -1103,6 +1160,22 @@ export class ExtensionController implements IDisposable {
await this._serverManager?.updateStatus();
};

onRevealInExplorer = async (
uriOrHasUri: vscode.Uri | { uri: vscode.Uri } | undefined
): Promise<void> => {
// Sometimes view/item/context commands pass undefined instead of a value.
// Just ignore. microsoft/vscode#283655
if (uriOrHasUri == null) {
logger.debug('onRevealInExplorer', 'uri is undefined');
return;
}

const uri =
uriOrHasUri instanceof vscode.Uri ? uriOrHasUri : uriOrHasUri.uri;

await vscode.commands.executeCommand('revealInExplorer', uri);
};

/**
* Run code block in markdown.
* @param uri The uri of the editor
Expand Down
Loading
Loading