Skip to content

CM-77192: Open vulnerabilities in an editor tab - #106

Open
aaron-butler-cy-int wants to merge 7 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-77192-editor-tab
Open

aaron-butler-cy-int wants to merge 7 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-77192-editor-tab

Conversation

@aaron-butler-cy-int

@aaron-butler-cy-int aaron-butler-cy-int commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Third part of the split of #103, which is now merged. Depends on the tool window polish PR (#105): until it merges, this diff also shows its two commits; only the last commit (add a setting to open vulnerabilities in an editor tab) belongs here.

  • New setting Open vulnerabilities in an editor tab (off by default). Each vulnerability then opens in one reused "Cycode Vulnerability" tab in an editor split next to the open file, which gives more room than the tool window. Source files keep opening in the main editor window, not next to the finding.
  • Implemented as a custom file editor, a project service that places the tab, and a shared builder for the vulnerability card.
  • Uses only createSplitter and the no-argument FileEditorOpenOptions, which fixes the failed Verify plugin check.

Jira

CM-77192

Testing

  • Unit tests pass (./gradlew test), including the editor tab file type and the setting default.

🤖 Generated with Claude Code

@aaron-butler-cy-int
aaron-butler-cy-int force-pushed the CM-77192-editor-tab branch 2 times, most recently from 8894564 to c13b42a Compare November 25, 2026 14:12
aaron-butler-cy-int and others added 2 commits November 25, 2026 10:27
- Spinners in the results tree while a scan runs, and scan buttons that are
  disabled (without flicker) while their scan runs
- Scan all button, scan options that are scrollable and collapsible, and a
  layout that follows the dock side
- Close button on the vulnerability view and wrapped hint text
- Keep expanded results rows expanded while other scans finish
- Route tool window updates through ToolWindowUpdate

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- TreeState restores the expanded rows after a reload instead of matching
  nodes by name by hand; rows of a rescanned scan type are collapsed after
- AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED animates the spinner, so the
  repaint timer and its lifecycle code are gone

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… collapse state machine

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@omer-roth omer-roth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review against SOLID / YAGNI / KISS / DRY, scoped to this PR's own commits (2ffef27..e127945). Inline comments cover medium-and-above findings only. Findings on the #105 commits are on #105.

* Shows a finding: in an editor tab when that setting is on, otherwise in the right panel with a close button that
* returns to the scan view. Returns true when it is shown in the tool window.
*/
fun showDetection(detection: DetectionBase): Boolean {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

SRP / KISS (medium): the Boolean return value leaks the placement policy to callers.

showDetection now returns "was it shown in the tool window". The quick-fix caller uses that to decide whether to activate the window. The method both acts and reports its own routing, so every caller has to know the setting exists.

It is also wrong in one case: createViolationCard(...) ?: return true reports that an unknown detection was shown in the tool window, so the quick fix activates the tool window with nothing new in it.

Suggestion: return Unit and do the tool window activation inside showDetection (in the tool-window branch only). The quick fix then goes back to a plain getTab(project)?.showDetection(detection).

else -> return
}
/** Called when the user selects a node in the tree; the owner decides what opens for it. */
var onNodeSelected: ((AbstractNode) -> Unit)? = null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

YAGNI / KISS (medium): two selection callbacks that do almost the same job.

TreeView now has onDetectionSelected and onNodeSelected, plus openDetection(node) and openDetection(detection). The two entry points also behave differently:

  • Tree click → onNodeSelected → focusSourceWindow() + openDetectionInFile + showDetection.
  • Context menu "Open Violation Card" → openDetection(node) → onDetectionSelected → showDetection only, with no focusSourceWindow().

Suggestion: keep one callback, onNodeSelected: (AbstractNode) -> Unit, and route the context menu through it too, or give the owner one clear onOpenFinding with a flag for "also open the source". Remove onDetectionSelected and the two openDetection overloads.

return
}

// reuse an existing split to the right instead of creating another one every time

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

KISS / correctness (medium): getNextWindow is not "the split to the right".

FileEditorManagerEx.getNextWindow cycles through the windows in order. With an existing horizontal split, or with 3 or more windows, the finding tab lands below or to the left, which contradicts both this comment and the README ("a tab on the right side").

On top of that, the create-split / copy the current file / open the finding / close the copy sequence relies on createSplitter behavior that is not part of the API contract.

Suggestion: say "another editor window" instead of "to the right", and use manager.windows.firstOrNull { it != current } so the intent is explicit. If "right" matters, check the splitter orientation before reusing a window. Either way, a short test or manual check with an existing horizontal split would help.

aaron-butler-cy-int and others added 4 commits November 26, 2026 09:00
…plit the scan tab layout

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…open nothing on right click

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Add "Open vulnerabilities in an editor tab" (off by default). Each
vulnerability then opens in one reused "Cycode Vulnerability" tab in a
right-hand editor split, which gives more room than the tool window.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…n there, use another editor window

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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