Skip to content

lsp/preview: fix selection of imported sub-components#11588

Open
0x6e wants to merge 1 commit intoslint-ui:masterfrom
0x6e:feature/lsp-fix-selection-of-imported-components
Open

lsp/preview: fix selection of imported sub-components#11588
0x6e wants to merge 1 commit intoslint-ui:masterfrom
0x6e:feature/lsp-fix-selection-of-imported-components

Conversation

@0x6e
Copy link
Copy Markdown
Collaborator

@0x6e 0x6e commented Apr 30, 2026

assign_is_in_root_component compared TextRanges by raw byte offsets without checking the source file. When a component was imported from another file, byte ranges from that other file could numerically fall inside the root component's range, causing definition-site debug entries (e.g. a TouchArea inside an imported sub-component) to be flagged as "in the root component" and selected ahead of the actual use-site entry.

Anchor on (PathBuf, TextRange) so out-of-file nodes are correctly rejected, and add a regression test that previously selected the imported TouchArea instead of the MyInput use site.

Fixes #11572.

`assign_is_in_root_component` compared `TextRange`s by raw byte
offsets without checking the source file. When a component was
imported from another file, byte ranges from that other file
could numerically fall inside the root component's range,
causing definition-site debug entries (e.g. a TouchArea inside
an imported sub-component) to be flagged as "in the root
component" and selected ahead of the actual use-site entry.

Anchor on `(PathBuf, TextRange)` so out-of-file nodes are
correctly rejected, and add a regression test that previously
selected the imported TouchArea instead of the MyInput use site.

Fixes slint-ui#11572.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0x6e 0x6e force-pushed the feature/lsp-fix-selection-of-imported-components branch from f4f4c52 to d617bb3 Compare April 30, 2026 17:00
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.

Live preview "select-mode" is not consistent

1 participant