This commit is contained in:
nub31
2025-10-23 17:55:21 +02:00
parent a5ac25dcae
commit babafb4d34
7 changed files with 75 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
dotnet publish -c Release ../compiler/NubLang.LSP/NubLang.LSP.csproj
cp ../compiler/NubLang.LSP/bin/Release/net9.0/linux-x64/publish/nublsp src/server/
cp ../compiler/NubLang.LSP/bin/Release/net9.0/linux-x64/publish/nublsp server/

View File

@@ -31,7 +31,23 @@
"scopeName": "source.nub",
"path": "./syntaxes/nub.tmLanguage.json"
}
]
],
"commands": [
{
"command": "nub.openOutput",
"title": "Nub: Show Output",
"icon": "$(open-preview)"
}
],
"menus": {
"editor/title": [
{
"command": "nub.openOutput",
"when": "editorLangId == nub || resourceExtname == .nub",
"group": "navigation"
}
]
}
},
"scripts": {
"build": "tsc -p ./",

Binary file not shown.

View File

@@ -1,10 +1,10 @@
import path from 'path';
import { workspace, ExtensionContext, window, Uri, commands, StatusBarAlignment, ViewColumn } from 'vscode';
import vscode from 'vscode';
import { LanguageClient, TransportKind } from 'vscode-languageclient/node';
let client: LanguageClient;
export function activate(context: ExtensionContext) {
export function activate(context: vscode.ExtensionContext) {
const serverExecutable = path.join(context.asAbsolutePath('server'), "nublsp");
client = new LanguageClient(
@@ -27,16 +27,17 @@ export function activate(context: ExtensionContext) {
{ scheme: 'file', pattern: '**/*.nub' }
],
synchronize: {
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc')
}
}
);
let outputMap: Map<string, string> = new Map();
client.onNotification("nub/output", (params: { path: string, content: string }) => {
});
vscode.commands.registerCommand('nub.openOutput', async () => {
client.onNotification("nub/output", (params) => {
const virtualUri = Uri.parse(`nub://${params.uri}`);
outputMap.set(virtualUri.toString(), params.content);
});
client.start();
@@ -46,5 +47,6 @@ export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}
}