Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 9 additions & 1 deletion editors/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ npm install

### Debugging

In VSCoode, go to the `Run & Debug` sidebar (Ctrl + Shft + D) and click the `Run Extension (Debug Build)`
In VSCode, go to the `Run & Debug` sidebar (Ctrl + Shft + D) and click the `Run Extension (Debug Build)`
button. This will open a new VSCode instance with the lsp server installed.

### Adding the binary inside VSIX

Copy the asm-lsp binary into `editors/code/bin/{platform}-{arch}/`.

```console
npm run package
```
1 change: 1 addition & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
}
]
},
"publisher": "asm-lsp",
"devDependencies": {
"@types/node": "^18.14.6",
"@types/vscode": "^1.75.1",
Expand Down
10 changes: 9 additions & 1 deletion editors/code/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path = require("path");
import * as vscode from "vscode";
import {
Executable,
Expand Down Expand Up @@ -40,8 +41,15 @@ const middleware: Middleware = {
};
let client: LanguageClient;

function serverExecutable() {
const platform = process.platform;
const arch = process.arch;
const exe = platform === 'win32' ? 'asm-lsp.exe' : 'asm-lsp';
return path.join(__dirname, '..', 'bin', `${platform}-${arch}`, exe);
}

export function activate(_: vscode.ExtensionContext) {
const serverPath = process.env.SERVER_PATH;
const serverPath = process.env.SERVER_PATH || serverExecutable();

if (!serverPath) {
vscode.window.showErrorMessage(
Expand Down