MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / spawnServer

Method spawnServer

src/languageService.ts:27–52  ·  view source on GitHub ↗
(client: LanguageClient, rPath: string, args: readonly string[], options: CommonOptions & { cwd: string })

Source from the content-addressed store, hash-verified

25 }
26
27 private spawnServer(client: LanguageClient, rPath: string, args: readonly string[], options: CommonOptions & { cwd: string }): DisposableProcess {
28 const childProcess = spawn(rPath, args, options);
29 const pid = childProcess.pid || -1;
30 client.outputChannel.appendLine(`R Language Server (${pid}) started`);
31 childProcess.stderr.on('data', (chunk: Buffer) => {
32 client.outputChannel.appendLine(chunk.toString());
33 });
34 childProcess.on('exit', (code, signal) => {
35 client.outputChannel.appendLine(`R Language Server (${pid}) exited ` +
36 (signal ? `from signal ${signal}` : `with exit code ${code || 'null'}`));
37 if (code !== 0) {
38 if (code === 10) {
39 // languageserver is not installed.
40 void promptToInstallRPackage(
41 'languageserver', 'lsp.promptToInstall', options.cwd,
42 'R package {languageserver} is required to enable R language service features such as code completion, function signature, find references, etc. Do you want to install it?',
43 'You may need to reopen an R file to start the language service after the package is installed.'
44 );
45 } else {
46 client.outputChannel.show();
47 }
48 }
49 void client.stop();
50 });
51 return childProcess;
52 }
53
54 private async createClient(selector: DocumentFilter[],
55 cwd: string, workspaceFolder: WorkspaceFolder | undefined, outputChannel: OutputChannel): Promise<LanguageClient> {

Callers 1

tcpServerOptionsMethod · 0.95

Calls 3

spawnFunction · 0.90
promptToInstallRPackageFunction · 0.90
showMethod · 0.80

Tested by

no test coverage detected