Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const runArgs: string[] = [];
let debugArgs: string[] = [];
if (logLevel === 'verbose') {
debugArgs = ['-d', '--vomit'];
} else if (logLevel === 'messages') {
debugArgs = ['-d'];
}
if (logFile !== '') {
debugArgs = debugArgs.concat(['-l', logFile]);
}
// 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: serverPath, transport: TransportKind.stdio, args: runArgs },
debug: { command: serverPath, transport: TransportKind.stdio, args: debugArgs }
};
// Set a unique name per workspace folder (useful for multi-root workspaces).
const langName = 'Haskell HIE (' + folder.name + ')';
const outputChannel: OutputChannel = window.createOutputChannel(langName);
const clientOptions: LanguageClientOptions = {
// Use the document selector to only notify the LSP on files inside the folder
// path for the specific workspace.
documentSelector: [
{ scheme: 'file', language: 'haskell', pattern: `${folder.uri.fsPath}/**/*` },
{ scheme: 'file', language: 'literate haskell', pattern: `${folder.uri.fsPath}/**/*` }
],
synchronize: {
// Synchronize the setting section 'languageServerHaskell' to the server.
configurationSection: 'languageServerHaskell',
function startClient(dir: string) {
if (clients.has(dir)) {
// Client was already started for this directory
return;
}
let serverPath = 'elm-language-server';
let debugArgs = [
'--server-log-file', 'c:/dev/elm-lsp-log.txt',
'--session-log-file', 'c:/dev/elm-lsp-log-session.txt'
];
// 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: { command: serverPath, args: debugArgs, transport: TransportKind.stdio },
debug: { command: serverPath, args: debugArgs, transport: TransportKind.stdio }
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for Elm documents in the directory
documentSelector: [
{
scheme: 'file', pattern: join(dir, "**", "*.elm")
}
],
// Notify the server about file changes to 'elm.json'
synchronize: {
fileEvents: workspace.createFileSystemWatcher(join(dir, 'elm.json'))
}
};
let logFileLocation = path.join(Utils.getDefaultLogLocation(), Constants.providerId);
serverArgs.push('--log-dir=' + logFileLocation);
serverArgs.push(logFileLocation);
// Enable diagnostic logging in the service if it is configured
let logDebugInfo = config["logDebugInfo"];
if (logDebugInfo) {
serverArgs.push('--enable-logging');
}
}
serverArgs.push('provider=' + Constants.providerId);
// run the service host
return { command: serverCommand, args: serverArgs, transport: TransportKind.stdio };
}
args = args.concat(["--debug", "--logfile", getLogfilePath("language-server-log.txt")])
}
if (!areHotkeysEnabled()){
args = args.concat(["--hotkeys=false"])
}
let serverOptions: ServerOptions = {
run: {
command: serverModule,
transport: TransportKind.stdio,
args: args,
},
debug: {
command: serverModule,
transport: TransportKind.stdio,
args: args,
}
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'yolol' }, { scheme: 'file', language: 'nolol' }],
synchronize: {
// Notify the server about file changes to '.yolol files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.yolol'),
configurationSection: ['yolol','nolol'],
}
};
// Create the language client and start the client.
function startClient(dir: string) {
if (clients.has(dir)) {
// Client was already started for this directory
return;
}
let serverPath = 'elm-language-server';
let debugArgs = [
'--server-log-file', 'c:/dev/elm-lsp-log.txt',
'--session-log-file', 'c:/dev/elm-lsp-log-session.txt'
];
// 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: { command: serverPath, args: debugArgs, transport: TransportKind.stdio },
debug: { command: serverPath, args: debugArgs, transport: TransportKind.stdio }
};
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for Elm documents in the directory
documentSelector: [
{
scheme: 'file', pattern: join(dir, "**", "*.elm")
}
],
// Notify the server about file changes to 'elm.json'
synchronize: {
fileEvents: workspace.createFileSystemWatcher(join(dir, 'elm.json'))
}
};
export function activate(context: ExtensionContext) {
let serverModule = path.join(__dirname, './node_modules/@slonoed/jsref/src/bin.js')
let debugOptions = {execArgv: ['--nolazy', '--inspect=6009']}
let serverOptions: ServerOptions = {
run: {module: serverModule, transport: TransportKind.stdio, args: ['--stdio']},
debug: {
module: serverModule,
args: ['--stdio', '--debug'],
transport: TransportKind.stdio,
options: debugOptions,
},
}
let clientOptions: LanguageClientOptions = {
documentSelector: languages.map(language => ({scheme: 'file', language})),
}
client = new LanguageClient(
'slonoed_jsref',
'JavaScript refactoring language server',
serverOptions,
clientOptions
)
client.start()
};
let serverOptions: ServerOptions = {
run: {
command: serverModule,
transport: TransportKind.stdio
},
debug: {
command: serverModule,
options: {
env: {
G_MESSAGES_DEBUG: 'all',
JSONRPC_DEBUG: 1
}
},
transport: TransportKind.stdio
}
};
this.ls = new LanguageClient('Vala Language Server', serverOptions, clientOptions)
this.ls.start()
}
module.exports.activate = function activate(context) {
let serverModule = path.join(__dirname, '../../bin/jsref.js')
let debugOptions = {execArgv: ['--nolazy', '--inspect=6009']}
let serverOptions = {
run: {
module: serverModule,
transport: TransportKind.stdio,
args: ['--stdio', '--debug', '--lspi'],
},
debug: {
module: serverModule,
args: ['--stdio', '--debug', '--lspi'],
transport: TransportKind.stdio,
options: debugOptions,
},
}
let clientOptions = {
documentSelector: languages.map(language => ({scheme: 'file', language})),
synchronize: {},
}
client = new LanguageClient('jsrefdev', 'jsref dev extension', serverOptions, clientOptions)
synchronize: {
fileEvents: [
workspace.createFileSystemWatcher('**/rebar.config'),
workspace.createFileSystemWatcher('**/rebar.lock')
]
}
};
let serverPath = context.asAbsolutePath(
path.join('erlang_ls', '_build', 'default', 'bin', 'erlang_ls')
);
let serverOptions: ServerOptions = {
command: serverPath,
args: [ "--transport", "stdio" ],
transport: TransportKind.stdio
};
client = new LanguageClient(
'erlang_ls',
'Erlang LS',
serverOptions,
clientOptions
);
client.start();
}