Workspace › getActiveFile
Official
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 — The file, or null if there is none.