()
| 16 | /// Gets the "active" file:// TextEditor, excluding any output: panes that |
| 17 | /// might be in the list. |
| 18 | export function getActiveRealFileEditor(): vs.TextEditor | undefined { |
| 19 | let editor = vs.window.activeTextEditor; |
| 20 | // It's possible the "active editor" is actually an Output pane, so |
| 21 | // try falling back to a single visible (file-scheme) editor if there is one. |
| 22 | if (editor?.document.uri.scheme !== "file") { |
| 23 | const fileEditors = vs.window.visibleTextEditors.filter((e) => e.document.uri.scheme === "file"); |
| 24 | if (fileEditors.length === 1) { |
| 25 | console.log(`Falling back from ${editor?.document.uri} to ${fileEditors[0].document.uri}`); |
| 26 | editor = fileEditors[0]; |
| 27 | } |
| 28 | } |
| 29 | return editor?.document.uri.scheme === "file" |
| 30 | ? editor |
| 31 | : undefined; |
| 32 | } |
| 33 | |
| 34 | export function findVisibleEditor(uri: URI) { |
| 35 | const uriKey = uriComparisonString(uri); |
no test coverage detected