Skip to content

Add support for Valve Map Format (.vmf) files#7985

Merged
lildude merged 15 commits into
github-linguist:mainfrom
meowcat767:main
Jun 4, 2026
Merged

Add support for Valve Map Format (.vmf) files#7985
lildude merged 15 commits into
github-linguist:mainfrom
meowcat767:main

Conversation

@meowcat767
Copy link
Copy Markdown
Contributor

@meowcat767 meowcat767 commented May 27, 2026

Description

The Valve Map Format (VMF) is a data language used for Valve Source engine maps created in the Hammer Editor. It stores map geometry, brush data, and entity properties.

Checklist:

  • I am adding a new language.
    • The extension of the new language is used in hundreds of repositories on GitHub.com.
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • Internal sample created from standard Valve SDK map layout.
      • Sample license(s):
        • MIT / Public Domain
    • I have included a syntax highlighting grammar: https://github.com/meowcat767/vmf-grammar
    • I have added a color
      • Hex value: #f79a10
      • Rationale: This is the iconic orange brand color globally associated with the Source engine.

@meowcat767 meowcat767 requested a review from a team as a code owner May 27, 2026 18:56
Copy link
Copy Markdown
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is incomplete. You have not followed all of the instructions in the CONTRIBUTING.md file.

We also can not accept this grammar either as it doesn't have a licence. We can only accept grammars with one of the licenses linked in the CONTRIBUTING.md file.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have added a license (MIT) to the grammar, but please let me know what I have not followed in the CONTRIBUTING.MD as I am confused on that!

Copy link
Copy Markdown
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also just noticed your samples a huge! If they suppressed in the diff, they're too big. Please replace them with smaller, real world samples.

Comment thread grammars.yml Outdated
@lildude
Copy link
Copy Markdown
Member

lildude commented May 27, 2026

I have added a license (MIT) to the grammar, but please let me know what I have not followed in the CONTRIBUTING.MD as I am confused on that!

You've not generated the language ID as per step 4. You will also need to re-add your grammar to pull in the licence (see the instructions for replacing a grammar and replace your grammar with the same URL).

@meowcat767
Copy link
Copy Markdown
Contributor Author

I've also just noticed your samples a huge

Yeah, VMF files are reasonably large. I can make smaller ones, but they won't reflect real maps in real projects.

I'm currently fixing the problems with the grammar and will also re-gen the IDs.

@lildude
Copy link
Copy Markdown
Member

lildude commented May 27, 2026

I've just noticed we've already got a "Valve Data Format". How does this differ from a syntax perspective? Would this be better suited as adding this extension to the existing language? It's a data format so won't appear in the stats by default and if it's identical syntax, it saves you having to maintain a grammar.

@meowcat767
Copy link
Copy Markdown
Contributor Author

meowcat767 commented May 27, 2026

Valve Data Format is used to store game related metadata. Valve Data Format files store information data for resources, installation scripts, configuration scripts, and visualization elements.

Valve Map Format files are the actual map source code used by Valve Hammer and VBSP, VVIS, and VRAD to turn the map into a BSP.

They have very different grammar, so using the VDF grammar would not be suitable for VMF.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have updated the IDs for VMF.

@meowcat767 meowcat767 requested a review from lildude May 28, 2026 14:51
Copy link
Copy Markdown
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've still not replaced the massive samples with smaller files nor re-added your grammar so that the license file can be cached.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have removed the large VMF and kept the small one (this still has the basics of a VMF).

I have cached my grammar license as well.

@meowcat767 meowcat767 requested a review from lildude May 28, 2026 15:43
@meowcat767
Copy link
Copy Markdown
Contributor Author

Any updates?

@lildude
Copy link
Copy Markdown
Member

lildude commented May 31, 2026

Your sample is still too big. As I said before, if it’s suppressed in the diff, it’s too big.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have made a smaller VMF file that is just a box brush.

Comment thread vendor/README.md Outdated
@meowcat767
Copy link
Copy Markdown
Contributor Author

I have fixed the vendor README

@meowcat767 meowcat767 requested a review from lildude June 1, 2026 11:42
Copy link
Copy Markdown
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't be manually changing the files modified by the scripts provided by the repo as by doing so you've now made this PR invalid as we already have a language with the source.keyvalues TextMate scope… VDF. We can't have two languages with the same scope but different grammars. Using the scripts to add/update the grammars would have highlighted this.

This reminded me to look at the PR that added VDF. That PR included a link to https://developer.valvesoftware.com/wiki/KeyValues. The VMF page in the same wiki states:

The Valve Map Format (VMF) is a plain-text file format that stores raw (pre-compile) map data, used by the Valve Hammer Editor (since version 4.0) to save production-stage maps and prefabs. It contains information on all map brushes and entities in the KeyValues format stored with a ".vmf" extension.

So VDF and VMF do indeed use the same underlying language.

I'm also reminded of a previous attempt to add VMF in #5413 and I'm going to stick with my decision in that PR here.

The VDF PR originally wanted to add the language as "KeyValues" as that's the language used for those files according to the wiki, but this was deemed too generic, hence "Valve Data Format". It think "Valve Data Format" is specific, yet generic enough, to cover these VMF files too.

Please update the PR to add .vmf as an extension to the current "Valve Data Format" entry. It's a data language so won't appear in the repo stats anyway and most users won't change this. They will however get the benefit of syntax highlighting.

Sorry to do this, but I didn't immediately remember we've effectively gone through this whole discussion before.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have added VMF as a alias to VDF and moved the sample accordingly.

@meowcat767 meowcat767 changed the title Add the Valve Map Format (VMF) Add the Valve Map Format (VMF) as an alias to Valve Data Format (VDF) Jun 1, 2026
@meowcat767 meowcat767 requested a review from lildude June 1, 2026 13:17
Copy link
Copy Markdown
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove the grammar and related changes too.

@meowcat767
Copy link
Copy Markdown
Contributor Author

I have removed the grammar for VMF.

@meowcat767 meowcat767 requested a review from lildude June 1, 2026 13:41
@Alhadis Alhadis changed the title Add the Valve Map Format (VMF) as an alias to Valve Data Format (VDF) Add support for Valve Map Format (.vmf) files Jun 3, 2026
Comment thread .gitmodules Outdated
meowcat767 and others added 2 commits June 4, 2026 16:55
Removed vmf-grammar submodule from .gitmodules
@lildude lildude enabled auto-merge June 4, 2026 16:03
@lildude lildude added this pull request to the merge queue Jun 4, 2026
Merged via the queue into github-linguist:main with commit f931054 Jun 4, 2026
5 checks passed
Zezombye added a commit to Zezombye/linguist that referenced this pull request Jun 5, 2026
Samples are rejected if they are above a certain size:

- github-linguist#7890 (review)
- github-linguist#7985 (review)

Clarify that samples have a size limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants