micro-editor / micro-editor/micro

Syntax Highlighting Assistance

Open
#2,461 0 comments 0 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

I am unable to start a new Discussion, so I'm putting this in an issue. Which is sad because closing an issue relegates it to the garbage bin and a permanent place to get advice on creating syntax highlighting would be beneficial. Please correct me if such a place exists already.

Specifications

I'm attempting to create a syntax file for nushell configuration files (.nu). The Nushell Project has created a vscode (TextMate-based) syntax file which I'm using for reference.

However, there are some structural differences which I'm having problems with.

I'm trying to do Variables (identifier.var, I believe) and the existing syntax file has this:

"variable": {
  "match": "(alias|let|let-env)\\s+[\\$'\"]?([a-z A-Z0-9_-]+)['\"]?|(\\$[a-zA-Z0-9_\\-]+)|(\\|)([$a-zA-Z0-9-]+)[\\s,]+([$a-zA-Z0-9-]+)(\\|)",
  "name": "variable.nushell",
  "captures": {
    "1": { "name": "keyword.other.nushell" },
    "2": { "name": "variable.name.nushell" },
    "3": { "name": "variable.name.nushell" },
    "4": { "name": "punctuation.nushell" },
    "5": { "name": "variable.name.nushell" },
    "6": { "name": "variable.name.nushell" },
    "7": { "name": "punctuation.nushell" }
  }

How would I go about converting this to the YAML format? Am I breaking the "match" value into its component "captures" and naming them there?

Ultimately I'd like to have a script which converts from these common VSCode-compatible syntax files to Micro's YAML, although it is currently beyond my skillset and I'd require assistance.

Is anyone able to provide advice?


Commit hash: b9763856
OS: Windows
Terminal: Windows Terminal Preview

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 by comparing the referenced nushell.tmLanguage.json file with Micro's YAML syntax format, using commit b9763856 as the reported baseline. Determine whether the requested conversion guidance or a general conversion script is intended; done should provide a documented mapping for captures or a defined converter, but the issue does not name a target file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, vscode, yaml
Domain
documentation, tooling
Issue type
Documentation
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.