MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / openManagedFile

Method openManagedFile

src/main.ts:385–412  ·  view source on GitHub ↗
(file: TFile)

Source from the content-addressed store, hash-verified

383 }
384
385 async openManagedFile(file: TFile): Promise<void> {
386 const nativeBinaryExtensions = [
387 'png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'ico', 'tiff', 'psd',
388 'pdf',
389 'mp3', 'wav', 'ogg', 'flac', 'aac', 'm4a', 'wma',
390 'mp4', 'avi', 'mkv', 'mov', 'wmv', 'flv', 'webm', 'm4v',
391 'zip', 'rar', '7z', 'tar', 'gz', 'bz2', 'xz',
392 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx',
393 'exe', 'dll', 'so', 'dylib', 'bin', 'dat'
394 ];
395
396 const ext = file.extension.toLowerCase();
397 const leaf = this.app.workspace.getLeaf(true);
398
399 if (nativeBinaryExtensions.includes(ext)) {
400 await leaf.openFile(file);
401 } else {
402 await leaf.setViewState({
403 type: VIEW_TYPE_CODE_SPACE,
404 active: true,
405 state: { file: file.path }
406 });
407
408 await this.updateOutline(file);
409 }
410
411 await this.app.workspace.revealLeaf(leaf);
412 }
413
414 private async handleIgnoredPathRename(file: TFile | TFolder, oldPath: string): Promise<void> {
415 const normalizedOldPath = this.normalizeIgnoredPath(oldPath);

Callers 2

openIgnoredFileMethod · 0.80
openFileMethod · 0.80

Calls 2

updateOutlineMethod · 0.95
openFileMethod · 0.80

Tested by

no test coverage detected