Skip to content

Feature request: Add ability to set default/fallback grammar for files without extensions or not common files #1083

@og900aero

Description

@og900aero

Problem:
Many system and config files have no extension or other extensions (Makefile, Dockerfile, nftables.conf, lfrc etc.). Currently there's no way to apply syntax highlighting to these files without listing each filename explicitly in the language config.

Current workaround attempt (doesn't work):

"text": {
  "grammar": "bash",
  "highlighter": "auto",
  "comment_prefix": "#"
}

The text language doesn't apply the bash grammar to files without extensions, even though bash grammar exists and works fine for .sh files.

Suggested solutions:

  1. Make text language grammar actually work for extensionless files
  2. Allow wildcard or empty string in extensions: "extensions": ["*"] or "extensions": [""]
  3. Add editor-level default grammar: "editor": { "default_grammar": "bash" }

Use case:
System administrators and DevOps engineers work with many extensionless config files that would benefit from bash-like syntax highlighting (comments, strings, variables). Example: /etc/* in linux system

Workaround:
Currently must list every single filename explicitly, which is impractical for hundreds of config files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions