Skip to content

syntax: add highlighting for Kconfig files #5003

@sknaumov

Description

@sknaumov

Is there an existing request for this?

  • I have searched the existing issues

Is your feature request related to a problem?

Currently there is no syntax highlighting for Kconfig files in mcedit.

Describe the solution you'd like

I've prepared syntax file based on Kconfig and Kconfiglib specifications. Not sure about escapes, though - just copied them from TOML syntax file.

Image

As to files to highlight, I've come up with the following rule:

file (.\*[Kk][Cc]onfig.\*|Config.in)$ KConfig
include kconfig.syntax

Kconfig, Kconfig.suffix - for Linux kernel, Config.in - for Buildroot, and it should also be applicable for file.kconfig files.

Describe alternatives you've considered

I've also tried to make context starting at help not to highlight keywords like if in help text, but failed, as Kconfig help context is based on indentation, and, AFAIK, mcedit syntax can't account for indentation levels.

The end of the help text is determined by the indentation level, this means it ends at the first line which has a smaller indentation than the first line of the help text.

Because of this I had to give up on trying to highlight single-quote strings, as words like don't in help text would incorrectly start string context. Anyway, AFAIK, nobody uses single quote strings in Kconfig files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: mceditmcedit, the built-in text editorprio: mediumHas the potential to affect progress

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions