MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / substituteVariables

Function substituteVariables

src/util.ts:28–42  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

26}
27
28export function substituteVariables(str: string): string {
29 let result = str;
30 if (str.includes('${')) {
31 result = substituteVariable(result, '${userHome}', () => homedir());
32 result = substituteVariable(result, '${workspaceFolder}', () => getCurrentWorkspaceFolder()?.uri.fsPath);
33 result = substituteVariable(result, '${fileWorkspaceFolder}', () => getActiveFileWorkspaceFolder()?.uri.fsPath);
34 result = substituteVariable(result, '${fileDirname}', () => {
35 const activeFilePath = vscode.window.activeTextEditor?.document.uri.fsPath;
36 if (activeFilePath) {
37 return path.dirname(activeFilePath);
38 }
39 });
40 }
41 return result;
42}
43
44function getRfromEnvPath(platform: string) {
45 let splitChar = ':';

Callers 2

getRpathFunction · 0.85
getRtermFunction · 0.85

Calls 3

substituteVariableFunction · 0.85

Tested by

no test coverage detected