Giter Club home page Giter Club logo

vscode-ojs's People

Contributors

dependabot[bot] avatar gordonsmith avatar hydrosquall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vscode-ojs's Issues

command 'ojs.import' not found

Hello @GordonSmith,
I just installed your Observable JS into my VSCode,
created in the current directory a file, hexagonal-grids.ojs,
and tried to import a notebook with OJS: Import notebook,
but all I get is this error
Screenshot 2021-10-19 at 20 51 47

What am I missing here?

Thanks, @rudifa

Provide notebook UI using VS Code Notebook API

I've been wanting to play with the VS Code Notebook API for a while but I haven't found the time. This extension already has the core functionality for integrating the Observable runtime and parser with the VS Code Notebook API. It would be great if we could work in a notebook like on observablehq.com and have access to VS Code's features (formatters, language servers, and extensions in general). If you haven't tried VS Code's notebook UI, you can try opening a Jupyter notebook file (.ipynb) and it should just work if you have the Python extension installed. I would love to be able to check notebooks into source control, refactor variable names across all of my Observable notebooks, and eventually write Observable notebooks in Node.js or Deno. I will definitely help with this if someone can get the ball rolling ๐Ÿ‘

fs/system apis

i see there's some fs module but I can't figure how to use. are fs/system apis supported in any way? what about running in a nodejs context? also what about CORS?

Auto-import default Inputs, d3, vl and Plot libraries for the new OJS notebooks that use them

Hi Gordon,

First of all, congrats on crossing 1K installs in VS marketplace.

I wanted to request this auto-import feature for the new OJS notebooks. @mbostock & ObservbableHQ team recently simplified how the above mentioned libraries are used on Observable site.

In order to import them into OJS vscode extension we'd need to add them too when .ojs and .omd files are created and code cells reference them.

I think we can just scan notebook cells code on import and add them at the end of the imported notebook OJS/OMD code.

See Mike's recommended libraries notebook for the latest versions to use:

https://observablehq.com/@observablehq/recommended-libraries

and this example I created recently: https://github.com/RandomFractals/Chicago-transportation-notebooks/blob/main/notebooks/observable/chicago-traffic-tracker.ojs

I had to add them manually in my OJS Imports section, but I think that process can be automated with your OJS notebook importing and loading tool.

Preview to Web Page works as expected but Export to HTML does not work

Hi - I am a regular user of R markdown, who has arrived here after switching to Quarto and discovering the awesome world of Observable JS, and imaging the world of possibility running javascript directly on our data in the browser.

However, I am quite new to this, so it is quite possible I am missing something really obvious.

I have installed Observable JS extension v0.4.26 and Javsascript (sic) Notebook Extension Pack Notebook Extension Pack 1.0.6 on Windows 10.

I have tried running HelloWorld.omd.

If I use the OJS: Preview Web Page command, the output is as expected:
image

However, if I use the OJS: Export to HTML command, and open the resulting web page in Chrome, it is completely blank. The html is:

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hpcc-js/common/font-awesome/css/font-awesome.min.css">
    <style>
    body {
        padding: 0px;
        margin: 8px;
        background: white;
        color: black;
    }
    #placeholder {
        position: absolute;
        left: 8px;
        top: 8px;
        right: 8px;
        bottom: 8px;
        max-width: 480px;
    }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/@hpcc-js/observable-md/dist/index.full.js" type="text/javascript" charset="utf-8"></script>
    <script>
        var omdMod = window["@hpcc-js/observable-md"]
    </script>

</head>

<body onresize="doResize()">
    <div id="placeholder">
    </div>
    <script>
        var app = new omdMod.Observable()
            .target("placeholder")
            .showValues(true)
            .mode("omd")
            .text(`# Hello and \${w}

\`\`\`
w = 'Welcome!';
\`\`\``)
            ;

        doResize();

        function doResize() {
        if (app) {
            app
                .resize()
                .lazyRender()
                ;
        }
    }
    </script>
