Skip to content

enhancement: improve YAML syntax highlighting #946

Description

The current YAML highlighting is missing a few common YAML constructs. Examples from the YAML 1.2.2 specification:

  1. Special numbers: .inf, -.inf, .nan

    positive_inf: .inf
    negative_inf: -.inf
    not_a_number: .nan

    See YAML 1.2.2 §2.4, Example 2.20.

  2. Hex, octal, and binary numbers

    hexadecimal: 0xC
    octal: 0o14
    binary: 0b1010

    See YAML 1.2.2 §2.4, Example 2.19.

  3. Single-quoted strings and escaped quotes

    single: 'Hello, world!'
    escaped: 'It''s YAML'

    See YAML 1.2.2 §7.3.2.

  4. Explicit tags

    string: !!str 123
    integer: !!int "42"

    See YAML 1.2.2 §6.9.1.

There are other YAML constructs as well, such as empty values, flow collections, anchors and aliases, and the document end marker. However, I don't think these necessarily need special highlighting support.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions