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 1 commit
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
Prev Previous commit
Next Next commit
Add lfwasm as dep and turn strict type checks on
  • Loading branch information
petervdonovan committed May 22, 2024
commit 00f46bbedf3de6bf0c3d5d2a27fdf14ce26c6e94
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/*
out/*
.gradle/*
__pycache__/*
lfw-pkg/
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ To check out the repository, build from source, and install the VS Code plugin,
```
git clone git@github.com:lf-lang/vscode-lingua-franca.git \
&& cd vscode-lingua-franca \
&& cp -r /path/to/the/wasm/dependency/packaged/for/use/with/typescript ./lfw-pkg \
&& 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 \
&& cp -r /path/to/the/wasm/dependency/packaged/for/use/with/typescript ./lfw-pkg \
&& 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
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"which": "^2.0.2"
},
"dependencies": {
"lfwasm": "file:lfw-pkg",
"vscode-languageclient": "^6.1.3"
},
"scripts": {
Expand Down
21 changes: 18 additions & 3 deletions src/build_commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import { LanguageClient } from 'vscode-languageclient';
import { getTerminal, MessageDisplayHelper } from './utils';
import * as lfw from 'lfwasm';

/**
* Return the URI of the given document, if the document is a Lingua Franca file; else, return
Expand Down Expand Up @@ -28,7 +29,11 @@ const getAst =
(withLogs: MessageShowerTransformer, client: LanguageClient) =>
async () => {
// vscode.window.showInformationMessage("Getting AST...");
const uri = getLfUri(vscode.window.activeTextEditor.document);
const current_file = vscode.window.activeTextEditor?.document;
if (!current_file) {
return "There is no currently active file, so it is not clear which AST to return.";
}
const uri = getLfUri(current_file);
if (!uri) {
return "The currently active file is not a Lingua Franca source file.";
}
Expand Down Expand Up @@ -96,13 +101,22 @@ const build = (withLogs: MessageShowerTransformer, client: LanguageClient) =>
if (!uri) return;
vscode.workspace.saveAll().then((successful: boolean) => {
if (!successful) return;
client.sendRequest('generator/build', uri).then((message: string) => {
client.sendRequest('generator/build', [uri, getJson(uri)]).then((messageAny: any) => {
const message: string = messageAny;
if (message) withLogs(vscode.window.showInformationMessage)(message);
else withLogs(vscode.window.showErrorMessage)('Build failed.');
});
});
};

function getJson(uri: string): string {
let json: string | undefined = lfw.lfc_json(vscode.Uri.parse(uri).fsPath, (p: string) => vscode.workspace.fs.readFile(vscode.Uri.file(p)));
if (!json) {
json = "";
}
return json;
}

/**
* Return the action that should be taken in case of a request to build and run.
* @param withLogs A messageShowerTransformer that lets the user request to view logs.
Expand All @@ -115,7 +129,8 @@ const buildAndRun = (withLogs: MessageShowerTransformer, client: LanguageClient)
if (!uri) return;
vscode.workspace.saveAll().then((successful: boolean) => {
if (!successful) return;
client.sendRequest('generator/buildAndRun', uri).then((command: string[]) => {
client.sendRequest('generator/buildAndRun', [uri, getJson(uri)]).then((commandAny: any) => {
const command: string[] = commandAny;
if (!command || !command.length) {
withLogs(vscode.window.showErrorMessage)('Build failed.');
return;
Expand Down
15 changes: 12 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
"compilerOptions": {
"esModuleInterop": true,
"inlineSources": false,
"lib": ["esnext"],
"lib": [
"esnext"
],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./out",
"sourceMap": false,
"target": "esnext",
"rootDir": "./src",
"strict": true
},
"exclude": ["node_modules", ".vscode-test", ".gradle"],
"include": ["./src"]
"exclude": [
"node_modules",
".vscode-test",
".gradle"
],
"include": [
"./src"
]
}