27 releases (4 breaking)

new 0.5.10 Mar 28, 2023
0.5.4 Feb 28, 2023
0.4.9 Dec 18, 2022
0.4.7 Nov 14, 2022
0.2.4 Jul 17, 2022

#3 in Text editors

Download history 82/week @ 2022-12-06 82/week @ 2022-12-13 123/week @ 2022-12-20 105/week @ 2022-12-27 85/week @ 2023-01-03 90/week @ 2023-01-10 159/week @ 2023-01-17 98/week @ 2023-01-24 133/week @ 2023-01-31 111/week @ 2023-02-07 239/week @ 2023-02-14 119/week @ 2023-02-21 327/week @ 2023-02-28 192/week @ 2023-03-07 114/week @ 2023-03-14 90/week @ 2023-03-21

734 downloads per month

MIT license

3.5MB
3K SLoC

CMake lsp based on Tower and treesitter

Crates.io

It is a CMake lsp based on tower-lsp and treesitter

Install

cargo install neocmakelsp

Setup

The config of neocmakelsp is in nvim-lsp-config, so just follow nvim-lsp-config to setup it

neocmakelsp has two start ways: stdio and Tcp. Tcp is for debug. If you want to help me and debug is , you should start it with Tcp way.

Stdio

local configs = require("lspconfig.configs")
local nvim_lsp = require("lspconfig")
if not configs.neocmake then
    configs.neocmake = {
        default_config = {
            cmd = { "neocmakelsp", "--stdio" },
            filetypes = { "cmake" },
            root_dir = function(fname)
                return nvim_lsp.util.find_git_ancestor(fname)
            end,
            single_file_support = true,-- suggested
            on_attach = on_attach -- on_attach is the on_attach function you defined
        }
    }
    nvim_lsp.neocmake.setup({})
end

Tcp

if not configs.neocmake then
    configs.neocmake = {
        default_config = {
            cmd = vim.lsp.rpc.connect('127.0.0.1','9257'),
            filetypes = { "cmake" },
            root_dir = function(fname)
                return nvim_lsp.util.find_git_ancestor(fname)
            end,
            single_file_support = true,-- suggested
            on_attach = on_attach -- on_attach is the on_attach function you defined
        }
    }
    nvim_lsp.neocmake.setup({})
end

Help needed

new version will not work on mac and windows, so I need your help

Features

  • watchfile
  • complete
  • symbol_provider
  • On hover
  • Format
  • GO TO Definitation
    • find_package
    • include
  • Search cli
  • Get the project struct

If you want to use watchfile in neovim, use the nightly one, and set

capabilities = {
    workspace = {
        didChangeWatchedFiles = {
            dynamicRegistration = true,
        },
    },
}

It will check CMakeCache.txt, and get weather the package is exist

TODO

  • Undefined function check

Show

Search

symbol

Symbol

Complete and symbol support

Complete CompleteFindpackage

OnHover

onHover

GoToDefinition

Show JumpToFile

Tree

TreeShow

Dependencies

~12–19MB
~371K SLoC