kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/typescript/languageserver/vscode-extension/src/extension.ts (about) 1 /* 2 * Copyright 2017 The Kythe Authors. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import {join} from 'path'; 18 import {Disposable, ExtensionContext, window, workspace} from 'vscode'; 19 import {LanguageClient, LanguageClientOptions, ServerOptions, TransportKind} from 'vscode-languageclient'; 20 21 22 // This method is called when the extension is activated 23 export function activate(context: ExtensionContext) { 24 const debugOptions = {execArgv: ['--nolazy', '--debug=6004']}; 25 const settings = workspace.getConfiguration('kytheLanguageServer'); 26 27 const serverOptions: ServerOptions = { 28 command: settings.get('bin') || 'kythe_languageserver', 29 args: settings.get('args'), 30 }; 31 32 const clientOptions: LanguageClientOptions = { 33 // Activate on all files and defer to the server to ignore stuff 34 documentSelector: [{pattern: '**/*'}] 35 } 36 37 const disposable = new LanguageClient( 38 'kytheLanguageServer', 'Kythe Language Server', 39 serverOptions, clientOptions) 40 .start(); 41 42 context.subscriptions.push(disposable); 43 }