MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / getDefaultUri

Method getDefaultUri

src/notebooks/export/exportDialog.ts:69–89  ·  view source on GitHub ↗
(source: Uri | undefined, targetFileName: string)

Source from the content-addressed store, hash-verified

67 }
68
69 private async getDefaultUri(source: Uri | undefined, targetFileName: string): Promise<Uri | undefined> {
70 if (source && source.scheme === 'untitled' && isWebExtension()) {
71 // Force using simple file dialog
72 return undefined;
73 }
74
75 if (
76 !source ||
77 source.scheme === 'file' ||
78 source.scheme === 'untitled' ||
79 source.scheme === 'vscode-interactive'
80 ) {
81 // Just combine the working directory with the file
82 const workspaceService = ServiceContainer.instance.get<IWorkspaceService>(IWorkspaceService);
83 return Uri.file(path.join(await workspaceService.computeWorkingDirectory(source), targetFileName));
84 }
85
86 // Otherwise split off the end of the path and combine it with the target file name
87 const newPath = path.join(path.dirname(source.path), targetFileName);
88 return Uri.parse(`${source.scheme}://${newPath}`).with({ authority: source.authority });
89 }
90}

Callers 1

showDialogMethod · 0.95

Calls 8

isWebExtensionFunction · 0.90
joinMethod · 0.80
getMethod · 0.65
dirnameMethod · 0.65
parseMethod · 0.65
fileMethod · 0.45
withMethod · 0.45

Tested by

no test coverage detected