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

Proprietary extension support #162

Merged
merged 45 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3bfb814
Add request to get serialized AST.
petervdonovan Feb 7, 2024
d9c677c
Let other extensions request the AST.
petervdonovan Feb 8, 2024
552176c
Add command to get info about the entire workspace
petervdonovan Feb 8, 2024
e7eda27
Expose command to check Docker version.
petervdonovan Feb 14, 2024
c19f2b3
Bugfix in previous commit
petervdonovan Feb 14, 2024
741a382
Another bugfix
petervdonovan Feb 14, 2024
fcb033b
Create command for getting version info
petervdonovan Feb 15, 2024
b33e181
Add debug messages
petervdonovan Feb 25, 2024
b0bf81e
Wait for language client to be ready
petervdonovan Feb 25, 2024
418b0ea
Be more quiet
petervdonovan Feb 28, 2024
62fb42a
Remote debug messages.
petervdonovan Feb 28, 2024
00f46bb
Add lfwasm as dep and turn strict type checks on
petervdonovan Mar 4, 2024
f1aebfa
Address issues from strict type checks
petervdonovan Mar 4, 2024
9f7e318
Get wasm to build.
petervdonovan Mar 4, 2024
3cb4710
Ditch esbuild
petervdonovan Mar 5, 2024
fae3c6d
Get webpack to work properly
petervdonovan Mar 5, 2024
81f894c
Improve the build
petervdonovan Mar 6, 2024
110d44e
Sync with lingua-franca LSP changes
petervdonovan Mar 6, 2024
bbee808
Add missing ts-loader dependency
petervdonovan May 22, 2024
d1e693e
Clean up debug prints
petervdonovan May 22, 2024
8e53e66
Add proprietary-extension-support submodule
petervdonovan May 22, 2024
412a876
Fix non-reproducibility in build
petervdonovan May 22, 2024
81924d7
Update known good
petervdonovan May 22, 2024
dc79c61
Install wasm-pack
petervdonovan May 22, 2024
b68a409
Add missing git clone step
petervdonovan May 22, 2024
62f5bef
Attempt to rearrange the CI builds
petervdonovan May 22, 2024
3e14417
Hack to move Rust uninstall to specific place
petervdonovan May 22, 2024
bcfe9fa
Try to fix build in macOS CI
petervdonovan May 22, 2024
63e0507
More fixes in CI
petervdonovan May 22, 2024
f533bc0
More fixes in CI
petervdonovan May 22, 2024
48ab70f
Try to make build more cross-platform
petervdonovan May 23, 2024
cb78db6
Hack to move Rust downgrade to specific place
petervdonovan May 23, 2024
7cea0d2
Cross-platform export
petervdonovan May 23, 2024
b9a0d1e
More bash hackery
petervdonovan May 23, 2024
1201c7e
Add missing environment variable
petervdonovan May 23, 2024
125443f
Fix typo
petervdonovan May 23, 2024
88fc404
Add forgotten environment variable
petervdonovan May 23, 2024
2f2a0f3
Try again to hide Rust binaries in a hacky way
petervdonovan May 23, 2024
10e5140
Another cross-platform export
petervdonovan May 23, 2024
7ca5e53
Try to pass macOS dependency install test
petervdonovan May 23, 2024
b77b4e0
A brittle fix for Windows
petervdonovan May 23, 2024
9add193
Try again to pass macOS dependency install test
petervdonovan May 23, 2024
a004449
Remove unnecessary uninstall
petervdonovan May 23, 2024
9757e16
Try again to pass macOS dependency install test
petervdonovan May 23, 2024
c8b303e
Fix silly error from rebase
petervdonovan May 23, 2024
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
18 changes: 10 additions & 8 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ runs:
echo $JAVA_HOME
working-directory: lingua-franca
shell: bash
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- name: Install the wasm-pack dev dependency globally
run: cargo install wasm-pack
shell: bash
- name: Build the VS Code extension
run: npm install --ignore-scripts
run: npm install --ignore-scripts && npm run compile
shell: bash
- name: Install Code
run: |
Expand All @@ -54,19 +62,13 @@ runs:
- name: Install pylint
run: |
python -m pip install --upgrade pip
pip3 install pylint --break-system-packages
PIP_BREAK_SYSTEM_PACKAGES=1 pip3 install pylint
shell: bash
if: ${{ inputs.partial == 'false' }}
- name: Install pnpm
run: npm i -g pnpm
shell: bash
if: ${{ inputs.partial == 'false' }}
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
if: ${{ inputs.partial == 'false' }}
- name: Install RTI
run: |
cd lingua-franca
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/dependency-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ jobs:
uses: ./.github/actions/build
with:
partial: true
- name: Uninstall dependencies
run: |
python3 -m pip uninstall -y pylint
- name: Downgrade dependencies
run: |
pip install -I pylint==2.10.0
rustup default 1.26.0
- name: Run tests (Linux)
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test-dependencies-outdated
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx --yes cross-env LF_VS_CODE_ALLOW_GLOBAL_UNINSTALLS=OK npm run test-dependencies-outdated
if: ${{ runner.os == 'Linux' }}
- name: Run tests (non-Linux)
run: npm run test-dependencies-outdated
Expand All @@ -61,27 +57,30 @@ jobs:
uses: ./.github/actions/build
with:
partial: true
- name: Uninstall dependencies
run: |
python3 -m pip uninstall -y pylint
- name: Run tests (Linux)
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test-dependencies-missing-extended
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx --yes cross-env LF_VS_CODE_ALLOW_GLOBAL_UNINSTALLS=OK npm run test-dependencies-missing-extended
if: ${{ runner.os == 'Linux' }}
- name: Run tests (non-Linux)
run: npm run test-dependencies-missing-extended
run: npx --yes cross-env LF_VS_CODE_ALLOW_GLOBAL_UNINSTALLS=OK npx --yes cross-env PIP_BREAK_SYSTEM_PACKAGES=1 npm run test-dependencies-missing-extended
if: ${{ runner.os != 'Linux' }}
test-dependencies-missing-basic:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: lf-lang/vscode-lingua-franca/.github/actions/build@main
- name: Check out vscode-lingua-franca repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1
- name: Build the extension
uses: ./.github/actions/build
with:
partial: "true"
partial: true
- name: Run tests (Linux)
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test-dependencies-missing-basic
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx --yes cross-env LF_VS_CODE_ALLOW_GLOBAL_UNINSTALLS=OK npm run test-dependencies-missing-basic
if: ${{ runner.os == 'Linux' }}
- name: Run tests (non-Linux)
run: npm run test-dependencies-missing-basic
run: npx --yes cross-env LF_VS_CODE_ALLOW_GLOBAL_UNINSTALLS=OK npm run test-dependencies-missing-basic
if: ${{ runner.os != 'Linux' }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*.vsix
.vscode-test
node_modules/*
out/*
out/
.gradle/*
__pycache__/*
lfw-pkg/
dist/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lingua-franca"]
path = lingua-franca
url = https://github.com/lf-lang/lingua-franca.git
[submodule "editor-support"]
path = editor-support
url = https://github.com/xronos-inc/editor-support.git
11 changes: 6 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"name": "Launch Extension",
"name": "Launch LF Extension",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"request": "launch",
"type": "extensionHost"
"type": "extensionHost",
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Launch VS Code Extension (Socket) LF with Klighd Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/../klighd-vscode/applications/klighd-vscode",
"--extensionDevelopmentPath=${workspaceFolder}/../klighd-vscode/applications/klighd-vscode",
"--extensionDevelopmentPath=${workspaceFolder}/",
],
"env": {
"LF_LS_PORT": "7670"
},
"skipFiles": [
"<node_internals>/**"
"<node_internals>/**"
],
"sourceMaps": true,
"smartStep": true,
Expand All @@ -49,7 +50,7 @@
"LF_LS_PORT": "7670"
},
"skipFiles": [
"<node_internals>/**"
"<node_internals>/**"
],
"sourceMaps": true,
"smartStep": true,
Expand Down
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
{
"type": "npm",
"script": "compile-tests"
},
{
"type": "npm",
"script": "compile",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: compile",
"detail": "npm run esbuild-base -- --sourcemap"
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tslint.json
uf.py
package-lock.json
developer-notes.md
temp*
47 changes: 35 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Contributing

This repo provides the [Lingua Franca](https://www.lf-lang.org/) (LF) [Visual
Studio Code](https://code.visualstudio.com/) (VSCode) extension built around the
LF Language and Diagram Server (LDS).
Expand All @@ -9,77 +10,99 @@ from the VSCode marketplace. See
[README.md](https://github.com/lf-lang/vscode-lingua-franca/) for more info.

## Getting started

To check out the repository, build from source, and install the VS Code plugin, run the following command:

```
git clone git@github.com:lf-lang/vscode-lingua-franca.git \
&& cd vscode-lingua-franca \
&& npm install
```

If you do not have a public key set up for authentication with GitHub, you can also use HTTPS:

```
git clone https://github.com/lf-lang/vscode-lingua-franca.git \
&& cd vscode-lingua-franca \
&& npm install
```

Note that this assumes that you have the WASM dependency somewhere on your system. Eventually, the WASM will probably be published; however, that hasn't been done yet, and it isn't currently possible to build it from source from this open-source repo because it is closed-source.
lhstrh marked this conversation as resolved.
Show resolved Hide resolved

### Trouble Shooting

#### VS Code is not detected on Mac OS X

If you have VS Code installed, it might not get recognized if it is not on your `PATH`.
To add `code` to your `PATH` and allow our install script to find it, open the command pallete in VS Code (<kbd>ctrl</kbd>+<kbd>p</kbd>) and type `Install 'code' command in PATH`.

#### Maven uses an incompatible JDK

Maven may come with an OpenJDK, depending on how it is installed. If this JDK is not the right version, the build process will fail.
To point `mvn` to the correct JDK, set the `JAVA_HOME` environment variable accordingly. To see which version of Java is used, run `mvn --version`.

## Running the tests

To run integration tests with the assumption that the correct dependencies are installed, run:

```bash
npm run test
```

To test the Textmate syntax highlighting only, run

```bash
npm run test-syntax
```

To save the current Textmate syntax highlighting as the correct "known good" behavior, run

```bash
npm run update-known-good
```

## Adding tests

Tests are located in the `src` directory and are marked using the `.test.ts` extension. We use [Mocha](https://mochajs.org/) as our testing framework.

## Submitting a Pull Request (PR)

Please keep your PRs manageable and easy to review.
- Provide a clear title and description of the proposed changes;
- Keep the changes limited to a particular feature, fix, or enhancement;
- Mark the PR as "draft" until it is ready for review;
- Provide tests along with your code; and
- Follow the [TypeScript style
guide](https://google.github.io/styleguide/tsguide.html) to avoid trivial
review feedback.

- Provide a clear title and description of the proposed changes;
- Keep the changes limited to a particular feature, fix, or enhancement;
- Mark the PR as "draft" until it is ready for review;
- Provide tests along with your code; and
- Follow the [TypeScript style
guide](https://google.github.io/styleguide/tsguide.html) to avoid trivial
review feedback.

## Suggested debugging workflow

For development purposes, it is possible to manually perform an incremental build simply by bypassing Maven and Gradle entirely and
instead running the Python script `./uf.py`. This script will re-compile Java and Kotlin files and add them to the fat jar using
the `jar` command with the `-uf` flag.

We suggest the following workflow for debugging the extension (implemented in TypeScript):

1. Run the command `npm run compile` to generate JavaScript together with a source map (in the `out` directory). The source map is necessary for breakpoints to work.
2. Set breakpoints in the TypeScript source files.
3. Open `./src/extension.ts` in Visual Studio Code.
4. Press <kbd>F5</kbd> to run the extension in a new Extension Development Host window.

We suggest the following workflow for debugging the language server (implemented in Java/Kotlin):

1. Ensure that the appropriate compiler is on your PATH.
* To build Java files, `javac` is required.
* To build Kotlin files, [the Kotlin JVM compiler](https://github.com/JetBrains/kotlin/releases/tag/v1.5.30) `kotlinc` is required. It must be the JVM compiler, not the native compiler.

- To build Java files, `javac` is required.
- To build Kotlin files, [the Kotlin JVM compiler](https://github.com/JetBrains/kotlin/releases/tag/v1.5.30) `kotlinc` is required. It must be the JVM compiler, not the native compiler.

2. Ensure that the language and diagram server fat JAR exists. This file is called `./lib/lflang-lds.jar`. If it does not exist, then it is necessary to build it using the build task: `npm run build`.
3. Run the command: ```./uf.py <CANONICAL_NAME>``` or ```npm run amend-jar -- <CANONICAL_NAME>```, where <CANONICAL_NAME> is either:
* the canonical name of a package that you would like to update, or
* the canonical name of the class that you would like to update. An example would be: ```./uf.py org.lflang.FileConfig```. This will also update any nested classes, and it should work as you would expect even for Kotlin files that do not include exactly one top-level class.
3. Run the command: `./uf.py <CANONICAL_NAME>` or `npm run amend-jar -- <CANONICAL_NAME>`, where <CANONICAL_NAME> is either:

- the canonical name of a package that you would like to update, or
- the canonical name of the class that you would like to update. An example would be: `./uf.py org.lflang.FileConfig`. This will also update any nested classes, and it should work as you would expect even for Kotlin files that do not include exactly one top-level class.

4. Open `./src/extension.ts` in Visual Studio Code.
5. Press <kbd>F5</kbd> to run the extension in a new Extension Development Host window.

Expand Down
1 change: 1 addition & 0 deletions editor-support
Submodule editor-support added at 83df49
2 changes: 1 addition & 1 deletion lingua-franca
Loading
Loading