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

[FEATURE] Debugger support scripts with inspection tools #4982

Open
commandblock2 opened this issue Dec 20, 2024 · 4 comments
Open

[FEATURE] Debugger support scripts with inspection tools #4982

commandblock2 opened this issue Dec 20, 2024 · 4 comments
Labels
🔥 enhancement New feature or request 🌑 nextgen

Comments

@commandblock2
Copy link
Contributor

commandblock2 commented Dec 20, 2024

LiquidBounce Branch

Nextgen

Describe your feature request.

Since we are using graalvm, we might have a chance to use its debugger support for our scripts. Using this will require one more external dependency, chromeinspector. Generally I am looking for possibility for placing breakpoints and having REPL. You can assign this to me.

Additional context

No response

@github-actions github-actions bot added 🌑 nextgen 🔥 enhancement New feature or request labels Dec 20, 2024
@commandblock2
Copy link
Contributor Author

image
this is easily proven to be feasible, there are details like event being shown as undefined even though you can unfold it and see what member is in the object or typing in the debug console will sometimes result in very long exception reporting like below. Or the evaluation cannot be done when the game is not paused.
image.

Since LBNG does come with a mcef browser, we might be able to direct a developer tool page or something to help debugging a script without any external tools and a built-in setting for if a certain script module should be loaded in debug mode?

Also a it might enable us to add a repl module for quickly debugging whatever you would like to try.

@commandblock2
Copy link
Contributor Author

going to try oracle/graal#5844 (comment) to see if it works

@commandblock2
Copy link
Contributor Author

I was able to use the lsp option and got it running, here is a capability reply from the lsp server, but in the initialize request it was not using the right workspaceFolders, not sure if it has anything to do with that
part of the request from vscode:

            "workspaceFolders": [
                {
                    "uri": "file:///mnt/old-linux/home/commandblock2/git_repo/MultiMC5/build/instances/LBNG-Production/minecraft/LiquidBounce/scripts",
                    "name": "scripts"
                }
            ]

response from the lsp of graalvm

{
    "result": {
        "capabilities": {
            "hoverProvider": true,
            "workspaceSymbolProvider": false,
            "completionProvider": {
                "resolveProvider": false
            },
            "referencesProvider": false,
            "definitionProvider": false,
            "documentHighlightProvider": true,
            "codeActionProvider": true,
            "signatureHelpProvider": {},
            "textDocumentSync": 2,
            "documentSymbolProvider": false,
            "codeLensProvider": {
                "resolveProvider": false
            },
            "executeCommandProvider": {
                "commands": [
                    "dry_run",
                    "get_coverage"
                ]
            }
        }
    },
    "id": 0,
    "jsonrpc": "2.0"
}

@commandblock2
Copy link
Contributor Author

Also the chromium browser comes with mcef does not seems to bundle a devtools:// you may found in a regular chromium. So if we want in-client debugging it's very likely that we will have to serve it ourself.

1zun4 pushed a commit that referenced this issue Jan 1, 2025
Implement a part of issue #4982
Added a client sub command to enable placing break points in scripts. The command has following parameters:
`.client debug <name> [<protocol>] [<suspendOnStart>] [<inspectInternals>] [<port>]`.
Protocols includes [DAP](https://www.graalvm.org/latest/tools/dap/) and inspect([Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 enhancement New feature or request 🌑 nextgen
Projects
None yet
Development

No branches or pull requests

1 participant