vs.language.cmake
vs.language.cmake copied to clipboard
add missing keywords + easier maintainability
reference issue #41
I generated command/variable/property lists from CMake 3.13.2 with the following commands:
cmake --help-property-list
cmake --help-command-list
cmake --help-variable-list
I put these into the CMake.tmLanguage file with 1 item per line to make tracking changes with git easier.
I also added some missing keywords that the above did not address.
I added some instructions for what I did (plus the unedited list files generated from cmake --help) into a util folder.
There are some limitations listed in the instruction document, mainly being that the lists obviously don't split into all the sub-categories that were used previously.
I've removed the regex strings from the potentially unnecessary sub-categories in the CMake.tmLanguage file, but have left them otherwise intact in case they are needed in future.
If this approach is considered usable going forward, it would probably be a good idea in future to write a script to perform the steps in the instruction document.
I've not tested this extensively to see what else might be missing, or what these big changes might break; I've only tested on my own small, modern-style cmake files.
I made a seperate branch (tmLanguage_refactor) with additional changes on top of those in the branch in this pull request.
I decided to keep these branches seperate as the changes in the new branch make more extensive structural changes to the CMake.tmLanguage file.
The new branch does this following:
- Removes now unneeded (empty regex) sections.
- Move larger sections to bottom of document
- Seperate Control Flow commands from larger command list (+ add step for this to instruction document)
- Improve colorization
- Start adding seperate sections for sub command lists for individual commands (i.e. install() and export()).
Hi, thank you for this PR.
I will look to add a simple CMake script that call the cmake --help-xxx-list and use configure_file to generate de tmLanguage file.
Hi, any update on this?
Can we have the new functions/keywords added please? This extension is the de facto standard CMake language syntax extension, because it's part of CMake Tools by Microsoft... it shouldn't be this outdated.
There's also the new cmake_path that should be added: https://cmake.org/cmake/help/latest/command/cmake_path.html
As well as more commands I'm sure, I would love to see this updated with CMake 3.23+
@imrichardcole I think this would be a good starting point for reviving this, it fixes a lot of the existing issues with the age of the current extension, might be possible to extend this to a little bit of automation i.e. launch.json to run an update script (not full blown ci/cd).
I believe the repo pre-dates the new commands in 3.13+ for doing this, which would make this sort of extension much easier to maintain.