Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@
"type": "string"
},
"default": [],
"markdownDescription": "Additional library paths to launch R background processes (R languageserver, help server, etc.). These paths will be appended to `.libPaths()` on process startup. It could be useful for projects with [renv](https://rstudio.github.io/renv/index.html) enabled. `${workspaceFolder}` and `${home}` could be used in the paths."
"markdownDescription": "Additional library paths to launch R background processes (R languageserver, help server, etc.). These paths will be appended to `.libPaths()` on process startup. It could be useful for projects with [renv](https://rstudio.github.io/renv/index.html) enabled."
},
"r.lsp.enabled": {
"type": "boolean",
Expand Down
4 changes: 2 additions & 2 deletions src/helpViewer/helpProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class HelpProvider {
cwd: this.cwd,
env: {
...process.env,
VSCR_LIB_PATHS: getRLibPaths(this.cwd),
VSCR_LIB_PATHS: getRLibPaths(),
VSCR_LIM: lim
},
};
Expand Down Expand Up @@ -276,7 +276,7 @@ export class AliasProvider {
cwd: this.cwd,
env: {
...process.env,
VSCR_LIB_PATHS: getRLibPaths(this.cwd),
VSCR_LIB_PATHS: getRLibPaths(),
VSCR_LIM: lim
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/languageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class LanguageService implements Disposable {
const use_stdio = config.get<boolean>('lsp.use_stdio');
const env = Object.create(process.env);
env.VSCR_LSP_DEBUG = debug ? 'TRUE' : 'FALSE';
env.VSCR_LIB_PATHS = getRLibPaths(workspaceFolder?.uri.fsPath || cwd);
env.VSCR_LIB_PATHS = getRLibPaths();

const lang = config.get<string>('lsp.lang');
if (lang !== '') {
Expand Down Expand Up @@ -190,7 +190,7 @@ export class LanguageService implements Disposable {
const client = await self.createClient(config, documentSelector,
path.dirname(document.uri.fsPath), folder, outputChannel);
if (client) {
client.start();
extensionContext.subscriptions.push(client.start());
self.clients.set(key, client);
}
self.initSet.delete(key);
Expand All @@ -211,7 +211,7 @@ export class LanguageService implements Disposable {
];
const client = await self.createClient(config, documentSelector, folder.uri.fsPath, folder, outputChannel);
if (client) {
client.start();
extensionContext.subscriptions.push(client.start());
self.clients.set(key, client);
}
self.initSet.delete(key);
Expand All @@ -230,7 +230,7 @@ export class LanguageService implements Disposable {
];
const client = await self.createClient(config, documentSelector, os.homedir(), undefined, outputChannel);
if (client) {
client.start();
extensionContext.subscriptions.push(client.start());
self.clients.set(key, client);
}
self.initSet.delete(key);
Expand All @@ -249,7 +249,7 @@ export class LanguageService implements Disposable {
const client = await self.createClient(config, documentSelector,
path.dirname(document.uri.fsPath), undefined, outputChannel);
if (client) {
client.start();
extensionContext.subscriptions.push(client.start());
self.clients.set(key, client);
}
self.initSet.delete(key);
Expand Down
10 changes: 2 additions & 8 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { existsSync, PathLike, readFile } from 'fs-extra';
import * as fs from 'fs';
import os = require('os');
import winreg = require('winreg');
import * as path from 'path';
import * as vscode from 'vscode';
Expand Down Expand Up @@ -297,13 +296,8 @@ export async function getCranUrl(path: string = '', cwd?: string): Promise<strin
return url;
}

export function getRLibPaths(cwd: string): string {
return config().get<string[]>('libPaths')
.map(dir => dir
.replace('${workspaceFolder}', cwd)
.replace('${home}', os.homedir())
)
.join('\n');
export function getRLibPaths(): string {
return config().get<string[]>('libPaths').join('\n');
}

// executes an R command returns its output to stdout
Expand Down