micro-editor / micro-editor/micro

Color regex capture groups differently in syntax files

Open
#1,422 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description of the problem or steps to reproduce

It isn't possible to color different groups differently in syntax files. For example, I'd like to color proc calls:

- identifier.class: "\\w+(?=\\()"

because re2 doesn't support lookahead, it's not possible using this way. However, it could be possible to do the following:

- pattern: "(\\w+)(\\()"
  groups: [ "identifier.class", "default" ] # color group 1 as identifier.class, and group 2 as default

which would eliminate the issue.

Specifications

You can use micro -version to get the commit hash.

Commit hash: 3a8898d
OS: Linux daknus 5.2.21-rt13-MANJARO #1 SMP PREEMPT RT Tue Oct 29 23:19:17 UTC 2019 x86_64 GNU/Linux
Terminal: alacritty

Contributor guide

No contributing guide indexed for this repository

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 with the syntax-file format and the pattern/groups configuration shown in the issue, then trace how regex matches are assigned colors. Check the requested behavior against the stated RE2 limitation. Done means separate capture groups can receive the listed colors when a syntax file uses the proposed configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.