Repository navigation
feat(notes): move notes with drag and drop, and use the file icon theme - #95
Merged
Merged
Conversation
Every note showed the same generic file icon. Tree items now carry their resourceUri with the File and Folder theme icons, so VS Code takes the icon from the current file icon theme: by extension for notes and by name for folders. Based on the same change in the community fork from #82.
Notes and folders could only be moved outside VS Code (#41). - drag notes and folders onto a folder, onto empty space for the top level, or between Workspace Notes and Notes; several selected items move together - Move To... in the right-click menu lists every folder of both sections - moves go through a WorkspaceEdit, so open editors follow the moved note - a folder can't be moved into itself, an existing item is never overwritten, and a note inside a folder that moves too goes along with it - drag a note onto the editor area to open it Drag data is carried as JSON: VS Code only keeps the original objects for drops within the same view, and a drop on the other view delivers the type twice, the first time empty. Move support was suggested by the community fork in #82.
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.
Two features from the community fork in #82, rebuilt on top of the current code.
Moving notes and folders
Notes and folders could only be moved outside VS Code (#41).
Cmd/Ctrlto move them together.WorkspaceEdit, so an open note stays open at its new location.text/uri-list, as the VS Code API recommends).The drag data is carried as JSON. VS Code only keeps the original objects for drops within the same view, and a drop on the other view delivers our type twice, the first time empty; I confirmed that by logging what
handleDropreceived, then took the non-empty entry.File icon theme
Every note showed the same generic file icon. Tree items now carry a
resourceUriwith the File and Folder theme icons, so VS Code takes the icon from the current file icon theme (by extension for notes, by name for folders).Testing
npm test: 26 passing, 4 new tests for the move rules (already there, a folder into itself or a folder inside it, a sibling with a similar name).End to end in VS Code 1.140 on macOS, driven with Playwright:
.notes/docswork/a.md, not shown as deletedwork/oldmd,json,py,txtand folder icons from the themeThe Workspace Notes, Extension does not accept the notes location #69/notes panel keeps asking for 'select location' no mather what i add in the settings #71 and external change scenarios from fix(notes): stop asking for a storage location once one is set #86, feat(notes): keep the Notes view in sync with changes made outside the window #91 and feat(notes): add a Workspace Notes section for per-project notes #93 were re-run with the same results, including New Note and New Folder with a note selected now that the views allow selecting several items.
Not tested: Windows, Linux, and dragging into the editor with a real mouse rather than Playwright's (a quick synthetic drag doesn't trigger VS Code's editor drop target; a slower one that hovers first does).
Closes #41.