Add VS Code extension platform for editing .learningmap files (with browser support and fully configurable keyboard shortcuts)#40
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Create platforms/vscode with extension, custom editor provider, and webview - Add build script for bundling extension and webview separately - Support for opening .learningmap files with visual editor - Add command for creating new learningmap files - Auto-save changes back to file - Support for empty .learningmap files Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
- Add debounced saving to prevent race conditions - Prevent save loops by tracking loading state - Add icon, keywords, and repository info to package.json - Create DEVELOPMENT.md with architecture documentation - Add VS Code launch configuration for debugging - Document known limitations (share feature, URL hash loading) Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
- Remove unused CSS options from build script - Add proper type definition for VS Code API instead of using 'any' - Use crypto.randomBytes() for secure nonce generation instead of Math.random() - Add example.learningmap file for testing Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
- Add VS Code platform to repository structure in development docs - Add section on developing the VS Code extension - Update main README with platforms section - Link to platform-specific documentation Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
|
@copilot remove the sharing functionality in the vscode extension. also make the extension work in the browser for example in github.dev |
…nsion - Add disableSharing prop to LearningMapEditor and EditorToolbar components - Conditionally hide share button when disableSharing is true - Enable disableSharing in VS Code webview - Replace Node.js crypto module with Web Crypto API for browser compatibility - Add "browser" field to package.json for github.dev support - Use crypto.getRandomValues() which works in both Node.js and browser environments Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Done in commit ccd6d82:
The extension should now work seamlessly in both desktop VS Code and browser-based environments like github.dev. |
|
@copilot when opening a file the learningmapeditor should be directly visible. add a command to show the source. also hide the buttons for open and download. |
- Add disableFileOperations prop to LearningMapEditor and EditorToolbar - Conditionally hide open and download buttons when disableFileOperations is true - Enable disableFileOperations in VS Code webview - Add "Learningmap: Show Source" command to view JSON source - Visual editor is now the default view (custom editors always open in custom view) - Users can use the new command to switch to source view when needed Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Done in commit dc9404d:
|
- Check workspace.textDocuments for open .learningmap files when no active text editor - Fall back to visible text editors if available - Properly handle the case when custom editor is active (no activeTextEditor) - Improved error message clarity Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Fixed in commit 1129708. The issue was that custom editors (like our visual learningmap editor) don't have an Fix: The command now:
The "Show Source" command should now work correctly when the visual editor is active. |
|
@copilot make the keyboard shortcuts configurable. |
- Add keybindings contribution to package.json for Show Source command - Default shortcut: Ctrl+K Ctrl+S (Windows/Linux) or Cmd+K Cmd+S (Mac) - Users can customize shortcuts via VS Code keyboard shortcuts editor - Update README with keyboard shortcuts documentation - Document how to customize shortcuts in VS Code Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Done in commit cd2261b. Added configurable keyboard shortcuts:
Users can customize shortcuts:
Note: The editor shortcuts (like |
|
@copilot modify the react component to accept the keybondings as a prop and use that for custom keybindings in vscode. also update the documentation. |
- Add KeyBinding and KeyBindings types to define custom keyboard shortcuts - Update KeyboardShortcuts component to accept and use custom keybindings - Add keyBindings prop to LearningMapEditor component - VS Code extension now disables Ctrl+S (save) since VS Code handles saving - Export KeyBinding and KeyBindings types from package - Update web-component to support key-bindings attribute - Document keyboard shortcuts and customization in React docs - Document key-bindings attribute in web-component docs Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Done in commit 761eb36. Added
Usage example: import { LearningMapEditor, KeyBindings } from '@learningmap/learningmap';
const customBindings: Partial<KeyBindings> = {
save: undefined, // Disable
addTaskNode: { key: 't', ctrl: true } // Change to Ctrl+T
};
<LearningMapEditor keyBindings={customBindings} />Updated:
|
|
@copilot can you make all keybindings configurable in the vscode extension? |
- Add VS Code commands for all 21 editor actions (add nodes, undo/redo, zoom, etc.) - Register keybindings for all commands in package.json with proper when clauses - Update LearningmapEditorProvider to track active webview and send commands - Update webview to handle command messages and simulate keyboard events - All shortcuts scoped to learningmap editor using 'activeCustomEditorId' context - Users can customize any shortcut through VS Code keyboard shortcuts editor - Update README with complete keyboard shortcuts table and customization instructions Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
Done in commit 24dde25. All 21 editor keybindings are now configurable in VS Code: Added VS Code commands and keybindings for:
How it works:
Users can customize:
All shortcuts are now fully integrated with VS Code's keyboard shortcut system, allowing users to customize them per their preferences or resolve conflicts with other extensions. |
Plan: Add VS Code Extension Platform for Learningmap
Understanding of the repository:
@learningmap/learningmappackage exportsLearningMapEditorcomponentgetRoadmapData()andloadRoadmapData()methods.learningmap(JSON format)web(React SPA)Implementation Plan
platforms/vscodedirectory structureFeatures
Visual Editor
.learningmapfiles with visual editing interface.learningmapfilesCommands
Keyboard Shortcuts - Fully Configurable
All keyboard shortcuts are now fully configurable through VS Code:
VS Code Integration
activeCustomEditorIdcontextAvailable Commands with Default Shortcuts:
Ctrl+1-4/Cmd+1-4)Ctrl+Z), Redo (Ctrl+Y), Cut/Copy/Paste, Select All, DeleteCustomization:
Users can customize any shortcut through VS Code's keyboard shortcuts editor:
Ctrl+K Ctrl+S/Cmd+K Cmd+S)React Component Level:
keyBindingsprop allows programmatic customizationKeyBindingsinterface with properties for each shortcutCtrl+S(handled by VS Code)Browser Compatibility
cryptomodule"browser"field in package.json for proper environment detectionCore Package Updates
Added optional props to
LearningMapEditorcomponent for customizing the toolbar and keyboard shortcuts in different environments:disableSharing- Hides the share button (useful for VS Code and embedded contexts)disableFileOperations- Hides open and download buttons (useful when file operations are handled externally)keyBindings- Customize all keyboard shortcuts programmatically (useful for avoiding conflicts in different environments)These props are:
KeyBinding,KeyBindings)disable-sharing,disable-file-operations,key-bindings)Keyboard Shortcuts Customization Example
Files Created
Architecture
Command Flow:
This architecture ensures all shortcuts are fully configurable through VS Code while maintaining compatibility with the React component's existing keyboard handling.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.