Giter Club home page Giter Club logo

vs.language.cmake's Introduction

CMake For VisualStudio Code

Join the chat at https://gitter.im/twxs/vs.language.cmake

This extension provides support for CMake in Visual Studio Code.

screencast

Features

  • Colorization
  • Completion Lists

completion

  • Code comments

comment

  • Snippets

find_package

include

  • Quick Help

tooltip

  • Access To Online Help

Options

The following Visual Studio Code settings are available for the Cmake extension. These can be set in user preferences (cmd+,) or workspace settings (.vscode/settings.json).

{
    "cmake.cmakePath": "/path/to/cmake"
}

Commands

  • CMake: Online Help to go to the CMake online documentation (according to the current cmake version).

Acknowledgements

This extension based on the TextMate Syntax from this project.

Contributors

Feel free to contribute...

License

MIT

vs.language.cmake's People

Contributors

darthwalsh avatar dbird137 avatar dlech avatar gitter-badger avatar lostintangent avatar medvid avatar rkondratenko avatar stanionascu avatar twxs avatar vector-of-bool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vs.language.cmake's Issues

How about add a configuration to UpperCase command?

Greate plugin to me, a new learner about cmake, make write CMakeLists.txt convenient.

I read a tutorial, and it say, uppercase or lowercase for cmake command is ok,

BUT uppercase cmake command is a better way to distinguish you code.

so, how about add a configuration to UpperCase command?

Thanks, again for this plugin.

Online Help not Working

Hi,

When I try to use the CMake Online Help I get the following error message:

No handler found for the command: 'cmake.onlineHelp'. An extension might be missing an activation event.

Should this work out-of-the-box or is there anything to configure?

Autocomplete is case sensitive

Commands like add_executable, etc, only autocomplete when you type in lowercase. As this is not a syntax requirement to use CMake, can autocomplete be case insensitive? I thought the extension was less than useful for a second because I would type 'ADD_EXECUTABLE' and it would never be found in the autocomplete list. Turns out my habit of writing CMake scripts in all caps isn't quite supported.

Not looking like the .gifs in the readme.md

Hey,

I look at the .gifs in the readme.md and I notice that for example, the word VERSION is highlighted. But for me, it's not doing that. It looks like this for me:

imagem

In the .gif it looks like this.

Just to test, in gituhub it looks like this:

cmake_minimum_required(VERSION 3.15)

project(hello_world LANGUAGE CXX)

Where does this difference comes from?

CMake Initialization issue in Ubuntu

I installed CMake in VS Code in Ubuntu. After installing when I did Ctrl+Shift+P and CMake : Configure I got the below error :

CMakeTools extension was unable to initialize: Error: Invalid backend promise [See output window for more details]

Add support and code folding for #region blocks

Many VS extensions support code folding for so called #region blocks:

#region Includes
  include("xyz.cmake")
#endregion

It would be awesome if the CMake extension will support this feature too and provides code folding for such #region blocks in the future.

Syntax coloring doesn't recognize escaped hashes/pounds (#)

Version: 0.0.17

Behavior:
When you escape the hash symbol # in order to make CMake not see this as a comment, everything after the symbol is still colored as a comment, e.g.

