Code Monkey home page Code Monkey logo

Comments (7)

JuniorSuperTux avatar JuniorSuperTux commented on June 12, 2024 1

Now that I noticed, the CMake path is sus. My best guess is that some autocmd changed the working directory of neovim, I'll check it tomorrow, thanks for your advice

from neovim-cmake.

JuniorSuperTux avatar JuniorSuperTux commented on June 12, 2024 1

After some attempting, the CMake part seems to be working, but I still haven't got nui to work.

from neovim-cmake.

Shatur avatar Shatur commented on June 12, 2024

I want to integrate the build type selection and build target selection with fzf, and I need to get the targets

The plugin is not tied to picker, it uses vim.ui.select. You can just install something like https://github.com/stevearc/dressing.nvim and to use FZF or Telescope for target selection.

A function that returns an array of build targets in string

You can reuse any function from the plugin. To get targets use the following:

local ProjectConfig = require('cmake.project_config') -- Import it

local project_config = ProjectConfig.new()
local targets = project_config:get_codemodel_targets()

In case you want to do it yourself.

from neovim-cmake.

JuniorSuperTux avatar JuniorSuperTux commented on June 12, 2024

I was trying to combine the example you gave me with nui, but I got some problems

/home/supertux/build/linux-debug/.cmake/api/v1/reply is not accessible by the current user!                                                                                                                        
E5108: Error executing lua ...im/site/pack/packer/start/nui.nvim/lua/nui/menu/init.lua:82: attempt to index field 'size' (a nil value)                                                                             
stack traceback:                                                                                                                                                                                                   
        ...im/site/pack/packer/start/nui.nvim/lua/nui/menu/init.lua:82: in function 'make_default_prepare_node'                                                                                                    
        ...im/site/pack/packer/start/nui.nvim/lua/nui/menu/init.lua:269: in function 'init'                                                                                                                        
        .../site/pack/packer/start/nui.nvim/lua/nui/object/init.lua:111: in function 'nui_menu'                                                                                                                    
        /home/supertux/.config/nvim/init.lua:526: in function 'CMake_select_target_nui'                                                                                                                            
        [string ":lua"]:1: in main chunk  

Unable to find codemodel file

The following is how I did it:

local nui_menu = require('nui.menu')
local nui_event = require('nui.utils.autocmd').event

local function convert_array_to_menu(array)
    local menu_items = {}
    for _, name in ipairs(array) do
        table.insert(menu_items, nui_menu.item(name))
    end
    return menu_items
end

function CMake_select_target_nui()
    local project_config = require('cmake.project_config').new()
    local targets = project_config:get_codemodel_targets()
    local menu = nui_menu({
        border = {
            style = "single",
            text = {
                top = "[Select Target]",
                top_align = "center",
            },
        }
    }, {
        lines = {
            convert_array_to_menu(targets)
        }
    })
    menu:mount()
    menu:on(nui_event.BufLeave, menu.menu_props.on_close, { once = true })
end

Is there anything that I didn't do properly? (Sorry I've never coded in lua before)

from neovim-cmake.

Shatur avatar Shatur commented on June 12, 2024

I don't see any error caused by my plugin (all comes from nui). And it looks like this error:

/home/supertux/build/linux-debug/.cmake/api/v1/reply is not accessible by the current user!

Indicates that you have permission issues.

from neovim-cmake.

JuniorSuperTux avatar JuniorSuperTux commented on June 12, 2024

How should I solve the permission issue? Everything seems to work fairly fine when I use the default one that comes with this plugin

from neovim-cmake.

Shatur avatar Shatur commented on June 12, 2024

How should I solve the permission issue?

How can I know? Check this folder, maybe it doesn't exist. You need to configure your CMake project first.

from neovim-cmake.

Related Issues (20)

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.