Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

CMake select_target fails with error #21

Closed
arcashka opened this issue Jan 21, 2022 · 2 comments
Closed

CMake select_target fails with error #21

arcashka opened this issue Jan 21, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@arcashka
Copy link

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.

@arcashka arcashka added the bug Something isn't working label Jan 21, 2022
@Shatur
Copy link
Owner

Shatur commented Jan 21, 2022

Can't reproduce using your steps on my machine. Tested on ArchLinux with Neovim 0.6.1 and CMake 3.22.1.

@arcashka
Copy link
Author

I managed to make a minimal config with only neovim-cmake. And bug is gone.
That's my bad, sorry. I'm gonna try to fix it in my config.

So I'm gonna close this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants