Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracer: embedding into vscode #110

Open
ulugbekna opened this issue Dec 6, 2022 · 4 comments
Open

Tracer: embedding into vscode #110

ulugbekna opened this issue Dec 6, 2022 · 4 comments
Labels

Comments

@ulugbekna
Copy link

Hi,

I think vscode has quite nice facilities that allow embedding the tracer into vscode. Some of the advantages, for example, include

  • debugging your language server without switching from editor to browser
  • platform for working with documents:

Would you guys be interested in collaborating on something like this?

@keynmol
Copy link
Contributor

keynmol commented Dec 6, 2022

I think vscode has quite nice facilities that allow embedding the tracer into vscode

Hi!

Could you elaborate on how that would look like? I'm not really a VS code user so not sure what facilities it provides for embedding.

Do you mean tracer (1) being part of some sort of VS Code's built-in webview and (2) the links in json payloads to be clickable?

(2) is totally desirable on its own, and (1) sounds cool but I'm not sure how to achieve it

@ulugbekna
Copy link
Author

Yes both to (1) and (2).

(2) should be achievable by OS redirecting the file open request to the editor of choice, but I imagine this to be slow, while having the tracer embedded could allow faster and more pleasurable experience, e.g., the json payload could be shown in a side editor with highlighting enabled, encoded values could have inlay hints attached to them to show what they stand for. Some of these niceties can be achieved by using the Monaco editor in the tracer's web interface.

@keynmol keynmol added the tracer label Dec 14, 2022
@keynmol
Copy link
Contributor

keynmol commented Dec 16, 2022

So I've been experimenting with two things:

  1. Rendering the json payload in a custom way
  2. Replacing uri links (in a dumb way) with VS code paths

The results are pretty interesting: when used in a regular browser, you can jump straight to vs code (I will make this an optional parameter, because I myself don't use VS code and the links are distracting), but the built-in "Simple browser" doesn't seem to work with them:

2022-12-16 21 53 44

I wish to find a way to make it work with the simple browser - because then the whole "embedding" story might be solved without having to write a VS code extension.

So my current plan is:

  1. Polish the rendering of "json" as a custom HTML (still allowing to "Copy raw json" as an option)
  2. Make vscodified links a toggle in the UI (persisted in local storage)
  3. ... and only after merging and releasing 1 and 2, figure out why Simple Browser doesn't work this way.

The work is currently in #118 so @ulugbekna if you want to give it a go.
I added a command to build just the tracer - you can use sbt buildTracer or sbt bt for short, to build the development version of tracer app.

The actual rendering of "json" will be improved, this is just for testing

@keynmol
Copy link
Contributor

keynmol commented Dec 16, 2022

For posterity, what you see in the gif is me using the langoustine-vscode extension to configure a local LSP I use with the following config:

    "langoustine-vscode.servers": [
        {
            "name": "Quickmaffs LSP",
            "extension": "qmf",
            "command": "langoustine-tracer-dev",
            "args": [
                "--port",
                "9941",
                "/Users/velvetbaldmime/projects/quickmaffs/bin/lsp"
            ]
        }
    ],

I just set fix the port, instead of randomly assigned one, so that it's easier to reload the window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants