VSCodeVim / VSCodeVim/Vim

Refactor configuration for highlight group appearance

Open
#8,728 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/configuration breaking-change
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Easymotion aside, the plugin currently emulates 4 vim highlight groups, Search, IncSearch, Substitute, and HighlightedYankRegion, each configured via separate background and text color keys.
Since they're all implemented as decorations, we can feasibly style much more than just borders: font weight, slant, and even overview ruler color can all be customized (In fact, most of this is already possible with simple css property injections: "vim.searchMatchTextColor": "#fff; border: 1px solid white; font-weight: bold; font-style: italic;").

Rather than add more keys to control these things, I think it might be worth deprecating the old vim.xxxColor/vim.xxxTextColor keys in favor of a new vim.xxxHighlight option, the value of which would be some subset of properties from DecorationRenderOptions:

type ConfigurableHighlight = {
  backgroundColor?: string;
  color?: string;
  borderColor?: string;
  fontStyle?: string;
  fontWeight?: string;
  textDecoration?: string;
  overviewRulerColor?: string;
};

The upside would be a more consistent interface offering a degree of customization similar to vim's highlight groups.
Of course, the downsides are an API change, and potentially more complexity. Compared to what we have now, however, I think this has the potential to be much more direct, and ultimately less confusing.

Originally posted by @adrsm108 in https://github.com/VSCodeVim/Vim/issues/7364#issuecomment-1037034557

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

No files or tests are named. Start by locating the existing vim.xxxColor and vim.xxxTextColor configuration and the decoration setup, then compare the supported properties with VS Code's DecorationRenderOptions. Done would require an agreed migration from the old keys to a configurable xxxHighlight option, including deprecation handling and coverage for the affected highlight groups.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.