* Adds a file to the manager's file list and updates the UI. * @param {File} file - The file to be added.
(file)
| 2220 | * @param {File} file - The file to be added. |
| 2221 | */ |
| 2222 | function addFile(file) { |
| 2223 | if (manager.files.includes(file)) return; |
| 2224 | const insertAt = file.pinned |
| 2225 | ? getPinnedInsertIndex() |
| 2226 | : manager.files.length; |
| 2227 | manager.files.splice(insertAt, 0, file); |
| 2228 | syncOpenFileList(); |
| 2229 | if (!manager.activeFile) { |
| 2230 | $header.text = file.name; |
| 2231 | } |
| 2232 | toggleProblemButton(); |
| 2233 | } |
| 2234 | |
| 2235 | function getPinnedInsertIndex(skipFile = null) { |
| 2236 | return manager.files.reduce((count, file) => { |
nothing calls this directly
no test coverage detected