</body>

</html>

If I was trying to compile with Quarto, R markdown or Pandoc, I would know which command was being run when I try to export to html (e.g. quarto render HelloWorld.qmd). However I am completely new to this and I am not sure what is actually happening when I select the Export option in the command palette.

How do I proceed with troubleshooting something like this?

How to debug notebooks?

First, thank you for your work on this @GordonSmith ๐Ÿ™ There is a lot of potential here and I imagine one day I will be working on Observable notebooks exclusively in VS Code.

I'm testing out the notebook extension and I'm having trouble rendering a cell that renders with no issues on observablehq.com:
image

Here's a link to the notebook: https://observablehq.com/@gnestor/table-demo

How can I debug this notebook in VS Code like I would by using the console in Chrome Devtools? I checked the "Output" panel and I don't see Observable JS in the list of available outputs.

Clarify OJS settings and review Preview errors

I noticed that you have a setting to show runtime values: https://github.com/GordonSmith/vscode-ojs#settings

I created standard .vscode/settings.json in my OJS notebooks project workspace.

Questions:

  1. Does that setting show cell runtime values for the cells that are not markup or viewof?
  2. Should I see them in a notebook, in vscode debug console, or dev tools?
  3. Should I set that setting in your custom config file per error below?

Please review other errors.

image

Thanks!

"Failed to fetch" error when importing within .ojsnb after VSCode restart

Hi,

Absolutely loving this library, overall; thank you -- Observable is amazing, but it's a dealbreaker to not be able to use my local tools, so this fills a real gap.

I'm having a hangup trying to import one file from another .ojsnb file. Everything works as expected when viewing the importing notebook through the preview window (Cmd+K V), but when running the cells in the notebook view, it only works until I close and restart VSCode. After a restart, the importing .ojsnb file simply outputs "Failed to fetch", with the quotes, as the output of the import line when running the cells. (other lines in the cell up to the import line run normally, nothing after.)

The issue is reproducible for me with vscode-ojs/samples/myMain.ojs that imports from ./myLib.ojs, converted to a .ojsnb file. (it also reproduces with a fully simplified version of them.)

Any insight into what's causing this behavior, and how to fix it?

I'd be happy to perform any actions you might request of me, let me know.

Add OJS/OMD Preview WebviewPanelSerializer

Gordon,

I added save as .ojs & .omd options to my JS notebook inspector:

RandomFractals/js-notebook-inspector#54

Everything looks good, except OJS/OMD Preview webview is not restored on vscode restart.

before:

js-notebook-inspector-omd-save

that OMD Preview panel is gone after that vscode instance restart:

ojs-preview-blank-restore

Expected to see same thing as in pic 1.

It would be nice if you could add WebviewPanelSerializer for those custom .ojs/.omd panels.

See my notebook.view.ts for an example of implementing that api:

https://github.com/RandomFractals/js-notebook-inspector/blob/master/src/views/notebook.view.ts

Add web extension support

It would be great if this extension could be installed and used in a browser context. The motivation is to be able to share notebooks with people by simply sharing a URL (assuming that the notebook is publicly available on Github or somewhere else that's accessible from vscode.dev). Additionally, in Zen Mode, VS Code notebooks look pretty approachable:

image

Currently, the Observable JS extension can't be installed from vscode.dev:

image

According to the docs: https://code.visualstudio.com/api/extension-guides/web-extensions#web-extension-enablement

VS Code automatically treats an extension as a web extension if:

  • The extension manifest (package.json) has browser entry point.
  • The extension manifest has no main entry point and none of the following contribution points: localizations, debuggers, terminal, typescriptServerPlugins.

If an extension wants to provide a debugger or terminal that also work in the web extension host, a browser entry point needs to be defined.

Some VS Code APIs are not available in a browser context so it may require a bit of refactoring, or not!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.