MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / openFile

Function openFile

src/test/helpers.ts:535–549  ·  view source on GitHub ↗
(file: vs.Uri, column?: vs.ViewColumn)

Source from the content-addressed store, hash-verified

533}
534
535export async function openFile(file: vs.Uri, column?: vs.ViewColumn): Promise<vs.TextEditor> {
536 logger.info(`Opening ${fsPath(file)}`);
537 const doc = await vs.workspace.openTextDocument(file);
538 documentEol = doc.eol === vs.EndOfLine.CRLF ? "\r\n" : "\n";
539 logger.info(`Showing ${fsPath(file)}`);
540 try {
541 return await vs.window.showTextDocument(doc, { viewColumn: column, preview: false });
542 } catch (e) {
543 logger.warn(`Failed to show ${fsPath(file)} on first attempt, trying again...`, LogCategory.CI);
544 logger.warn(e, LogCategory.CI);
545 return await vs.window.showTextDocument(doc, { viewColumn: column, preview: false });
546 } finally {
547 await delay(50);
548 }
549}
550
551export function tryDelete(item: string | vs.Uri) {
552 if (typeof item !== "string") {

Calls 4

fsPathFunction · 0.90
delayFunction · 0.85
infoMethod · 0.65
warnMethod · 0.65

Tested by 6

runWithoutDebuggingFunction · 0.72
testBreakpointConditionFunction · 0.72
verifySampleLinkFunction · 0.72
testBreakpointConditionFunction · 0.72