Workspace โ€บ getActiveFile

Workspace.getActiveFile() method

Returns the file for the current view if itโ€™s a FileView. Otherwise, it will return the most recently active file.

Signature:

getActiveFile(): TFile | null;

Returns:

TFile | null