Skip to content

feat: Add node completion status feature#14

Open
DisciplinedSoftware wants to merge 25 commits intoOlegIGalkin:mainfrom
DisciplinedSoftware:feature/node-completion-status
Open

feat: Add node completion status feature#14
DisciplinedSoftware wants to merge 25 commits intoOlegIGalkin:mainfrom
DisciplinedSoftware:feature/node-completion-status

Conversation

@DisciplinedSoftware
Copy link
Copy Markdown

@DisciplinedSoftware DisciplinedSoftware commented Mar 8, 2026

Overview

This PR adds node completion status functionality to both VS Code and Visual Studio extensions. Nodes can now be marked as completed or incomplete using keyboard shortcuts and context menu options.

Features

  • Toggle node completion status with keyboard shortcuts (c key)
  • Add status items to right-click context menu
  • Display status icons on nodes to indicate completion state
  • Proper styling for completed nodes (strikethrough, visual indicators)
  • Auto-save on status change
  • Consistent implementation across VS Code and Visual Studio extensions

Changes

  • Added status icon placement and styling
  • Keyboard handler for status toggling
  • Context menu integration for status selection
  • Removal of not-started status (simplified to two-state cycle)
  • Various styling and layout fixes for proper icon display
  • Null safety improvements and timer deduplication

Testing

The changes have been tested to ensure:

  • Status icons appear correctly on diagram load
  • Keyboard shortcuts work properly
  • Context menu integration functions as intended
  • Visual styling is consistent across different node levels
  • Auto-save is triggered on status changes

Copilot AI review requested due to automatic review settings March 8, 2026 17:58
@DisciplinedSoftware
Copy link
Copy Markdown
Author

Here's a screenshot.
On the left, you can see a node that is done, and on the right, a node that is in progress. The status is also part of the right-click menu.
image

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a “node completion status” capability in both the VS Code and Visual Studio extensions by persisting a per-node status value and rendering it in the MindElixir diagram UI.

Changes:

  • Adds per-node status state (e.g., via node.data.status) and corresponding visual styling/icons in the embedded MindElixir HTML/JS.
  • Adds keyboard handling and context-menu actions to set/clear/cycle status and triggers auto-save on status changes.
  • Updates the Visual Studio-side data model to carry status alongside existing node metadata.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
VS Code/src/extension.ts Webview HTML/JS updates: status CSS, context menu entries, key handler for status changes, and autosave trigger on status updates.
Visual Studio/CodeMindMap/CodeMindMapHtml.cs Embedded HTML/JS updates mirroring the VS Code implementation (status CSS, context menu, keyboard cycling, autosave trigger).
Visual Studio/CodeMindMap/MindMap/NodeData.cs Extends node metadata model with a Status field to carry status through message deserialization.
Files not reviewed (1)
  • VS Code/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DisciplinedSoftware and others added 24 commits March 23, 2026 22:40
- Scope padding-left to level-2+ nodes (me-children me-parent me-tpc)
  to avoid widening root/level-1 nodes and breaking branch lines
- Call mind.linkDiv() after applying statuses to keep lines correctly drawn
- Remove opacity on completed nodes; keep only text-decoration: line-through

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Scale root node padding from 10px/30px to 14px/45px to match the
same padding-to-font ratio as level-1 nodes (0.57v / 1.79h).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Root node (45px left padding): icon at left 16px = (45-14)/2
- Level-1 nodes (25px left padding): icon at left 6px = (25-14)/2
- Level-2+ nodes keep left 2px within their added 20px padding

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Target me-tpc > .text directly since MindElixir wraps text in an
inline-block span that does not inherit text-decoration reliably.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Queue importMindMapData if it arrives before mind is initialized,
  apply it right after mind.init() instead of silently dropping it
- Add 500ms retry in scheduleApplyAllStatuses to catch slow renders

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Always apply padding-left: 20px on me-children me-parent me-tpc
regardless of status, so text position never moves when a status
icon is added or removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace timeout-based retries with a debounced linkDiv bus listener.
MindElixir fires linkDiv after every layout pass; waiting 50ms after
the last one guarantees applyAllStatuses runs after the final DOM
state, regardless of how many render passes MindElixir performs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Post mindMapOperation after toggling status with C key so the
existing autosave handler fires immediately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Status cycle is now: (none) -> in-progress -> completed -> (none).
Nodes with no status have no status property stored. The not-started
value is removed entirely since the feature was never released.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The class was never referenced in any CSS rule; only data-status
attribute is used for styling. Simplify updateNodeStatus accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Skip status toggle when the inline node editor (input-box) is open
so typing 'c' in a node label works correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extend the MindElixir context menu with three status actions:
In Progress, Completed, and Clear Status. Each updates the node
visual and triggers autosave.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MindElixir's extend API does not auto-close the menu unlike built-in
items, so explicitly hide .context-menu after each status selection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use optional chaining on context menu querySelector to avoid
  potential null dereference
- Cancel pending RAF/timeout handles in scheduleApplyAllStatuses
  before scheduling new ones to avoid redundant applyAllStatuses calls
- Fix stale CSS comment: 30px -> 45px horizontal padding on root node

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove leftover dev-badge CSS and HTML element from toolbar
- Add v1.20 entry to README documenting node completion status feature
- Bump version from 1.19.0 to 1.20.0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previous commit accidentally rewrote the entire lockfile (stripping
license fields) due to npm regenerating it. Restore from main and
only update the version numbers to 1.20.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Status has no default; valid values are in-progress and completed only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- updateNodeStatus: default status to null instead of not-started
- Status cycle: align with VS Code extension ((none) → in-progress → completed → (none))
- New node creation: remove status field entirely instead of defaulting to not-started

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
scheduleRafHandle and scheduleTimerHandle were declared with let inside
initMindMap() after the first call to scheduleApplyAllStatuses(), putting
them in the temporal dead zone and throwing a ReferenceError that silently
crashed initMindMap(). Moved declarations to module-level with the other
shared state variables.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
document.querySelector(...)?.hidden = true is invalid JS — optional
chaining cannot appear on the left-hand side of an assignment. Replaced
with an explicit null check: const cm = ...; if (cm) cm.hidden = true.

This was causing a silent script parse error that prevented the entire
webview from initializing, so no diagram was rendered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DisciplinedSoftware DisciplinedSoftware marked this pull request as draft March 24, 2026 02:43
- Replace class-based status approach with data-status attribute
- Add CSS icons (::before) with correct positioning per node level
- Add applyAllStatuses() + debounced linkDiv listener for load/refresh
- Add context menu items (In Progress, Completed, Clear Status)
- Add input-box guard to c key handler
- Trigger autosave on status change via c key and context menu
- Move status tutorial node inside Mind Map group, update descriptions
- scheduleApplyAllStatuses() called on selectNode and operation events

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants