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

Function runSource

src/rTerminal.ts:18–42  ·  view source on GitHub ↗
(echo: boolean)

Source from the content-addressed store, hash-verified

16export let rTerm: vscode.Terminal | undefined = undefined;
17
18export async function runSource(echo: boolean): Promise<void> {
19 const wad = vscode.window.activeTextEditor?.document;
20 if (!wad) {
21 return;
22 }
23 const isSaved = await util.saveDocument(wad);
24 if (!isSaved) {
25 return;
26 }
27 let rPath: string = util.ToRStringLiteral(wad.fileName, '"');
28 let encodingParam = util.config().get<string>('source.encoding');
29 if (encodingParam === undefined) {
30 return;
31 }
32 encodingParam = `encoding = "${encodingParam}"`;
33 const echoParam = util.config().get<boolean>('source.echo');
34 rPath = [rPath, encodingParam].join(', ');
35 if (echoParam) {
36 echo = true;
37 }
38 if (echo) {
39 rPath = [rPath, 'echo = TRUE'].join(', ');
40 }
41 void runTextInTerm(`source(${rPath})`);
42}
43
44export async function runSelection(): Promise<void> {
45 await runSelectionInTerm(true);

Callers

nothing calls this directly

Calls 2

runTextInTermFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected