Skip to content

Search highlight mostly hidden when semantic highlighting enabled #2522

@Maska

Description

@Maska

Describe the bug

When semantic highlighting is used, ST's search highlight is mostly hidden for hits within semantic tokens.

To Reproduce

Steps to reproduce the behavior:

  1. Open Sublime Text in safe mode
  2. Install Package Control
  3. Upgrade Package Control to version 4
  4. Install LSP
  5. Install lsp-clangd (or some other LSP plugin capable of semantic highligting (haven't tested with others))
  6. Configure semantic highlighting for LSP
  7. In a file where LSP is active, search for strings that appear within semantic tokens

LSP.sublime-settings:

{
    "semantic_highlighting": true
}

The color for highlight is set so that hard-to-see highlights stand out better.
Mariana.sublime-color-scheme:

{
    "variables":
    {
    },
    "globals":
    {
        "highlight": "#00FF00"
    },
    "rules":
    [
        {
            "scope": "meta.semantic-token",
            "background": "#00000101"
        }
    ]
}

Example file with many sorts of occurrences of missing highlights when searching for "q":

void reproduce()
{
    // A semantic token gets a very faint highlight when searching.
    auto qqqq = "qqqqqqqq";

    // Error markings are drawn nicely.
    auto qqqqq qqqqqq;

    // Even-numbered rows.
    int qqqqqq;

    int qqqqqqq;

    // Odd-numbered rows. On some font sizes, the tops and bottoms are gone.
    int qqqqqqqq;

    int qqqqqqqqq;

    int i_hide_highlights_under_my_background;
    int qqqqqqqqqq;
    int i_hide_them_too;

    // qqqqqqqqqqqqq Comment highlights don't bother each other.
    // qqqqqqqqqqqqq But semantic tokens do bother comments.
    int qqqqqqqqqqq;
    // qqqqqqqqqqqqq

    // Highlight for selected text works.
    auto qq = 1;
    qq = 2;
    qq = 3;
    qq = 4;
}

Expected behavior

Search hits are highlighted very visibly, with surrounding, unbroken rounded rectangles, as shown in the image below.

safe mode mariana semantic highlighting false works as expected

In this screenshot, LSP's semantic highlighting is disabled.

Screenshots

safe mode mariana buggy

Search highlights are buggy.

safe mode mariana selected highlight works

Highlights for selected text occurrences work fine.

safe mode monokai buggy

The bug doesn't seem to depend on the theme used. Monokai and others suffer from it too.

safe mode mariana scale 100 font size 48

With display scale 100%, the partial highlights disappear completely. Font size 48 is used to bring up details.

Environment

  • OS: Windows 11 version 23H2 (OS Build 22631.3593)
  • Display scale 150%
  • Sublime Text version: 4180
  • LSP version: 2.2.0
  • Language servers used: Clangd 18.1.8, used through LSP-clangd 1.7.0

Additional context

This is likely related to #1934.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sublime issueIssues related to shortcomings or bugs in the ST API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions