From b632252966b23a98eea561fdeb45df62daf9872b Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Wed, 8 May 2024 19:38:59 -0600 Subject: [PATCH] Fix some whitespace --- .../src/providers/preview/preview-util.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/vscode/src/providers/preview/preview-util.ts b/apps/vscode/src/providers/preview/preview-util.ts index 03b46353..29966e80 100644 --- a/apps/vscode/src/providers/preview/preview-util.ts +++ b/apps/vscode/src/providers/preview/preview-util.ts @@ -61,27 +61,27 @@ export function isQuartoShinyKnitrDoc( export async function isRPackage() { const descriptionLines = await parseRPackageDescription(); - const packageLines = descriptionLines.filter(line => line.startsWith('Package:')); - const typeLines = descriptionLines.filter(line => line.startsWith('Type:')); - const typeIsPackage = (typeLines.length > 0 - ? typeLines[0].toLowerCase().includes('package') - : false); - const typeIsPackageOrMissing = typeLines.length === 0 || typeIsPackage; - return packageLines.length > 0 && typeIsPackageOrMissing; + const packageLines = descriptionLines.filter(line => line.startsWith('Package:')); + const typeLines = descriptionLines.filter(line => line.startsWith('Type:')); + const typeIsPackage = (typeLines.length > 0 + ? typeLines[0].toLowerCase().includes('package') + : false); + const typeIsPackageOrMissing = typeLines.length === 0 || typeIsPackage; + return packageLines.length > 0 && typeIsPackageOrMissing; } async function parseRPackageDescription(): Promise { - if (vscode.workspace.workspaceFolders !== undefined) { - const folderUri = vscode.workspace.workspaceFolders[0].uri; - const fileUri = vscode.Uri.joinPath(folderUri, 'DESCRIPTION'); - try { - const bytes = await vscode.workspace.fs.readFile(fileUri); - const descriptionText = Buffer.from(bytes).toString('utf8'); - const descriptionLines = descriptionText.split(/(\r?\n)/); - return descriptionLines; - } catch { } - } - return ['']; + if (vscode.workspace.workspaceFolders !== undefined) { + const folderUri = vscode.workspace.workspaceFolders[0].uri; + const fileUri = vscode.Uri.joinPath(folderUri, 'DESCRIPTION'); + try { + const bytes = await vscode.workspace.fs.readFile(fileUri); + const descriptionText = Buffer.from(bytes).toString('utf8'); + const descriptionLines = descriptionText.split(/(\r?\n)/); + return descriptionLines; + } catch { } + } + return ['']; } export async function renderOnSave(engine: MarkdownEngine, document: TextDocument) {