Coder Social home page Coder Social logo

neovim-cmake's People

Contributors

alexaut avatar griffinwxk avatar jafarabdi avatar jkipper avatar jxi24 avatar natr1x avatar psyhich avatar shatur avatar spindensity avatar thomasmore avatar xubury 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

Watchers

 avatar  avatar  avatar

neovim-cmake's Issues

Allow configuraltion of build arguments

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.

Questions about dap configurations

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!

When running "CMake build" and "CMake clean", the quickfix window closes automatically.

Bug description
Just like what is described in the title.

Steps to reproduce

init.lua:
require('cmake').setup({ parameters_file = 'neovim.json', build_dir = '{cwd}/build/{os}-{build_type}', default_projects_path = '~/Projects', configure_arguments = '-D CMAKE_EXPORT_COMPILE_COMMANDS=1 -G Ninja', build_arguments = '-j8', asyncrun_options = { save = 2 }, target_asyncrun_options = {}, dap_configuration = { type = 'cpp', request = 'launch' }, dap_open_command = require('dap').repl.open })
neovim.json:
{"arguments": [], "currentTarget": "all", "buildType": "Debug"}
Minimal configuration

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

  • OS: Arch Linux in WSL2.
  • Desktop environment: None.
  • Plugins commit hash: 32be7c1

Additional context
None.

CMake select_target fails with error

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:

  1. CMake create_project (C++, name: test2, folder ~/projects)
  2. CMake configure (works fine)
  3. CMake select target

Expected behavior
Target selection works

Environment

  • OS: Manjaro 21.2.1 Qonos
  • Desktop environment: bspwm
  • Plugins commit hash: 86c74676f73096d5d979a524d832d74c243de15c
  • Neovim: NVIM v0.6.0
  • CMake: 3.22.1

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.

Integration with 'trouble.nvim'

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.

No output after CMake Run

Bug description
A blank terminal appears after using CMake run and I could type nothing in that terminal

Steps to reproduce

Minimal configuration
  1. After building a c++ program
  2. Run CMake run
  3. Unexpected blank terminal is popped up
    Expected behavior

There would be lines of output of my program.
Screenshots

image

Environment

  • OS: Windows
  • Desktop environment: N/A
  • Plugins commit hash:

Additional context

"dap_open_command = nil" does not work

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.

function cmake.setup(values)
setmetatable(config, { __index = vim.tbl_extend('force', config.defaults, values) })
end

Allow users to customize dap configurations

Describe the problem or limitation you are having

The dap configurations are hardcoded:

local config = {
type = 'cpp',
name = 'Debug CMake target',
request = 'launch',
program = target,
args = splitted_args,
cwd = target_dir,
}
dap.run(config)
dap.repl.open()

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:

Snipaste_2021-09-30_13-19-39

Describe the solution you'd like

Allow users to customize dap configurations

CMake build_and_run command runs old binaries

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

  • If build breaks, compile error logs should be shown & target binary shouldn't be run.

Screenshots
asciinema

Environment

  • OS: Ubuntu
  • Desktop environment: Gnome
  • Plugins commit hash:

Additional context
I understand CMake build and CMake run commands exists, but in my case build_and_run was a bit misleading to me.

'CMake build_all' does not respect 'build_args'

@@ -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

The program is not entering the directory

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

g:cmake_target_asyncrun_options ignores 'cwd' option

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

  1. Save some a.txt file
  2. Run program opening ./a.txt file
  3. See program fails

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.

Error in README.MD

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,
  }
})

Add the ability to run program in built-in terminal

Description

My C++ code includes cin, which need some input value, but I can't input in the CMake window. It simply cannot make changes.

Steps to reproduce

Below is a very simple example, it wants a input value, but I can't make any changes.

image

Allow customizing of CMake executable

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.

Support the :CTest command

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

"CMake configure" raises error on windows

Bug description
Execute :CMake configure, an error is raised:

Snipaste_2021-10-13_22-29-32

Steps to reproduce

  1. Open any fresh cmake project without build directory on windows with neovim;
  2. Execute :CMake configure.

Expected behavior

No errors occur.

Actual behavior

An error is raised:

Snipaste_2021-10-13_22-29-32

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.

Breaking change: after 23a63ffd7b709b0f9f407c47523e9bbe322cde37

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

  • OS: Arch Linux
  • Desktop environment: Sway
  • Neovim version: v0.7.0(LuaJIT 2.1.0-beta3)

Additional context

neovim cmake configuration https://github.com/moeryomenko/dotfiles/blob/main/nvim/lua/debugging.lua#L25-L55

Add support for CMake presets

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

documentation
demo

Steps

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

'run_dir' is not actually missing by default

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 ifcwd` is empty.

Steps to reproduce

  1. Create and configure a new cmake project
  2. See that the created json file contains "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.

API For Fetching Build Targets

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

Position of the quickfix window

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'
})

Support for setting environment variables during launch/debug

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.

Support lazy loading with vim-plug

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

  • OS: Arch
  • Desktop environment: I3wm
  • Plugins commit hash: 86c7467
    Additional context

Provide a suitable command to run `cmake --install [build_dir]` within neovim

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:

proxy support for pip

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.

execute command :CMake run, report err

Describe the problem or limitation you are having

When I run or debug, I get an error:
图片

Describe the solution you'd like

  1. When executing cmake run or debug, everything is normal and the result of the target operation is displayed
  2. When CMakeLists.txt changes, reload cmake build config.. just like vscode
  3. How to add the cmake command to the leadermap of lunarvim
    Describe alternatives you've considered

NA
Additional context

Run does not recognize root path

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

  • OS: Kubuntu 21.10
  • Desktop environment: KDE plasma 5
  • Plugins commit hash:

Additional context

For this, its the only problem, but if it could be change the settings:

  • Telescope cmake select_target
  • Telescope cmake select_build_type
    This settings could be also available in :CMake menu? Like :CMake select_target

Upon coredump (crash) plugin reports 0 return

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
Minimal configuration

Expected behavior
Should report non-zero value upon failure and crash.

Screenshots
CMake build_and_run, reports success for crashed processes

Environment

  • OS:
lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
  • Desktop environment:
  • Plugins commit hash:
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

Allow different directory to run target from

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.

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.