Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions editor/vscode/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
package-lock.json
yarn.lock
out/
29 changes: 29 additions & 0 deletions editor/vscode/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "tsls",
"description": "Tree-sitter based language server",
"author": "Keyv Chan",
"license": "Apatcha 2",
"version": "0.0.1",
"publisher": "vscode",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-extension-samples"
},
"engines": {
"vscode": "^1.63.0"
},
"dependencies": {
"@types/node": "^17.0.21",
"typescript": "^4.6.2",
"vsce": "^2.6.7",
"vscode-languageclient": "^7.0.0"
},
"main": "./out/extension.js",
"activationEvents": [
"onLanguage:c"
],
"devDependencies": {
"@types/vscode": "^1.63.0",
"@vscode/test-electron": "^2.1.2"
}
}
54 changes: 54 additions & 0 deletions editor/vscode/client/src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import { workspace, ExtensionContext } from 'vscode';
import * as vscode from 'vscode';

import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
} from 'vscode-languageclient/node';

let client: LanguageClient;

export function activate(context: ExtensionContext) {

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: {command: "/Users/keyv/Codebases/ClionProjects/tsls/target/debug/tsls"},
debug: {command:"/Users/keyv/Codebases/ClionProjects/tsls/target/debug/tsls"}
};

// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'c' }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
},
traceOutputChannel: vscode.window.createOutputChannel('tsls')
};

// Create the language client and start the client.
client = new LanguageClient(
'tsls',
'TSLS',
serverOptions,
clientOptions
);

// Start the client. This will also launch the server
client.start();
}

export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}
12 changes: 12 additions & 0 deletions editor/vscode/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"lib": ["es2020"],
"outDir": "out",
"rootDir": "src",
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules", ".vscode-test"]
}
2 changes: 1 addition & 1 deletion parsers/tree-sitter-query