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

Function createLintrConfig

src/lintrConfig.ts:8–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { executeRCommand, getCurrentWorkspaceFolder } from './util';
7
8export async function createLintrConfig(): Promise<string | undefined> {
9 const currentWorkspaceFolder = getCurrentWorkspaceFolder()?.uri.fsPath;
10 if (currentWorkspaceFolder === undefined) {
11 void window.showWarningMessage('Please open a workspace folder to create .lintr');
12 return;
13 }
14 const lintrFilePath = join(currentWorkspaceFolder, '.lintr');
15 if (existsSync(lintrFilePath)) {
16 const overwrite = await window.showWarningMessage(
17 '".lintr" file already exists. Do you want to overwrite?',
18 'Yes', 'No'
19 );
20 if (overwrite === 'No') {
21 return;
22 }
23 void unlinkSync(lintrFilePath);
24 }
25 return await executeRCommand(`lintr::use_lintr()`, currentWorkspaceFolder, (e: Error) => {
26 void window.showErrorMessage(e.message);
27 return '';
28 });
29}

Callers

nothing calls this directly

Calls 2

executeRCommandFunction · 0.90

Tested by

no test coverage detected