-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Downloadable VSCode extension (#7861)
- Loading branch information
1 parent
15b1989
commit 7a31dcd
Showing
6 changed files
with
139 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Listen to 5005", | ||
"type": "java+", | ||
"request": "attach", | ||
"listen": "true", | ||
"hostName": "localhost", | ||
"port": "5005" | ||
}, | ||
{ | ||
"name": "Debug Adapter Protocol", | ||
"type": "node", | ||
"debugServer": 4711, | ||
"request": "attach" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Enso Language Support for VSCode | ||
|
||
[![Enso Language Support for VSCode](https://github.com/enso-org/enso/actions/workflows/enso4igv.yml/badge.svg)](https://github.com/enso-org/enso/actions/workflows/enso4igv.yml) | ||
|
||
## Downloading | ||
|
||
**Download** _"VSCode Extension" artifact_ from the | ||
[latest actions run](https://github.com/enso-org/enso/actions/workflows/enso4igv.yml), | ||
unzip, install into VSCode: | ||
|
||
![Install from VSIX file](https://github.com/enso-org/enso/assets/26887752/9d7c35d6-44b2-4157-b451-bb27980425c7) | ||
|
||
Your Enso files will get proper **syntax coloring**. You'll be able to **debug** | ||
Java/Enso code interchangeably. | ||
|
||
After installing the Enso `.vsix` file (and reloading window) we can find | ||
following two extensions in the system: | ||
|
||
![Installed VSCode extensions](https://github.com/enso-org/enso/assets/26887752/7dcfc0a0-8e7f-4aa6-ae67-99c3f875a658) | ||
|
||
## Using & Debugging | ||
|
||
Once installation is over let's 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](../../docs/CONTRIBUTING.md#running-enso)). | ||
Following set of projects is opened and ready for use: | ||
|
||
![Enso Projects](https://github.com/enso-org/enso/assets/26887752/7919d2ee-4bcd-4b7b-954a-e2dc61f7c01a) | ||
|
||
With the workspace opened, you can open any Enso or Java file. Let's open for | ||
example `Vector_Spec.enso` - a set of unit tests for `Vector` - a core class of | ||
Enso standard library: | ||
|
||
![Openning Vector](https://github.com/enso-org/enso/assets/26887752/0d182fc8-4ff9-48d7-af63-35cad5fb75cc) | ||
|
||
It is now possible to place breakpoints into the `Vector_Spec.enso` file. Let's | ||
place one on line 120: | ||
|
||
![Breakpoint](https://github.com/enso-org/enso/assets/26887752/b6ae4725-49ef-439f-b900-3e08724e3748) | ||
|
||
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) | ||
|
||
And then just | ||
[execute the engine distribution](../../docs/CONTRIBUTING.md#running-enso) in | ||
debug mode: | ||
|
||
```bash | ||
sbt:enso> runEngineDistribution --debug --run test/Tests/src/Data/Vector_Spec.enso | ||
``` | ||
|
||
After a while the breakpoint is hit and one can inspect variables, step over the | ||
statements and more... | ||
|
||
![Breakpoint in Enso](https://github.com/enso-org/enso/assets/26887752/54ae4126-f77a-4463-9647-4dd3a5f83526) | ||
|
||
...as one can seamlessly switch to debugging on the Enso interpreter itself! One | ||
can place breakpoint into Java class like `PanicException.java` and continue | ||
debugging with `F5`: | ||
|
||
![Breakpoint in Java](https://github.com/enso-org/enso/assets/26887752/db3fbe4e-3bb3-4d4a-bb2a-b5039f716c85) | ||
|
||
Should one ever want to jump back from Java to Enso one can use the _"Pause in | ||
GraalVM Script"_ action. Select it and continue with `F5` - as soon as the code | ||
reaches a statement in Enso, it stops: | ||
|
||
![Pause in GraalVM](https://github.com/enso-org/enso/assets/26887752/98eb0bb7-48c2-4208-9d9a-5b8bacc99de2) | ||
|
||
## Building VSCode Extension | ||
|
||
To build thisVSCode extension and obtain _Enso_ syntax coloring as well as | ||
support for editing and debugging of `engine/runtime` sources in **VSCode**: | ||
|
||
``` | ||
enso/tools/enso4igv$ mvn clean install -Pvsix | ||
enso/tools/enso4igv$ ls *.vsix | ||
enso4vscode-*.vsix | ||
``` | ||
|
||
one needs to have `npm`, Java and `mvn` available to successfully build the | ||
VSCode extension. | ||
|
||
![Install from VSIX...](https://user-images.githubusercontent.com/26887752/210131513-8c729f9b-5ddc-43aa-9ad5-420b7d87d81d.png) | ||
|
||
Once the `.vsix` file is created, it can be installed into VSCode. Select | ||
_Extension perspective_ and choose _Install from VSIX..._ menu item. |