Skip to content

Commit 7b27255

Browse files
committed
Move new isVirtualDoc() to better file
1 parent ea2ed68 commit 7b27255

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

apps/vscode/src/vdoc/vdoc-tempfile.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,14 @@ function createVirtualDoc(filepath: string, content: string): void {
150150
function generateVirtualDocFilepath(directory: string, extension: string): string {
151151
return path.join(directory, ".vdoc." + uuid.v4() + "." + extension);
152152
}
153+
154+
export function isVirtualDoc(uri: Uri): boolean {
155+
// Check for tempfile virtual docs
156+
if (uri.scheme === "file") {
157+
const filename = path.basename(uri.fsPath);
158+
// Virtual docs have a specific filename pattern .vdoc.[uuid].[extension]
159+
return filename.startsWith(".vdoc.") && filename.split(".").length > 3;
160+
}
161+
162+
return false;
163+
}

apps/vscode/src/vdoc/vdoc.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import { Position, TextDocument, Uri, Range } from "vscode";
1717
import { Token, isExecutableLanguageBlock, languageBlockAtPosition, languageNameFromBlock } from "quarto-core";
18-
import * as path from "path";
1918

2019
import { isQuartoDoc } from "../core/doc";
2120
import { MarkdownEngine } from "../markdown/engine";
@@ -54,17 +53,6 @@ export async function virtualDoc(
5453
}
5554
}
5655

57-
export function isVirtualDoc(uri: Uri): boolean {
58-
// Check for tempfile virtual docs
59-
if (uri.scheme === "file") {
60-
const filename = path.basename(uri.fsPath);
61-
// Virtual docs have a specific filename pattern .vdoc.[uuid].[extension]
62-
return filename.startsWith(".vdoc.") && filename.split(".").length > 3;
63-
}
64-
65-
return false;
66-
}
67-
6856
export function virtualDocForBlock(document: TextDocument, block: Token, language: EmbeddedLanguage) {
6957
const lines = linesForLanguage(document, language);
7058
fillLinesFromBlock(lines, document, block);

0 commit comments

Comments
 (0)