add_compile_options(-Werror -Wno-error=\#warnings)

Here #warnings) will be highlighited as a comment.

Clean the code

  • split extension.ts
  • simplify the code using async/await
  • add tests

Adopt SnippetString API

With the December release VS Code will have real API to define a CompletionItem that is inserted as snippet, for details see microsoft/vscode#3210.

In short, we now support a subset of the more common TextMate syntax: $1, $2 etc define tabstops, ${1:value} and ${2:this is${3:nested}} placeholders, and $0 is for the final tabstop.

The API for this is contained in a new type SnippetString. It can be used as the insertText of a CompletionItem.

During a transition phase we will still support the internal, unspecified snippet syntax your extension is using but eventually remove it (roughly 2 or 3 milestones from now).

Impossible: CMake driver died immediately after successful configure

Working in Windows 8, with Visual Studio Code I try to work with the files in this repo: https://github.com/Lora-net/LoRaMac-node. Followed exactly the description that I found here: https://github.com/Lora-net/LoRaMac-node/blob/develop/Doc/development-environment.md. I am usig MinGW.

But each time I want to build, I get these errors:

Impossible: CMake driver died immediately after successful configure
and
Bad CMake executable "C:\CMake\bin". Is it installed or settings contain the correct path (cmake.cmakePath)?

But C:\Make\bin is definatley in the system path, I doublechecked that by typing make in both a cmd window and in the terminal. As suggested elsewhere, I added:

    "cmake.cmakePath": "C:\\CMake\\bin",

  "cmake.preferredGenerators": [
    "MinGW Makefiles",
    "Ninja",
    "Unix Makefiles"
  ]

And in the kit file, I added:

"preferredGenerator": { "name": "MinGW Makefiles"

But none of these solutions seem to work and now I am running out of options. Any help would be greatly appreciated!

Colored output

image

Could the white output text be colored as it shows on the terminal?

Highlight `.in` templates used by configure_file

Templates expanded by configure_file are usually using the file extension .in. It would be great if this package could also highlight those.

In e.g. Atom the secondary file extension decides what language the expanded template represents. Often that is CMake code itself and then using the extension .cmake.in (see https://github.com/lucas-clemente/language-cmake/blob/8bb2712c78ed6126a4cbd9e68548e4078734abc2/grammars/cmake%20template%20cmake.cson#L2).

If this feature would be accepted I might be able to work on a pull request for it. I just wanted to gather feedback on the idea first.

Build instructions

Build instructions for how to compile this extensions should be added.

cmake.cmakePath not working, or not sufficiently documented

I've tried C:/Program Files/CMake/bin, C:/Program Files/CMake, C:\\Program Files\\CMake\\bin, and C:\\Program Files\\CMake for cmake.cmakePath. For all of those values, I get the "not found" popup. I chose not to have CMake added to the PATH environment variable when I installed it, and I would rather not have to do so. I have CMake version 3.10.2 installed.

now i download the camke msi file and install,it works ok.

now i download the camke msi file and install,it works ok.

Originally posted by @kinglionsz in #51 (comment)

but there's issues.while cmake configure,cmake reports:

[cmake] The C compiler identification is unknown
[cmake] The CXX compiler identification is unknown
[cmake] Check for working C compiler: C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/cc
[cmake] CMake Error: Generator: execution of make failed. Make command was: "C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/make" "cmTC_b6cba/fast"
[cmake] Check for working C compiler: C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/cc -- broken
[cmake] CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/cc"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: c:/Users/lyl/helloworld/src/build/CMakeFiles/CMakeTmp
[cmake]
[cmake] Run Build Command:"C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/make" "cmTC_b6cba/fast"
[cmake] %1 不是有效的 Win32 应用程序。
[cmake] Generator: execution of make failed. Make command was: "C:/Users/lyl/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs/usr/bin/make" "cmTC_b6cba/fast"
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:2 (project)
[cmake]
[cmake]
[cmake] Configuring incomplete, errors occurred!

the same CMakeLists.txt,at WSL terminal camke will be ok,build and debug no problem.

Some binary operators are not highlighted

From: https://cmake.org/cmake/help/latest/command/if.html

Compound conditions are evaluated in the following order of precedence: Innermost parentheses are evaluated first. Next come unary tests such as EXISTS, COMMAND, and DEFINED. Then binary tests such as EQUAL, LESS, LESS_EQUAL, GREATER, GREATER_EQUAL, STREQUAL, STRLESS, STRLESS_EQUAL, STRGREATER, STRGREATER_EQUAL, VERSION_EQUAL, VERSION_LESS, VERSION_LESS_EQUAL, VERSION_GREATER, VERSION_GREATER_EQUAL, and MATCHES. Then the boolean operators in the order NOT, AND, and finally OR.

In VSCode, while EQUAL, GREATER and LESS get the syntax highlighting, but VERSION_LESS, VERSION_GREATER_EQUAL etc. do not.

image

Compared to Visual Studio 2017:

image

Improve set_property syntax highlighting

set_property commands can be quite long. It would be useful to have some extra syntax highlighting for them.

For example:
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG>)

Could maybe have the following:

  • APPEND and PROPERTY as dark blue
  • COMPILE_DEFINITIONS as light blue

Syntax highlighting not working properly when escaping quotes

I have the following in my common.cmake:

COMMAND copy \"$(TargetPath)\" .\\dist\\bin )
endif(WIN32 AND NOT MINGW)

The characters following the first escaped quote are interpreted as a string, so the 'endif' and other directives are not highlighted with the right color.

Popup message spam

I am getting spammed by "The "cmake" command is not found in PATH. Install it or use cmake.cmakePath in the workspace settings to define the CMake executable binary."

I don't care to use the editor as a make system so having to click "close" every few seconds is rather annoying when look at a cmake file.

String (quoted argument) splitted across multiple lines has incorrect highlight.

https://cmake.org/cmake/help/v3.5/manual/cmake-language.7.html#quoted-argument

message("This is a quoted argument containing multiple lines.
This is always one argument even though it contains a ; character.
Both -escape sequences and ${variable} references are evaluated.
The text does not end on an escaped double-quote like ".
It does end in an unescaped double quote.
")

The whole text between double quotes should be highlighted as string.

Case-Sensitivity Problem with CMAKE_SOURCE_DIR

Issue Type: Bug

I wanted to experiment with Visual Studio Code CMake support, so I took a project that we are currently building with Visual Studio 2017 + CMake and also with CMake 3.12 directly on different platforms. I encountered a strange problem limited specifically to the Visual Studio Code integration.

In some of our projects, we check to see if the current source directory is the same as the project directory as follows:

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)

I noticed this check was always failing, so I added some debug message statements. For some strange reason, the drive letter in the CMAKE_SOURCE_DIR is always lowercase, and the PROJECT_SOURCE_DIR is upper case, e.g.

CMAKE_SOURCE_DIR = c:\Projects...
PROJECT_SOURCE_DIR = C:\Projects...

So, the comparison fails. I checked running cmake on the Windows command line, and this isn't a problem, nor through the CMake GUI or the Visual Studio 2017 built-in CMake support. This only happens with Visual Studio Code.

Extension version: 0.0.17
VS Code version: Code 1.30.2 (61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8, 2019-01-07T22:54:13.295Z)
OS version: Windows_NT x64 10.0.17134

Improve find_package syntax highlighting

Currently find_package highlighting is very basic and it could be improved.

For example:
find_package(wxWidgets COMPONENTS core base gl REQUIRED)

Could have*

  • COMPONENTS and REQUIRED as dark blue

run programs in bash.exe

Hi, I developing in msys2 sometime , it print log to terminal generally. But cmd.exe dont support it you konw... And dbgview.exe is not support also. I can see its log only by run it in bash.exe. Such as a gui programe cause segment fault... It don't print to cmd.exe and dbgview.exe, but bash.exe.

As I konw, a bash.exe are support for ${MSYS2_DIR}/usr/bin/bash.exe or bring by git for windows. I can change the default terminal, but maybe cmke tool don't support?

Doesn't work?

Installed the extension, set my CMake path, but nothing has changed even after restarting Visual Code. I load a CMakeLists.txt and there is no color coding and I do not see "CMake" as an option in the Language Mode settings.

${workspaceRoot} in cmakePath doesn't work

I'm running vscode on a Windows 10 box. If my settings for cmakePath includes ${workspaceRoot}, the extension complains that the path is incorrect. I've tried the following two separate ways:

"cmake.cmakePath": "${workspaceRoot}\tools\cmake\bin\cmake.exe"
"cmake.cmakePath": "${workspaceRoot}/tools/cmake/bin/cmake.exe"

I get the following error:
Bad CMake executable "${workspaceRoot}\tools\cmake-3.7.2-win32-x86\bin\cmake.exe". Is it installed and a valid executable?

auto completion not working

Auto completion is not working as intended it only suggests variables and commands that are already used in the file.
OS : Windows 10 home x64
CMake : 3.17.3
vs code: 1.46.0 (system setup)
Extension version: 0.0.17
CMake Tools version : 1.4.1

Outlining for cmake scripts

could you add (if this feature is possbile to be implemented in the extension)

  • the popup with a functions outlining (like it's done for e.g. JS, C++, Python - Ctrl+Shift+O)
  • navigation throu the files via Ctrl+Click from function using to function declaration

Thank you!

Improve syntax highlighting

Please highlight if, else, endif although they are also commands. It will make the code more readable.
Thanks

No CMake found on $PATH

Hello,

I have recently installed Visual Studio Code for Windows (Windows 10). After the installation of the cmake plugin, it seems to be missing from the path:
CMake build ---> "No CMake found on $PATH"
From the terminal:
cmake --version
cmake : The term 'cmake' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • cmake --version
  •   + CategoryInfo          : ObjectNotFound: (cmake:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

Any idea how to solve this?

Thank you!

WSL support

Hi.

It would be good to add support to WSL in the cmake extension.

Thanks.

CMake Debug No active kit

Issue Type: Bug

at wsl terminal ,cmake work ok.
but in the vs code windows,cmake build will report:
mpossible: CMake driver died immediately after successful configure

Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json or your Kit configuration.

source: cmake tools(extension)

Extension version: 0.0.17
VS Code version: Code - Insiders 1.36.0-insider (68a7e5bc437b38d0281df0756997a25da2a2900c, 2019-06-18T18:40:22.519Z)
OS version: Windows_NT x64 10.0.18917

System Info
Item Value
CPUs Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz (4 x 2128)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: unavailable_off
protected_video_decode: unavailable_off
rasterization: unavailable_off
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.86GB (3.58GB free)
Process Argv C:\Users\lyl\helloworld\src
Screen Reader no
VM 0%

Code completion does not work on linux mint

I am running VSCode 1.4 on linux mint with 0.0.15 cmake extension installed. There is cmake 3.6.1 added in path variable of the system. Code is colorized, but no completion is provided. Same setup works for me on Windows 10.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.