(echo: boolean)
| 16 | export let rTerm: vscode.Terminal | undefined = undefined; |
| 17 | |
| 18 | export 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 | |
| 44 | export async function runSelection(): Promise<void> { |
| 45 | await runSelectionInTerm(true); |
nothing calls this directly
no test coverage detected