Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro's V Lang color-coding could be improved. #3590

Open
codemanticism opened this issue Dec 29, 2024 · 1 comment · May be fixed by #3591
Open

Micro's V Lang color-coding could be improved. #3590

codemanticism opened this issue Dec 29, 2024 · 1 comment · May be fixed by #3591

Comments

@codemanticism
Copy link

There are some keywords in V (URL) which are not supported by Micro's color-coding. Here is my attempt at rewriting the .YAML file:

filetype: vlang

detect:
    filename: "\\.v$"

rules:
      # Conditionals and control flow
    - preproc: "\\b(module|import)\\b"
    - statement: "\\b(if|else|for|match|select|defer|or|unsafe|while|asm|defer|go|goto|lock|match|or|rlock|select|spawn|unsafe)\\b"
    - statement: "\\b(sizeof|typeof)\\b"
    - statement: "\\b(break|continue|goto|return)\\b"
    - statement: "\\b(as|in|is)\\b"
    - type.keyword: "\\b(assert|const|enum|fn|struct|interface|type|implements|shared|static|union|volatile)\\b"
    - type.keyword: "\\b(pub|mut|__global|__offsetof)\\b"

    - preproc: "\\$\\b(if|else)\\b"
    - identifier.os: "\\b(mac|macos|linux|windows|freebsd|openbsd|netbsd|dragonfly|android|solaris|haiku)\\b"
    - identifier.compiler: "\\b(gcc|tinyc|clang|mingw|msvc|cplusplus)\\b"
    - identifier.platform: "\\b(amd64|aarch64|x64|x32|little_endian|big_endian)\\b"
    - identifier.other: "\\b(debug|test|js|glibc|prealloc|no_bounds_checking)\\b"
    - constant.bool: "\\b(true|false)\\b"
    - constant.none: "\\b(none)\\b"

    - constant.string:
        start: "`"
        end: "`"
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    - constant.string:
        start: "'"
        end: "'"
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    - constant.string:
        start: "\""
        end: "\""
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    # Brackets
    - symbol.brackets: "(\\{|\\})"
    - symbol.brackets: "(\\(|\\))"
    - symbol.brackets: "(\\[|\\])"

      # Numbers and strings
    - constant.number: "\\b(0b[01_]+)\\b"
    - constant.number: "\\b(0o[0-7_]+)\\b"
    - constant.number: "\\b(0x[0-9a-fA-F_]+)\\b"
    - constant.number: "\\b([0-9_]+)\\b"
    - comment:
        start: "//"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    - comment:
        start: "/\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

@JoeKar
Copy link
Collaborator

JoeKar commented Dec 29, 2024

Can you please provide your suggestion directly as PR1?
The diff can then be reviewed accordingly and merged in case there are no issues with it.

Footnotes

  1. https://github.blog/developer-skills/github/beginners-guide-to-github-creating-a-pull-request/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants