feat: 增加了analyzer, compiler不再分析并且报错, 只生产 bytecode, analyzer作为前端结束最后一道防线检查代码,同时引入一个简单的LSP
This commit is contained in:
BIN
Fig-VSCode/bin/Fig-LSP.exe
Normal file
BIN
Fig-VSCode/bin/Fig-LSP.exe
Normal file
Binary file not shown.
3156
Fig-VSCode/package-lock.json
generated
3156
Fig-VSCode/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,21 @@
|
||||
{
|
||||
"name": "fig-vscode",
|
||||
"displayName": "Fig Language",
|
||||
"description": "VSCode extension for Fig language with syntax highlighting",
|
||||
"description": "VSCode extension for Fig language with syntax highlighting and lsp support",
|
||||
"version": "0.5.0",
|
||||
"publisher": "PuqiAR",
|
||||
"engines": {
|
||||
"vscode": "^1.90.0"
|
||||
"vscode": "^1.108.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"repository": {
|
||||
"url":"https://github.com/PuqiAR/Fig"
|
||||
"url": "https://github.com/PuqiAR/Fig"
|
||||
},
|
||||
"activationEvents": [],
|
||||
"activationEvents": [
|
||||
"onLanguage:fig"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"languages": [
|
||||
@@ -33,14 +35,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"semanticTokenModifiers": [
|
||||
{
|
||||
"fig": {
|
||||
"variable": "variable.other.fig",
|
||||
"function": "entity.name.function.fig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "fig",
|
||||
@@ -56,9 +50,13 @@
|
||||
"pretest": "npm run compile",
|
||||
"test": "node ./out/test/runTest.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.2.2",
|
||||
"vscode": "^1.90.0",
|
||||
"@types/node": "^20.6.0"
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "^20.6.0",
|
||||
"@types/vscode": "^1.108.0",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,44 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { ExtensionContext, workspace } from 'vscode';
|
||||
import {
|
||||
LanguageClient,
|
||||
LanguageClientOptions,
|
||||
ServerOptions
|
||||
} from 'vscode-languageclient/node';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log('Fig extension is now active!');
|
||||
let client: LanguageClient;
|
||||
|
||||
export function activate(context: ExtensionContext) {
|
||||
const exeName = process.platform === 'win32' ? 'Fig-LSP.exe' : 'Fig-LSP';
|
||||
|
||||
// 获取插件安装后的绝对沙箱路径
|
||||
const serverCommand = context.asAbsolutePath(path.join('bin', exeName));
|
||||
|
||||
const serverOptions: ServerOptions = {
|
||||
run: { command: serverCommand, args: [] },
|
||||
debug: { command: serverCommand, args: [] }
|
||||
};
|
||||
|
||||
const clientOptions: LanguageClientOptions = {
|
||||
documentSelector: [{ scheme: 'file', language: 'fig' }],
|
||||
synchronize: {
|
||||
fileEvents: workspace.createFileSystemWatcher('**/*.fig')
|
||||
}
|
||||
};
|
||||
|
||||
client = new LanguageClient(
|
||||
'figLanguageServer',
|
||||
'Fig Language Server',
|
||||
serverOptions,
|
||||
clientOptions
|
||||
);
|
||||
|
||||
client.start();
|
||||
}
|
||||
|
||||
export function deactivate() {}
|
||||
export function deactivate(): Thenable<void> | undefined {
|
||||
if (!client) {
|
||||
return undefined;
|
||||
}
|
||||
return client.stop();
|
||||
}
|
||||
Reference in New Issue
Block a user