Skip to content

Add the Structure tool window - #20

Merged
Leitwolf11 merged 2 commits into
mainfrom
feature/structure-tool-window
Oct 6, 2026
Merged

Leitwolf11 merged 2 commits into
mainfrom
feature/structure-tool-window

Conversation

@Leitwolf11

Copy link
Copy Markdown
Contributor

The PSI module has returned a declaration outline since #18, and nothing in the editor showed it. This adds the Structure tool window.

What it does

  • Lists the declarations of the active Visual X#, Kotlin, Java or Groovy document as an indented list, from the outline of SourceAnalyzer.
  • Selecting a declaration moves the caret to its start. The declaration around the caret is marked.
  • Docked on the left below the Project tool window; the two share the column and divide its height when both are open. It opens from the stripe or with Alt+7 and is closed when Xide starts.

How it stays correct

  • The outline is read on a background thread, 200 ms after an edit, and only while the tool window is open.
  • The rows carry the document version they were read from. A row of an older text does not navigate, because its offsets would address other source; the list is replaced as soon as the new text is read.
  • Python has a tokenizer and no parser, so the window says that it has no structure. A text longer than the colouring limit is not parsed.

Tests

  • StructureTest: rows from an outline, the innermost declaration around an offset, version check, the structure of each language, a text that does not parse, the empty cases.
  • StructureUiTest drives the real Compose shell: listing, hiding, navigation and the marked row, an edit, Alt+7, Kotlin, Python and no document.
  • ./gradlew check passes locally on Windows.

Not verified

  • The window was exercised through the semantics tree only. Nobody has looked at it on screen yet: the glyph on the stripe, the one-letter kind marks and their colours need a look.

Not in this change

  • Resizing the left column, a tree with collapsible nodes, sorting and filtering.
  • PSI syntax errors of Kotlin, Java and Groovy in the Problems tool window.

The PSI module has returned a declaration outline since it was added, and
nothing in the editor showed it. The Structure tool window lists the
declarations of the active Visual X#, Kotlin, Java or Groovy document as an
indented list. Selecting a declaration moves the caret to its start, and the
declaration around the caret is marked.

The list is read on a background thread, a moment after an edit so that
typing does not parse once per key, and only while the tool window is open.
The rows carry the document version they were read from, and a row of an
older text does not navigate: its offsets would address other source.
Python has a tokenizer and no parser, so the window says that it has no
structure.

The window is docked on the left below the Project tool window, with which
it shares the column, opens from the stripe or with Alt+7, and is closed
when Xide starts.

StructureTest covers the rows, the declaration around an offset and the
structure of each language; StructureUiTest drives the real shell: listing,
navigation, the marked row, an edit, the shortcut and the empty states.
@Leitwolf11
Leitwolf11 marked this pull request as ready for review October 6, 2026 19:29
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Leitwolf11
Leitwolf11 merged commit 5a727f6 into main Oct 6, 2026
6 checks passed
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.

1 participant