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

Debug JavaScript/Python in Enso Source #9440

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Mar 15, 2024

Pull Request Description

Extends the TextMate grammar to recognize foreign js and foreign python blocks and colorize them properly. Assigns URI and line numbers to properly match the location of the embedded foreign code blocks. As a result VSCode debugger smoothly steps from Enso to JavaScript or Python code.

Picture

image

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    style guides.
  • All code has been tested:
    • Code was manually tested
    • Unit test written in 43ef037

@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 15, 2024
@JaroslavTulach JaroslavTulach self-assigned this Mar 15, 2024
@JaroslavTulach
Copy link
Member Author

The sample script used for testing was:

from Standard.Base import all

invert ~one ~two =
    one-two


foreign js dbg = """
    debugger;
    function fac(n) {
      if (n <= 1) {
        debugger
        return 1;
      } else {
        return n * fac(n - 1);
      }
    }
    let r = fac(5)
    debugger
    return r

foreign python fib a = """
    def fib(x):
        if x <= 2:
            return 1
        else:
            f2 = fib(x-2)
            f1 = fib(x-1)
            return f1+f2

    return fib(a)

main = invert dbg (fib 5)

@JaroslavTulach
Copy link
Member Author

The debugging (but not the embedded syntax coloring) works in NetBeans and IGV too:

image

@JaroslavTulach
Copy link
Member Author

@ola-lis, can you please release new version enso4vscode-1.33.271.vsix of the Enso extension?

@JaroslavTulach JaroslavTulach merged commit 8d9c25c into develop Mar 15, 2024
39 of 41 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/ForeignDebugInline branch March 15, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants