Skip to content

fix: show per-entity schema declarations in the outline tree - #114

Merged
wisnesky merged 1 commit into
CategoricalData:masterfrom
caverac:fix/schema-literal-outline
Oct 8, 2026
Merged

wisnesky merged 1 commit into
CategoricalData:masterfrom
caverac:fix/schema-literal-outline

Conversation

@caverac

@caverac caverac commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #113

The issue

In the IDE outline a schema literal written with entity blocks has no expand arrow. In the NewDemo example, schema Olog1Schema and schema Olog2Schema cannot be expanded.

A schema literal can declare its entities, foreign keys and attributes in sections, as in A below, or per entity, as in B. Only the per-entity form is affected.

schema A = literal : Ty {          schema B = literal : Ty {
  entities                           entity Patient
    Patient Visit                    attributes name : String
  foreign_keys
    patient : Visit -> Patient       entity Visit
  attributes                         foreign_keys patient : Patient
    name : Patient -> String       }
}

The outline takes the children of a schema node from SchExpRaw.raw(), which the constructor fills by calling doGuiIndexing. The constructor merges the per-entity declarations (ensSimpl) into the ens, fks and atts fields, but it passes doGuiIndexing only the lists from the sectioned form. For schema B, every section of raw() stays empty, and CqlCodeEditor.add does not draw empty sections.

Raw.find searches the same lists, so it cannot locate a name declared per entity either. The only find call in SchExpRaw looks up observation equations, which is why the outline is the only visible symptom.

The bug is not recent. The doGuiIndexing call is the same as in the initial commit (399f0f4, 2019-03-13). The per-entity form was added later, in eaf1813 (2021-03-11), and its declarations were never passed to doGuiIndexing.

The solution

The constructor now computes the merged lists once and uses them both for the fields and for doGuiIndexing. The private helper whee(List<LocStr>, ...) already built an ArrayList, so its declared return type changes from Collection<LocStr> to List<LocStr>, which is the type doGuiIndexing takes.

Each per-entity label keeps the source position of its name. Clicking it in the outline moves the caret to the declaration, as it already did for the sectioned form (CodeEditor.java:1224).

How to test it

Unit tests are added, and here are two screenshots of the problem

Before fix

broken

After fix

fixed

@wisnesky
wisnesky merged commit 8f68d3b into CategoricalData:master Oct 8, 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

Development

Successfully merging this pull request may close these issues.

Schema literals don't expand in viewer tree

2 participants