shatur / neovim-cmake Goto Github PK
View Code? Open in Web Editor NEWCMake integration for Neovim
License: GNU General Public License v3.0
CMake integration for Neovim
License: GNU General Public License v3.0
Describe the problem or limitation you are having
The compiling is slow and I want it to speed up.
Describe the solution you'd like
Make it possible to add build arguments such as "-j8" when building.
Describe alternatives you've considered
Use vscode-CMakeTools instead.
Additional context
None.
Hello, Thank you very much for this awesome Plugin which really make it convenient to build cpp files. However, after reading a lot of documents, I can't figure out how to combine this plugin's settings with the existing c++ dap configuration.My cpp configuration lists following:
local M = {}
M.names = {
adapters = 'lldb',
configurations = 'cpp',
}
M.adapters = {
type = 'executable',
-- command = vim.fn.exepath('lldb-vscode'),
command = 'lldb-vscode',
-- env = {
-- LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = 'YES',
-- },
name = 'lldb',
}
M.configurations = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
runInTerminal = true,
console = "integratedTerminal"
},
}
return M
When I input the CMake debug
command(after configure and build), it seems that the settings of this plugin and existing cpp dap settings(aforementioned) conflict each other.
So My question is how to reset this plugin or change sth of the aforementioned cpp dap settings?(Maybe change the program part?)
My English is poor, so please pardon me for the inappropriate part! Thank you!
Bug description
Just like what is described in the title.
Steps to reproduce
Expected behavior
The QuickFix window stays open after I run the commands mentioned above so that I can see the results. This feature was available in the last few versions but seems to be broken in the latest version.
Screenshots
If a GIF is needed, I will try to make one.
Environment
Additional context
None.
Bug description
CMake select_target fails with error:
E5108: Error executing lua ...site/pack/packer/start/plenary.nvim/lua/plenary/path.lua:699: ENOENT: no such file or directory:
stack traceback:
[C]: in function 'assert'
...site/pack/packer/start/plenary.nvim/lua/plenary/path.lua:699: in function 'read'
...ack/packer/opt/neovim-cmake/lua/cmake/project_config.lua:71: in function 'get_codemodel_targets'
...vim/site/pack/packer/opt/neovim-cmake/lua/cmake/init.lua:201: in function 'command_func'
...site/pack/packer/opt/neovim-cmake/lua/cmake/commands.lua:25: in function 'run_command'
[string ":lua"]:1: in main chunk
Steps to reproduce
I use default neovim-cmake settings.
Steps:
Expected behavior
Target selection works
Environment
86c74676f73096d5d979a524d832d74c243de15c
Additional context
I tried to debug it myself and got to this:
If I change function ProjectConfig:get_codemodel_targets
to this
function ProjectConfig:get_codemodel_targets()
local reply_dir = self:get_reply_dir().filename
local codemodel_vim = vim.fn.globpath(reply_dir, 'codemodel*')
local codemodel = Path:new(codemodel_vim)
utils.notify('reply_dir = ' .. reply_dir)
utils.notify('codemodel = ' .. codemodel.filename)
local codemodel_json = vim.fn.json_decode(codemodel:read())
return codemodel_json['configurations'][1]['targets']
end
I get this in :Notifications
2022-01-21T18:12:21 CMake INFO reply_dir = /home/arcashka/projects/test2/build/linux-debug/.cmake/api/v1/reply
2022-01-21T18:12:21 CMake INFO codemodel =
This folder exists. And there is a file codemodel-v2-750e6d2bc098a122e68e.json
. So I don't understand why vim.fn.globpath
returns empty value. I'm totally new to lua too, so I can't make a progress with debug.
Good day )
First af all thanks for the plugin, great job.
I want to use Trouble against plain quickfix window.
Wold be nice to have integration with it or at least have ability to disable quickfix open on errors.
Bug description
A blank terminal appears after using CMake run and I could type nothing in that terminal
Steps to reproduce
There would be lines of output of my program.
Screenshots
Environment
Additional context
Bug description
According to the documentation:
dap_open_command = require('dap').repl.open, -- Command to run after starting DAP session. You can set it to nil if you don't want to open anything or
require('dapui').open
if you are using https://github.com/rcarriga/nvim-dap-ui
But dap_open_command = nil
does not work, it does not override the value of the dap_open_command
key in the default configuration.
Steps to reproduce
Use the following configuration and execute :CMake debug
:
require("cmake").setup({
dap_open_command = nil,
})
Expected behavior
The plugin does not open DAP REPL automatically.
Actual behavior
The plugin opens DAP REPL automatically.
Additional information
The behavior of the following code is not consistent with the description of the documentation. When you set a key of a table to nil
in lua
, the actual effect is that the key is deleted from the table, so there is no dap_open_command
key in values
table at all with dap_open_command = nil
, the overriding of the key would never happen.
neovim-cmake/lua/cmake/init.lua
Lines 7 to 9 in 797cc52
Describe the problem or limitation you are having
The dap configurations are hardcoded:
neovim-cmake/lua/cmake/init.lua
Lines 74 to 83 in 2b37c4a
The hard-coded configurations could not deal with adapters with server type which need host
and port
properties, such as CodeLLDB
, see mfussenegger/nvim-dap#307 (comment). If you use adapters with server type, an error would be raised:
Describe the solution you'd like
Allow users to customize dap configurations
Firstly thanks for this wonderful plugin
Bug description
CMake build_and_run
command runs old binary upon build break.
Further build error goes unnoticed to developers.
Steps to reproduce
:Telescope cmake create_project
:CMake configure
:Telescope cmake select_target
:CMake buid_and_run
// now introduce a compile time error
:CMake build_and_run
This run old binary
Expected behavior
Screenshots
asciinema
Environment
Additional context
I understand CMake build
and CMake run
commands exists, but in my case build_and_run
was a bit misleading to me.
@@ -54,7 +54,7 @@ function cmake.build_all(args)
end
local project_config = ProjectConfig.new()
- args = vim.list_extend({ '--build', project_config:get_build_dir().filename }, args or {})
+ args = vim.list_extend({ '--build', project_config:get_build_dir().filename, unpack(config.build_args) }, args or {})
return utils.run(config.cmake_executable, args, { on_success = project_config:copy_compile_commands() })
end
Describe the problem or limitation you are having
Pass build_args
params while executing build_all command.
Describe the solution you'd like
modify cmake.build_all
function
Bug description
When using the CMake run command. The program is not entering the target directory
Steps to reproduce
Basic configuration from the github docs
in the neovim.json file change the run dir
Expected behavior
The program should run in the run dir
Screenshots
Environment
Os: Linux
DE: Qtile
plugin hash: IDK
Additional context
Bug description
Setting 'cwd' option in g:cmake_target_asyncrun_options has no effect (it always cd into executable's directory).
Configuration
let g:cmake_target_asyncrun_options = {'cwd' : '<root>'}
Steps to reproduce
Possible fix
Changing line 49 in init.lua to this
vim.fn['asyncrun#run']('', vim.fn.extend({ cwd = target_dir }, vim.g.cmake_target_asyncrun_options), command)
fixed the issue.
At the bottom there is an example DAP configuration which currently says:
require('cmake').setup({
type = 'codelldb',
request = 'launch',
stopOnEntry = false,
runInTerminal = false,
})
That seems to be incorrect and it should be replaced with:
require('cmake').setup({
dap_configuration = {
type = 'codelldb',
request = 'launch',
stopOnEntry = false,
runInTerminal = false,
}
})
Describe the problem or limitation you are having
Currently, neovim-cmake always runs cmake
when invoking CMake. This is problematic for systems that have multiple versions of CMake, or CMake not in PATH. For example, on Centos 7, the default /usr/bin/cmake
version is CMake 2.x. For newer versions, the cmake3 package has to be installed, which must be called as cmake3
.
Describe the solution you'd like
Ideally, a new parameter should be added to the setup()
table, allowing users to customize the name and/or path of CMake. This could be either the absolute path to the CMake executable, or simply the name of the executable when it is available in PATH.
Describe the problem or limitation you are having
A complete CMake workflow usually involves testing the application with CTest. Currently, there is no :CTest
command provided by this plugin.
Describe the solution you'd like
Please provide a :CTest
command (along with all the usual options it supports).
Describe alternatives you've considered
Running ctest
from the command line (terminal split within neovim).
Additional context
See CTest reference page
Bug description
Execute :CMake configure
, an error is raised:
Steps to reproduce
build
directory on windows with neovim;:CMake configure
.Expected behavior
No errors occur.
Actual behavior
An error is raised:
Additional context
mkdir
function in plenary.nvim
splits path with plenary.path.path.sep
to determine the parent directories, the value of plenary.path.path.sep
is \
on windows. neovim-cmake
hardcode the path separator as /
, so mkdir
fails to determine the parent parts of the path, and raises the error.
Bug description
On :CMake configure
got next error message
Error executing Lua callback: ...pack/packer/start/neovim-cmake/lua/cmake/subcommands.lua:40: attempt to call field 'unpack' (a nil value)
stack traceback:
...pack/packer/start/neovim-cmake/lua/cmake/subcommands.lua:40: in function <...pack/packer/start/neovim-cmake/lua/cmake/subcommands.lua:25>
Steps to reproduce
Expected behavior
Screenshots
Environment
Additional context
neovim cmake configuration https://github.com/moeryomenko/dotfiles/blob/main/nvim/lua/debugging.lua#L25-L55
Describe the problem or limitation you are having
CMake has come up with this cool feature called presets to support common build configurations. Request to add support for CMake presets.
Describe the solution you'd like
Allow listing of presets and selecting preset similar to select_target
Describe alternatives you've considered
NA / None
Additional context
pip install cmake-init
cmake-init SDK
# input sane defaults
cd SDK
cmake --list-presets
cmake --preset dev-unix
cmake --build build/dev-unix --target all
Screenshot
asciinema cast
Bug description
"run_dir" in the default json
parameters_filecreated for every project is not missing but instead set to an empty string. I am a bit unsure if this is actually a bug or the intended behaviour but either way it's annoying since some adapters will not start if
cwd` is empty.
Steps to reproduce
"run_dir": ""
You can also run :lua local target_dir, target, target_args = require('cmake.project_config').new():get_current_target() ; print (vim.inspect({ target_dir = target_dir, target = target, target_args = target_args }))
inside vim since get_current_target
since both run
and debug
uses get_current_target()
to set cwd
.
Expected behavior
The README.md currently states that the current target directory should be used if run_dir
is missing. But it does not specify if this means an empty string or that the field should not be there to begin with.
Describe the problem or limitation you are having
I want to integrate the build type selection and build target selection with fzf, and I need to get the targets
Describe the solution you'd like
A function that returns an array of build targets in string
Describe alternatives you've considered
Copying the code in this project to the config file
Additional context
That's all about it
Describe the problem or limitation you are having
If I open the quickfix window manually i can do something like :top copen
to specify the position of the window.
Describe the solution you'd like
A configuration option to specify the position of the quickfix window.
Maybe something like this:
require('cmake').setup({
quickfix_pos = 'top'
})
Describe the problem or limitation you are having
We use environment variables for specific debug switches which we cannot set yet. A workaround is to start the neovim session with them already set.
Describe the solution you'd like
Similar interface to args
would probably ok because the dap support the env
key.
Describe alternatives you've considered
Starting neovim with the env set which isn't flexible enough
Additional context
I may be able to provide a pull request but I need to get comfortable with lua / nvim scripting first.
Bug description
Hi, when trying to load it (using lazy load from vim-plug) with c/cpp/(c)make/qml files, it fails
Steps to reproduce
Plug 'Shatur/neovim-cmake', {'for' : ['cpp', 'c', 'make', 'cmake', 'qml']}
Expected behavior
Behaves nicely and only in the wanted files, now I have it everywhere :(
Screenshots
Environment
Describe the problem
Modern CMake (3.15+) supports the cmake --install [build_dir]
command (invoked on the command line from the project root). Currently, this plugin lacks a neovim command to run the install command.
Describe the solution you'd like
Would like to have a install subcommand i.e. :CMake install
within Neovim.
Describe alternatives you've considered
Using the built-in neovim terminal just for this command.
Additional context
Reference link for the install command:
hello,
sorry for the inconvenience, but python pip asks for the "--proxy=" argument when you are behind a proxy (and I can't find a global configuration for pip). Is it possible to add a proxy option for pip.
Describe the problem or limitation you are having
When I run or debug, I get an error:
Describe the solution you'd like
NA
Additional context
Bug description
Using :Cmake run or :CMake Build_and_run does not recognize the root path. Because my assets are in the rootpath. But if I made this "./build/linux-debug/bin/program_name it works excellent.
Steps to reproduce
:Cmake run or :CMake Build_and_run
Just installed the plugin.
Expected behavior
Run the program, loading the rootpath.
Screenshots
Environment
Additional context
For this, its the only problem, but if it could be change the settings:
Bug description
Upon coredump (crash) plugin reports 0 return. It's easily misinterpreted for run step to be success.
Steps to reproduce
git clone [email protected]:shrkamat/NvimCMakePluginTest.git
cd NvimCMakePluginTest
vim test.cpp
:CMake configure
:CMake build_and_run
Expected behavior
Should report non-zero value upon failure and crash.
Environment
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
cd $HOME/.local/share/nvim/site/pack/packer/start/neovim-cmake
git log
commit f4bb9996dce8b156f9e2026bf2ffa7abbb087b86 (HEAD -> master, origin/master, origin/HEAD)
Author: thomasmore <[email protected]>
Date: Mon Feb 28 00:41:35 2022 +0300
Implement config options to customize quickfix and output behaviour (#26)
* Add option to not open quickfix window on successfull build
* Add on_output callback to track cmake progress
Additional context
Describe the problem or limitation you are having
With the current setup, the run
command runs the target in the target directory. I have some configuration files that are to be loaded upon code startup that are based on the current directory. When locally using the code for development, I copy a basic configuration file to the CMAKE_BUILD_DIR
instead of copying it to each directory in which a target exists. This then results in the run
command not working, since it can't load the configuration file.
Describe the solution you'd like
I would like the ability to set the working directory to run the target from.
Describe alternatives you've considered
I have considered copying the needed files to each location, but this would make ensuring that the configuration file is consistent between each different target location during development. I have also considered modifying the code to store the location where the files are located and load from their based on the cmake configuration, but this would involve a lot of restructuring of the existing code.
Bug description
Got the error message in the title.
Steps to reproduce
Nearly every operation raises that.
Expected behavior
Screenshots
Environment
Additional context
After taking back the toString method, everything will be OK.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.