Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
// The server is implemented in node
log.printInfo("Staring XML View language server");
const serverModule = c.asAbsolutePath(path.join("server", "server.js"));
// The debug options for the server
const debugOptions = { storagepath: c.asAbsolutePath("schemastore"), execArgv: ["--nolazy", "--debug=6009"] };
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions },
run: { module: serverModule, transport: TransportKind.ipc },
};
// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for xml decuments documents
diagnosticCollectionName: "xmlDiagnostics",
documentSelector: ["xml", "xsd"],
initializationOptions: { storagepath: c.asAbsolutePath("schemastore") },
synchronize: {
// Synchronize the setting section "languageServerExample" to the server
configurationSection: "ui5ts",
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: workspace.createFileSystemWatcher("**/*.{xml,xsd}", false, false, false),
},
};
export function activate(context: ExtensionContext) {
// The server is implemented in node
let serverModule = context.asAbsolutePath(path.join('server', 'server.js'));
// The debug options for the server
let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] };
// 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 }
}
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: ['lua'],
synchronize: {
// Synchronize the setting section 'languageServerExample' to the server
configurationSection: 'languageServerExample',
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
}
}
// Create the language client and start the client.
let disposable = new LanguageClient('Language Server Example', serverOptions, clientOptions).start();
let serverModule: string;
if (process.env.mode === 'debug') {
serverModule = context.asAbsolutePath(path.join('node_modules', 'intelephense', 'out', 'server.js'));
} else {
serverModule = context.asAbsolutePath(path.join('node_modules', 'intelephense', 'lib', 'intelephense.js'));
}
// The debug options for the server
let debugOptions = {
execArgv: ["--nolazy", "--inspect=6039", "--trace-warnings", "--preserve-symlinks"],
detached: true
};
// 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 }
}
let intelephenseConfig = workspace.getConfiguration('intelephense');
let runtime = intelephenseConfig.get('runtime') as string | undefined;
let memory = Math.floor(Number(intelephenseConfig.get('maxMemory')));
if (runtime) {
serverOptions.run.runtime = runtime;
serverOptions.debug.runtime = runtime;
}
if (memory && memory > 256) {
let maxOldSpaceSize = '--max-old-space-size=' + memory.toString();
serverOptions.run.options = { execArgv: [maxOldSpaceSize] };
serverOptions.debug.options.execArgv.push(maxOldSpaceSize);
export function activate(context: ExtensionContext) {
const serverModule =
context.asAbsolutePath(path.join('out', 'server', 'src', 'main.js'));
const debugOptions = {execArgv: ['--nolazy', '--inspect=6009']};
const serverOptions: ServerOptions = {
run: {module: serverModule, transport: TransportKind.ipc},
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
};
const clientOptions: LanguageClientOptions = {
// TODO(b/169611573): Configure the document selector to whistle language.
// Configure it in package.json and client/package.json as well.
documentSelector: [{scheme: 'file', language: 'plaintext'}],
synchronize: {
configurationSection: 'whistleLanguageClient',
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
}
};
// We need to go one level up since an extension compile the js code into
// the output folder.
// serverModule
const serverModule = context.asAbsolutePath(path.join('server', 'out', 'eslintServer.js'));
const eslintConfig = Workspace.getConfiguration('eslint');
const runtime = eslintConfig.get('runtime', undefined);
const debug = eslintConfig.get('debug');
let env: { [key: string]: string | number | boolean } | undefined;
if (debug) {
env = {
DEBUG: 'eslint:*,-eslint:code-path'
};
}
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc, runtime, options: { cwd: process.cwd(), env } },
debug: { module: serverModule, transport: TransportKind.ipc, runtime, options: { execArgv: ['--nolazy', '--inspect=6011'], cwd: process.cwd(), env } }
};
let defaultErrorHandler: ErrorHandler;
let serverCalledProcessExit: boolean = false;
const packageJsonFilter: DocumentFilter = { scheme: 'file', pattern: '**/package.json' };
const configFileFilter: DocumentFilter = { scheme: 'file', pattern: '**/.eslintr{c.js,c.yaml,c.yml,c,c.json}' };
const syncedDocuments: Map = new Map();
Workspace.onDidChangeConfiguration(() => {
probeFailed.clear();
for (const textDocument of syncedDocuments.values()) {
if (computeValidate(textDocument) === Validate.off) {
syncedDocuments.delete(textDocument.uri.toString());
client.sendNotification(DidCloseTextDocumentNotification.type, client.code2ProtocolConverter.asCloseTextDocumentParams(textDocument));
if (process.env.mode === 'debug') {
serverModule = context.asAbsolutePath(path.join('node_modules', 'intelephense', 'out', 'server.js'));
} else {
serverModule = context.asAbsolutePath(path.join('node_modules', 'intelephense', 'lib', 'intelephense.js'));
}
// The debug options for the server
let debugOptions = {
execArgv: ["--nolazy", "--inspect=6039", "--trace-warnings", "--preserve-symlinks"],
detached: true
};
// 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 }
}
let intelephenseConfig = workspace.getConfiguration('intelephense');
let runtime = intelephenseConfig.get('runtime') as string | undefined;
let memory = Math.floor(Number(intelephenseConfig.get('maxMemory')));
if (runtime) {
serverOptions.run.runtime = runtime;
serverOptions.debug.runtime = runtime;
}
if (memory && memory > 256) {
let maxOldSpaceSize = '--max-old-space-size=' + memory.toString();
serverOptions.run.options = { execArgv: [maxOldSpaceSize] };
serverOptions.debug.options.execArgv.push(maxOldSpaceSize);
}
export function activate(context: ExtensionContext) {
// 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
}
};
// 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')
}
};
// Create the language client and start the client.
client = new LanguageClient(
new XmlFormattingEditProvider()
)
)
context.subscriptions.push(
vscode.languages.registerDocumentFormattingEditProvider(
{ scheme: 'mlquery', language: 'xsl' },
new XmlFormattingEditProvider()
)
)
// XQuery hinting client below
const serverModule = context.asAbsolutePath(path.join('server', 'dist', 'server.js'))
const debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] }
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
}
const clientOptions: LanguageClientOptions = {
documentSelector: [
{ language: 'xquery-ml', scheme: 'file' },
{ language: 'xquery-ml', scheme: 'untitled' },
{ language: 'javascript', scheme: 'file' },
{ language: 'javascript', scheme: 'untitled' }
],
synchronize: {
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc')
}
}
const disposable = new LanguageClient('xQueryLanguageServer', 'XQuery Language Server', serverOptions, clientOptions).start()
context.subscriptions.push(disposable)
}
'salesforcedx-visualforce-language-server',
'out',
'src',
'visualforceServer.js'
)
);
// The debug options for the server
const debugOptions = { execArgv: ['--nolazy', '--inspect=6004'] };
// If the extension is launch in debug mode the debug server options are use
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions
}
};
const documentSelector = [
{
language: 'visualforce',
scheme: 'file'
}
];
const embeddedLanguages = { css: true, javascript: true };
// Options to control the language client
const clientOptions: LanguageClientOptions = {
documentSelector,
synchronize: {