Commit 457366a1 authored by eckhart's avatar eckhart

some git cleanup

parent 938ccdaf
......@@ -15,6 +15,8 @@ testdata/*.pdf
*.old
DEBUG*
LOGS
**/LOGS/*
**/LOG*
**/REPORT/*
REPORT
external_resources/
......@@ -46,3 +48,4 @@ OLDSTUFF
*.c
*.pyd
docs/*
**/node_modules
\ No newline at end of file
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import * as net from 'net';
import { workspace, commands, Disposable, ExtensionContext, OutputChannel } from 'vscode';
import * as WebSocket from 'ws';
// import * as path from 'path';
// function startLangServer(command: string): Disposable {
// const serverOptions: ServerOptions = {
// command: command,
// };
// const clientOptions: LanguageClientOptions = {
// documentSelector: [{scheme: 'file', language: 'json'}],
// };
// return new LanguageClient(command, serverOptions, clientOptions).start();
// }
let language: string = "json";
let defaultPort: number = 8888;
function startLangServerTCP(addr: number) : Disposable {
const serverOptions: ServerOptions = function() {
return new Promise((resolve, reject) => {
console.log('creating connection');
var client = new net.Socket();
client.connect(addr, "127.0.0.1", function() {
resolve({
reader: client,
writer: client
});
});
});
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{scheme: 'file', language: language}],
// synchronize: {
// // Notify the server about file changes to '.clientrc files contained in the workspace
// fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
// }
};
return new LanguageClient(`tcp lang server (port ${addr})`,
serverOptions, clientOptions).start();
}
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from 'vscode-languageclient';
export function activate(context: ExtensionContext) {
// context.subscriptions.push(startLangServer("langserver-python", ["python"]));
// When developing JS/TS, set {"typescript.tsdk": "/dev/null"} in your user settings in the
// new VSCode window opened via `npm run vscode`.
// const socketPort = workspace.getConfiguration('').get('port', 7000)
console.log('activating language server connector!');
context.subscriptions.push(startLangServerTCP(defaultPort));
}
// let client: LanguageClient;
// export function activate(context: ExtensionContext) {
// // Create the language client and start the client.
// client = new LanguageClient(
// 'languageServerExample',
// 'Language Server Example',
// 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();
// }
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import * as path from 'path';
import { workspace, commands, ExtensionContext, OutputChannel } from 'vscode';
import * as WebSocket from 'ws';
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from 'vscode-languageclient';
let client: LanguageClient;
export function activate(context: ExtensionContext) {
const socketPort = workspace.getConfiguration('languageServerExample').get('port', 7000);
let socket: WebSocket | null = null;
commands.registerCommand('languageServerExample.startStreaming', () => {
// Establish websocket connection
socket = new WebSocket(`ws://localhost:${socketPort}`);
});
// The server is implemented in node
let serverModule = context.asAbsolutePath(
path.join('server', 'out', 'server.js')
);
// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
let debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
let serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
};
// The log to send
let log = '';
const websocketOutputChannel: OutputChannel = {
name: 'websocket',
// Only append the logs but send them later
append(value: string) {
log += value;
console.log(value);
},
appendLine(value: string) {
log += value;
// Don't send logs until WebSocket initialization
if (socket && socket.readyState === WebSocket.OPEN) {
socket.send(log);
}
log = '';
},
clear() {},
show() {},
hide() {},
dispose() {}
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'plaintext' }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
},
// Hijacks all LSP logs and redirect them to a specific port through WebSocket connection
outputChannel: websocketOutputChannel
};
// Create the language client and start the client.
client = new LanguageClient(
'languageServerExample',
'Language Server Example',
serverOptions,
clientOptions
);
// Start the client. This will also launch the server
client.start();
}
export function deactivate(): Thenable<void> {
if (!client) {
return undefined;
}
return client.stop();
}
127.0.0.1 8888
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment