Skip to content

Commit 3a4bf20

Browse files
authored
Allow export and register from commandpalette (#62)
1 parent ab11f81 commit 3a4bf20

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
"commandPalette": [
7171
{
7272
"command": "nipy.exportPlugin",
73-
"when": "false"
73+
"when": "editorLangId == python"
7474
},
7575
{
7676
"command": "nipy.registerPlugin",
77-
"when": "false"
77+
"when": "editorLangId == python"
7878
}
7979
],
8080
"explorer/context": [

src/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ export async function createDataPlugin(): Promise<DataPlugin | null> {
8989
}
9090

9191
export async function exportPlugin(uri: vscode.Uri): Promise<void> {
92-
if (!uri) {
92+
const scriptPath = uri?.fsPath ?? vscu.getOpenPythonScript()?.fsPath;
93+
if (!scriptPath) {
9394
return;
9495
}
9596

96-
const scriptPath = uri.fsPath;
9797
const workspaceDir = path.dirname(scriptPath);
9898
const pluginName = path.basename(path.dirname(scriptPath));
9999
const extensions = await readOrRequestFileExtensionConfig(workspaceDir);

src/extension.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ export function activate(context: vscode.ExtensionContext): void {
1010
const createDataPluginCommand = vscode.commands.registerCommand(
1111
'nipy.createDataPlugin',
1212
async () => {
13-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
14-
commands.createDataPlugin();
13+
void commands.createDataPlugin();
1514
}
1615
);
1716
const exportPluginCommand = vscode.commands.registerCommand(

0 commit comments

Comments
 (0)