vscode-cmake-tools: CMakeLists.txt is not syntax highlighted

Brief Issue Summary

CMakeLists.txt is not syntax highlighted

Expected:

When I open CMakeLists.txt, expected syntax highlight and intellisense.

Apparent Behavior:

It is opened as a plaintext, and if I want to change the language association, there is no “Cmake” - the closest thing is makefile.

CMake Tools Log

None

Platform and Versions

[[For issues, fill out the following. Otherwise delete this section.]]

  • Operating System: macOS
  • CMake Version: 3.11.4
  • VSCode Version: 1.26.1
  • CMake Tools Extension Version: 1.1.1
  • Compiler/Toolchain: Clang

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 176
  • Comments: 17 (4 by maintainers)

Most upvoted comments

“CMake Tools provides the native developer a full-featured, convenient, and powerful workflow for CMake-based projects in Visual Studio Code.”

I image most other people will do exactly what I’ve just done.

  1. Open a cmake project
  2. Click to install the suggested extension with the prompt in the bottom right
  3. Be confused that there’s no syntax highlighting
  4. Look at the other extensions in the marketplace
  5. Be confused as to whether they overlap with the suggested one I just installed
  6. Find this issue

Every other language I’ve tried in vscode will get highlighting after installing the suggested extension. Perhaps the twxs.cmake extension could also get suggested-status? That would give an actually full-featured experience.

I would also prefer if this extension provided the syntax highlighting. I’m currently using the twxs.cmake, however, it differs from the highlighting that Microsoft themselves provide for cmake files in Visual Studio 2019. In particular, variables and control flow statements are different. I find the VS2019 highlighting to be better.

Also, in some environments, it’s easier to get approval to use extensions provided by Microsoft themselves.

There are addons providing syntax highliting for cmake… This one is concerned about building with cmake.

Hi everyone, we would like to update you all on our plans to improve the Language Services for CMake (scripts).

We do not have feature deliverables for language services in the upcoming CMakeTools 1.17 release, which is just around the corner (shipping on 2/13).

However, we do have language service capabilities in Visual Studio, and we would like to further improve them and bring them over to CMake Tools, planning for CMake Tools 1.18. We would like to do this in an iterative fashion, so we deliver what we have first, first. We will create dedicated work items to track each of the features and link them in this Github issue.

We hope to continuously improve on the CMake Tools Language Services story, eventually providing full support with for: hover (quick info), completions, find all references, etc.

FYI, @dantrag @dsyx @melroy89 @woodz- @FranciscoPombal @munsingh @YaniManster @oryandunn @soroshsabz @decimad @python152, and others!

ITNOA

I think it is very good to provide Colorization and Completion Lists features with this extension to see complete solution to work with cmake.

@vector-of-bool did you can merge twxs.cmake with this project?

thx

Unfortunately, providing language services for CMake is currently out of scope for this extension because it’s a significant investment that we haven’t been able to justify funding while another extension exists that provides the feature already. We’d certainly accept a pull request with the implementation if anyone feels like tackling it.

If folks are upset with the use of the term “full-featured”, I will remove that from the description. That was the previous maintainer’s word choice and we didn’t change it when we assumed maintainer responsibilities because it was part of the “legacy.”

@munsingh there is an extension that does syntax highlighting for CMakeLists.txt files in VS Code. It just isn’t bundled with this extension.

That extension is missing several keywords, and looks like it’s abandoned. Furthermore, I don’t see why 2 CMake extensions should be required just to get syntax highlighting. “full-featured, convenient, and powerful workflow for CMake-based projects in Visual Studio Code.” should also include “syntax highlighting”. Alternatively, CMake syntax highlighting could come natively with VSCode.

Thanks for the feedback. This feature request is not yet on our roadmap. Please make sure you add a 👍 to the first post to add your vote.

This feature has been the most 👍’d for ages. Why is it still in the Backlog milestone, and not in the On deck one at least? Is not “ready to be looked into” yet?

@johnmarkwayve same for me. To the devs: how would you explain not taking into account highlighting from the early beginning, which is such a visual experience going all the way through the idea of vsc and its extensions leading to catch many people with less experience?

Recently, I was trying to migrate from legacy CMake to modern CMake. before that, I was using ms-vscode.cmake-tools and twxs.cmake. However, I now find that the code highlighting and hinting in twxs.cmake is inadequate to support modern CMake.

In the extension marketplace, I found josetr.cmake-language-support-vscode, which appears to be a replacement for twxs.cmake. However, when I went to the repository for josetr.cmake-language-support-vscode, I found that the repository was blank and it also asked me to install ms-dotnettools.vscode-dotnet-runtime.

I think it would be better if ms-vscode.cmake-tools provides code highlighting and hints if possible. I believe people prefer to use official extensions rather than personal, non-open source extensions.

No syntax highlighting support (STILL) is ofc ridiculous. But do we at least get to know which highlighting extension do the developers use themselves? Must be a real shame using another tool for something your own tool was supposed to be doing.

So CMake tools notification pop-up told me to remove the CMake extension by twxs, however now I don’t have syntax highlighting??

CMake Tools said in this message they implemented those features in this cmake tools extension by Microsoft. But where is my syntax highlighting???

And where is there no update on this issue after 4 years?

There are two extensions you can pick from right now. The CMake extension by twxs which you mentioned, and a new one CMake Language Support. We received complaints about this change and reverted our extension pack back to bundle the one by twxs. You can install either one. We believe the new one is better and recommend you install that one, but because of compatibility issues we decided to roll back the changes.

And where is there no update on this issue after 4 years?

There is no update here because acceptable extensions exist in the Marketplace to provide the language services. While it would be nice to add the support directly into our extension and we do eventually want to do it, the priority is currently lower than other issues that do not have a solution readily available.

@munsingh there is an extension that does syntax highlighting for CMakeLists.txt files in VS Code. It just isn’t bundled with this extension.