feat: 增加了analyzer, compiler不再分析并且报错, 只生产 bytecode, analyzer作为前端结束最后一道防线检查代码,同时引入一个简单的LSP
This commit is contained in:
@@ -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