Skip to content

Add decoration to focused item #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 20, 2019

Conversation

asger-semmle
Copy link
Contributor

When following a link from the result viewer, we highlighted the target range simply by selecting it.

When this range is an identifier, it triggers vscode's occurrence-match highlighting, which makes it hard to see at a glance what was highlighted. This PR introduces decorators to highlight it a bit more, using the same colors as in search/replace.

The decoration is cleared on any selection change event in that editor.

Before

Screenshot 2019-11-15 at 12 40 14

After

Screenshot 2019-11-15 at 12 40 08

@asgerf asgerf requested a review from jcreedcmu November 18, 2019 14:40
@jcreedcmu
Copy link
Contributor

jcreedcmu commented Nov 19, 2019

Code lgtm, but I still find the simultaneous decoration and selection of code to be a bit visually jarring in the case of multi-line matches. This is since, for some reason I still have not completely understood, selection includes one character's worth of whitespace at every newline, but decorations with isWholeLine: false do not, resulting in things like the following screenshot:
image

Do you suppose we could just rely on decoration only, and skip the selection-setting on https://github.com/github/vscode-codeql/pull/164/files#diff-73bb24db58f098e75356f2e05edb5e62R432 ?

@asgerf
Copy link
Contributor

asgerf commented Nov 20, 2019

That's a good point.

I've experimented quite a bit with where to place the cursor, and found that for small ranges, bracket-highlighting is more attention-grabbing than our decorator which is why I didn't like placing the cursor at the beginning. But multi-line selections don't have that problem (as they're large) so I decided to just treat them differently.

WDYT?

Copy link
Contributor

@jcreedcmu jcreedcmu left a comment

Choose a reason for hiding this comment

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

Yeah, I think treating single-line and multi-line differently as you do is appropriate.

@jcreedcmu jcreedcmu merged commit a559404 into github:master Nov 20, 2019
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.

3 participants