Edit Tampermonkey browser scripts in the comfort of your everyday code editor (assuming that one is VS Code).
Features implemented
List files
Open individual scripts and edit them like local files.
Same for required files and storage content.
Save editor changes back to Tampermonkey.
Link a script with a local file using Link With Local File....
Keep the editor buffer in sync with both Tampermonkey and the linked local file at the same time!
Also allows opening that file with your file explorer.
Native diff to avoid deleting by mistake.
Getting started (Command: Show Getting Started).
Future features for some day
Easier flow, potentially automated flow to send the code to tampermonkey-editors extension.
Text search feature. (Its VS Code API is currently experimental)
File search feature. (Its VS Code API is currently experimental)
Architecture
The extension uses a single virtual file-system scheme: tampermonkeyFS:///.
src/extension.js is the composition root for provider setup, UI state, listeners, commands, and the connection loop.
src/tampermonkeyFileSystem.js Is the heart of the virtual tree processed from tampermonkey with abstractions and translates from VSCode API to internal architecture.
src/saveToDisk.js & src/syncManager.js Are the main files related to file read/write and handling the relationship between data from Tampermonkey vs data from filesystem.
Sync is editor-centered: Editor <-> Tampermonkey and Editor <-> Linked File are the only active sync pairs.
On first activation, getting-started walkthrough appears. You can reopen it later with Show Getting Started.
If the current window already has the Tampermonkey folder, use Copy Connection Code.
If the current window does not yet have the Tampermonkey folder, use Connect to Tampermonkey. It adds the folder first and then copies the connection code there.
After connecting, edit scripts normally and save to push changes back to Tampermonkey.
Right click a file and Link With Local File... when you want the same script backed by a file. Whenever you save, Tampermonkey and the linked file become the same content. Use it as a backup of what is in your browser or for committing to a repository.
Development
Docker way
Run npm docker:watch. Everything will be installed and setup automatically.
Execute Launch Extension configuration.
Local install way
Ensure you have the correct node version activated.