GordonSmith / vscode-ojs

VS Code extension for ObservableHQ notebooks
https://marketplace.visualstudio.com/items?itemName=GordonSmith.observable-js
MIT License
58 stars 5 forks source link

Activate OJS extension on "import" #29

Closed GordonSmith closed 2 years ago

GordonSmith commented 3 years ago

If no ojs or omd files have been loaded previously (or none are in focus) and the user tries to "import file" it will fail.

FYI @pmunin

RandomFractals commented 3 years ago

@GordonSmith you just need to add your OJS import command to activationEvents in package.json, like so:

"activationEvents": [
...
        "onCommand:ojs.import"
    ],

this might require creating new Untitled OJS document, or you can specify when that command runs, i.e. for open OJS files only.

Altrnatively, you can make sure OJS Import command never shows in Command Palette. Example:

https://github.com/RandomFractals/vscode-snippets-viewer/blob/main/package.json#L161

"commandPalette": [
                {
                    "command": "ojs.import",
                    "when": "never"
                },
...]

That way users will be forced to created new .ojs or .omd file to run Observable notebook import command :slightly_smiling_face:

RandomFractals commented 3 years ago

@pmunin I think you should revise your review.

Docs clearly state how to import OJS notebooks: https://github.com/GordonSmith/vscode-ojs#quick-start-with-observable-javascript--markdown

Also, VS Marketplace reviews are not for logging issues.

Gordon created great extension that makes it possible to run Observable notebooks in vscode, one of a kind.

GordonSmith commented 2 years ago

Resolved