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

Execute and debug .enso files with bin/enso in VSCode #8923

Merged
merged 13 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/enso4igv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
java: ["8"]
java: ["11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -30,7 +30,7 @@ jobs:
# Why do we subtract a number? Read versioning policy!
# https://github.com/enso-org/enso/pull/7861#discussion_r1333133490
echo "POM_VERSION=`mvn -q -DforceStdout help:evaluate -Dexpression=project.version | cut -f1 -d -`" >> "$GITHUB_ENV"
echo "MICRO_VERSION=`expr $GITHUB_RUN_NUMBER - 2100`" >> "$GITHUB_ENV"
echo "MICRO_VERSION=`expr $GITHUB_RUN_NUMBER - 2250`" >> "$GITHUB_ENV"

- name: Update project version
working-directory: tools/enso4igv
Expand Down
5 changes: 5 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java+",
"request": "launch",
"name": "Launch Enso File"
},
{
"name": "Listen to 5005",
"type": "java+",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@
- [DataflowError.withoutTrace doesn't store stacktrace][8608]
- [Derive --in-project from --run source location][8775]
- [Binary operator resolution based on that value][8779]
- [Execute and debug individual Enso files in VSCode extension][8923]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand Down Expand Up @@ -1195,6 +1196,7 @@
[8608]: https://github.com/enso-org/enso/pull/8608
[8775]: https://github.com/enso-org/enso/pull/8775
[8779]: https://github.com/enso-org/enso/pull/8779
[8923]: https://github.com/enso-org/enso/pull/8923

# Enso 2.0.0-alpha.18 (2021-10-12)

Expand Down
32 changes: 30 additions & 2 deletions tools/enso4igv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,26 @@ following two extensions in the system:

![Installed VSCode extensions](https://user-images.githubusercontent.com/26887752/274904239-ae1ad4cc-e2ec-4c5b-bca0-c7d7189c6885.png)

## Using & Debugging
## Debugging a Single Enso File

Once installation is over let's continue with choosing _File/Open Folder..._ and
Open any `.enso` files. Click left editor gutter to place breakpoints. Then
choose _Run/Start Debugging_. If asked, choose _debug with_ **Java+** (Enso is
Java virtual machine friendly). A prompt appears asking for path to `bin/enso`
binary:

![Select enso executable](https://github.com/enso-org/enso/assets/26887752/4e1d0666-634d-4fb8-bf61-6dbf765311e8)

Locate `bin/enso` executable in the Enso engine download. If binding from source
code, the executable is located at root of
[Enso repository](https://github.com/enso-org/enso/) in
`./built-distribution/enso-engine-*/enso-*/bin/enso`. The `.enso` file gets
executed and output is printed in the area below editor:

![Executed](https://github.com/enso-org/enso/assets/26887752/2165a04f-bc0a-4b62-9ad7-e74e354e6937)

## Workspace Debugging

To work with all Enso code base continue with choosing _File/Open Folder..._ and
opening root of [Enso Git Repository](http://github.com/enso-org/enso)
(presumably already built with
[sbt buildEngineDistribution](https://github.com/enso-org/enso/blob/develop/docs/CONTRIBUTING.md#running-enso)).
Expand All @@ -43,6 +60,17 @@ place one on line 120:

![Breakpoint](https://github.com/enso-org/enso/assets/26887752/b6ae4725-49ef-439f-b900-3e08724e3748)

To debug the `test/Base_Tests/src/Data/Vector_Spec.enso` file with the root of
Enso repository opened in the VSCode workspace, choose preconfigured _Launch
Enso File_ debug configuration before _Run/Start Debugging_.:

![Launch Enso File in a Project](https://github.com/enso-org/enso/assets/26887752/3680aab2-bf99-41d2-ada7-491d6040f8d2)

The rest of the workflow remains the same as in case of individual (without any
project )`.enso` file case.

## Attach Debugger to a Process

Let's do a bit of debugging. Select _"Listen to 5005"_ debug configuration:

![Listen to 5005](https://github.com/enso-org/enso/assets/26887752/1874bcb1-cf8b-4df4-92d8-e7fb57e1b17a)
Expand Down
34 changes: 32 additions & 2 deletions tools/enso4igv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"categories": [
"Programming Languages",
"Debuggers",
"Other"
],
"keywords": [
Expand All @@ -31,7 +32,10 @@
"truffle"
],
"activationEvents": [
"onLanguage:enso"
"workspaceContains:**/*.java",
"onLanguage:enso",
"onDebug",
"onDebugDynamicConfigurations"
],
"main": "./dist/extension",
"contributes": {
Expand Down Expand Up @@ -66,7 +70,33 @@
"language": "enso"
}
],
"debuggers": []
"debuggers": [
{
"type": "java+",
"runtime": "node",
"languages": [
"enso"
],
"initialConfigurations": [
{
"type": "java+",
"request": "launch",
"name": "Launch Enso File"
}
],
"configurationSnippets": [
{
"label": "Enso Launch",
"description": "Debugging Enso Programs.",
"body": {
"type": "java+",
"request": "launch",
"name": "Launch Enso File"
}
}
]
}
]
},
"scripts": {
"vsix": "vsce package",
Expand Down
28 changes: 26 additions & 2 deletions tools/enso4igv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>enso4igv</artifactId>
<packaging>nbm</packaging>
<name>Enso Language Support for NetBeans &amp; Ideal Graph Visualizer</name>
<version>1.21-SNAPSHOT</version>
<version>1.33-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -72,6 +72,7 @@
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down Expand Up @@ -128,6 +129,11 @@
<artifactId>org-openide-util</artifactId>
<version>${netbeans.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-modules</artifactId>
<version>${netbeans.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
Expand Down Expand Up @@ -225,10 +231,28 @@
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-extexecution-base</artifactId>
<version>${netbeans.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-extexecution</artifactId>
<version>${netbeans.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-io</artifactId>
<version>${netbeans.version}</version>
<type>jar</type>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.version>RELEASE113</netbeans.version>
<netbeans.version>RELEASE140</netbeans.version>
Copy link
Member Author

@JaroslavTulach JaroslavTulach Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While working on this code base, I am trying to make sure the code works as:

The biggest challenge is support for IGV as it is not being updated to run on latest NetBeans version too frequently.

However for this PR I need DialogDisplayer.notifyFuture (thank you, @sdedic) which is only available since NetBeans 14 - e.g. we have to upgrade.

Copy link
Member Author

@JaroslavTulach JaroslavTulach Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With oracle/graal#8290 the Enso IGV Plugin version 1.31.129 can be installed into IGV:

Installation

Copy link
Member Author

@JaroslavTulach JaroslavTulach Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the .nbm file is installed into IGV, one can press Shift-F6 inside of a .enso file and get the same behavior as in the VSCode extension:

Exec in IGV

<netbeans.compile.on.save>none</netbeans.compile.on.save>
</properties>
<profiles>
Expand Down
Loading
Loading