support client trace.

This commit is contained in:
ykiko
2024-07-06 23:30:29 +08:00
parent 892da7cffa
commit 851e3a0d44
2 changed files with 18 additions and 10 deletions

View File

@@ -12,8 +12,18 @@
"activationEvents": [
"onLanguage:cpp"
],
"contributes": {
"configuration": {
"type": "object",
"title": "C/C++ Language Client",
"properties": {
"clice-client.trace.server": {
"default": "verbose"
}
}
}
},
"main": "./dist/extension.js",
"contributes": {},
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "webpack",

View File

@@ -1,10 +1,10 @@
import * as path from 'path';
import { workspace, window, ExtensionContext, OutputChannel } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, Trace ,TransportKind } from 'vscode-languageclient/node';
import { LanguageClient, LanguageClientOptions, ServerOptions, Trace, TransportKind } from 'vscode-languageclient/node';
let client: LanguageClient;
export function activate(context: ExtensionContext) {
export async function activate(context: ExtensionContext) {
console.log('Congratulations, your extension "clice" is now active!');
let channel = window.createOutputChannel('clice');
@@ -14,29 +14,27 @@ export function activate(context: ExtensionContext) {
const serverOptions: ServerOptions = {
run: { command: serverPath, args: [] },
debug: { command: serverPath, args: ['--inspect=6009'] }
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ scheme: 'file', language: 'cpp' }],
traceOutputChannel: channel,
//outputChannel: channel,
// outputChannel: channel,
synchronize: {
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
},
};
client = new LanguageClient(
'languageServerExample',
'Language Server Example',
'clice-client',
'client for clice language server',
serverOptions,
clientOptions
);
client.onTelemetry(e => {
console.log(e);
});
client.start();
}