Repository navigation
Conversation
The editor's file can be saved under a new name or folder on either side. The path starts in the folder that side's list is showing; an existing file is replaced only after asking; a missing folder is reported. The editor then follows the copy, so the next Save goes there. VS Code: mpftp: Save As... in the editor title bar and context menu. A board file's temp mapping moves to the new board path, or ends when the copy is saved to this computer. Its path rules live in saveAs.ts with node:test unit tests, now run in CI. Browser: a Save As button (Ctrl+Shift+S) and dialog; panel.py's save_file_as mirrors the extension's checks.
# Conflicts: # cli/src/mpftp/webui/app.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Save As now offers both destinations: this computer and the board.
What you can do. With a file open in the editor, Save As asks where to put it, This computer or Board (the board only while one is connected). It starts on the side the file came from. The path starts as that side's list folder plus the file's name, so you can browse to a folder in the File Transfer panel and Save As lands there; you can edit it. An existing file is replaced only after you say so. The folder has to exist, because the board's write doesn't create folders, so a missing one is reported and nothing is written. Afterwards the editor follows the copy: its tab, side and path change, the next Save goes there, and the original is left as it was. The destination list redraws so the new file shows.
VS Code. A new command, mpftp: Save As…, sits in the editor title bar (save-as icon) and the editor's right-click menu, for any file, local or a board file's temp copy. It asks the side with a QuickPick and the path with an InputBox. For a board file, Save As to the board moves the temp mapping to the new board path. Save As to this computer makes it a plain local file that no longer pushes to the board. VS Code's own Save As is unchanged. The path rules and the rebinding are in
extension/src/saveAs.ts, which doesn't use the VS Code API, sonpm test(node:test) covers them. CI now runs that step too.Browser (
python -m mpftp). There's a Save As button beside Save (Ctrl+Shift+S). Its dialog is styled like the others and uses the theme variables.panel.py's newsaveFileAsmessage makes the same checks as the extension. The page passes the lists' folders through from the panel's state. A smaller fix while there: the page's Ctrl+S handler now skips keys the editor has already handled, so Ctrl+S in the editor saves once rather than twice.Tested
cli/tests/test_panel.py: 8 new Save As cases (other board folder, relative paths, replace/cancel, same file, missing folder, folder as target, between sides, disconnected).extension:npm test, 7 cases for path resolution and temp-mapping rebinding. A planted fault (the old mapping not removed) fails 2 of them.Not tested: the VS Code command in a real VS Code window: the QuickPick and InputBox, the tab swap (revert and close the old editor, open the copy in the same column), and the title-bar and context-menu entries.