VSCodeVim / VSCodeVim/Vim

Highlighted search results loses highlighting after switching to another tab and back

Open
#8,416 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
Highlighted search results loses highlighting after switching to another tab and back to initial where searching occurred.

To Reproduce
Steps to reproduce the behavior:

  1. Add/use/have these lines in settings.json (colors can be anything, but visible):
    "vim.hlsearch": true,
    "vim.searchHighlightColor": "#ffff88",
  2. Open several files in several tabs;
  3. Search for any word that is in file, with any type of vim search, like with / or ? in command line or with * in normal mode while cursor is on the necessary word (word becomes highlighted with color defined in settings);
  4. Swtch to any other tab and back to the initial one where search happened, bug happens with any type of switching, i.e. with mouse or ctrl+tab/ctrl+shift+tab or with :tabn/:tabp commands;
  5. See that searched word is not highlighted anymore + highlighting disappears for other tabs if searched word exists there too. In addition n/shift+n finds next/previous occurances, but w/o highlighting.

Expected behavior
Searched word should stay highlighted in all open tabs where word exist until other search occurs or until :noh command is executed;

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.25.2
  • VSCode version: 1.78.2
  • OS: Ubuntu 20.04.4 (Linux x64 5.4.0-148-generic)
  • OS: macOS Monterey 12.5.1

Additional context
Important to mention - running any command or empty command (: + return) or even canceling empty command (: + esc) restores highlighting, unitl next switching between tabs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the settings.json options and the listed search commands, then trace how search highlighting responds to tab switching in the extension. Done means the searched word remains highlighted across all open tabs until another search or :noh, while n and Shift+n continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.