{"id":21149331,"url":"https://github.com/neocmakelsp/neocmakelsp","last_synced_at":"2026-02-27T13:25:59.372Z","repository":{"id":41824672,"uuid":"509792975","full_name":"neocmakelsp/neocmakelsp","owner":"neocmakelsp","description":"Another cmake lsp","archived":false,"fork":false,"pushed_at":"2025-04-10T10:33:19.000Z","size":4953,"stargazers_count":254,"open_issues_count":5,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-10T11:02:21.290Z","etag":null,"topics":["cmake","lsp-server","rust"],"latest_commit_sha":null,"homepage":"https://neocmakelsp.github.io/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neocmakelsp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Decodetalkers"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2022-07-02T15:34:58.000Z","updated_at":"2025-04-10T10:33:23.000Z","dependencies_parsed_at":"2023-09-28T10:42:38.248Z","dependency_job_id":"5ab4932f-0b5c-4a12-bc86-fcf579293604","html_url":"https://github.com/neocmakelsp/neocmakelsp","commit_stats":{"total_commits":208,"total_committers":5,"mean_commits":41.6,"dds":"0.033653846153846145","last_synced_commit":"b39b72932d7dea0bba418f8ed08848570cdff9ee"},"previous_names":["neocmakelsp/neocmakelsp","decodetalkers/neocmakelsp"],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neocmakelsp%2Fneocmakelsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neocmakelsp%2Fneocmakelsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neocmakelsp%2Fneocmakelsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neocmakelsp%2Fneocmakelsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neocmakelsp","download_url":"https://codeload.github.com/neocmakelsp/neocmakelsp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248824654,"owners_count":21167344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","lsp-server","rust"],"created_at":"2024-11-20T09:34:12.711Z","updated_at":"2026-02-27T13:25:59.363Z","avatar_url":"https://github.com/neocmakelsp.png","language":"Rust","funding_links":["https://github.com/sponsors/Decodetalkers"],"categories":[],"sub_categories":[],"readme":"# CMake LSP implementation based on Tower and Tree-sitter\n\n[![Crates.io](https://img.shields.io/crates/v/neocmakelsp.svg)](https://crates.io/crates/neocmakelsp)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/neocmakelsp/neocmakelsp/release.yml?branch=master)](https://github.com/neocmakelsp/neocmakelsp/actions)\n[![codecov](https://codecov.io/gh/neocmakelsp/neocmakelsp/graph/badge.svg?token=JKWSFR51TF)](https://codecov.io/gh/neocmakelsp/neocmakelsp)\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/neocmakelsp.svg)](https://repology.org/project/neocmakelsp/versions)\n\n **Intelligent Code Completion**: Provides precise code completions by analyzing CMake files, enhancing development efficiency.\n- **Real-time Error Detection**: Integrates linting functionality to check for potential issues in your code, help maintaining code quality.\n- **Support for Neovim, Emacs, VSCode, Helix**: Compatible with these popular editors, catering to diverse developer needs.\n- **Simple Configuration**: Easy to set up and use, minimizing configuration time so you can focus on development.\n- **CLI Integration**: Not only an LSP, but also includes command-line tools for code formatting, making it convenient for different environments.\n\nIf you have any questions or want to help in other ways, feel free to join [out matrix room](https://matrix.to/#/!wqKdajPSKyqqLoFnlA:mozilla.org?via=mozilla.org\u0026via=matrix.org).\n\n# Table of Contents\n\n1. [Installation](#installation)\n2. [Documentation](#documentation)\n3. [Configuration](#configuration)\n4. [Features](#features)\n5. [Editor Support](#editor-support)\n   - [Neovim Configuration](#neovim)\n   - [Helix Configuration](#helix)\n   - [Emacs Configuration](#emacs)\n6. [Visual Examples](#visual-examples)\n7. [User Feedback](#user-feedback)\n\n\n## Installation\n\n```bash\ncargo install neocmakelsp\n```\n\n## Documentation\n\nA new documentation site can be found at https://neocmakelsp.github.io/docs.\n\n## Configuration\n\nThe configuration file can either be named .neocmake.toml or .neocmakelint.toml and is resolved in the current project directory. If neither is found, a user configuration file in $XDG_CONFIG_DIR/neocmakelsp either named config.toml or lint.toml can be used.\n\nfor example\n\n```toml\ncommand_case = \"lower_case\" # or \"upper_case\"\nenable_external_cmake_lint = true # true to use external cmake-lint\nline_max_words =  80\n\n[format]\nprogram = \"gersemi\"\n# Use two space indentation.\nargs = [\"--indent\", \"2\"]\n```\n\nYou can read https://neocmakelsp.github.io/docs for more details.\n\n## Editor Support\n\n### Neovim\n\nThe configuration of `neocmakelsp` is in [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig), so just follow `nvim-lsp-config` to setup it\n\n`neocmakelsp` can talk to clients in two ways: `stdio` and `tcp`. `tcp` is primarily for debugging. If you want to add a feature or find a bug, you should connect via `tcp`.\n\n#### `stdio`\n\n```lua\nlocal configs = require(\"lspconfig.configs\")\nlocal nvim_lsp = require(\"lspconfig\")\nif not configs.neocmake then\n    configs.neocmake = {\n        default_config = {\n            cmd = { \"neocmakelsp\", \"--stdio\" },\n            filetypes = { \"cmake\" },\n            root_dir = function(fname)\n                return nvim_lsp.util.find_git_ancestor(fname)\n            end,\n            single_file_support = true,-- suggested\n            on_attach = on_attach, -- on_attach is the on_attach function you defined\n            init_options = {\n                format = {\n                    enable = true\n                },\n                lint = {\n                    enable = true\n                },\n                scan_cmake_in_package = true -- default is true\n            }\n        }\n    }\n    nvim_lsp.neocmake.setup({})\nend\n```\n\n* In nvim0.11\n\n```lua\nvim.lsp.config(\"neocmake\", {\n    -- Some config\n    -- If none, just enable it\n})\nvim.lsp.enable(\"neocmake\")\n```\n\n#### `tcp`\n\n```lua\nif not configs.neocmake then\n    configs.neocmake = {\n        default_config = {\n            cmd = vim.lsp.rpc.connect('127.0.0.1','9257'),\n            filetypes = { \"cmake\" },\n            root_dir = function(fname)\n                return nvim_lsp.util.find_git_ancestor(fname)\n            end,\n            single_file_support = true,-- suggested\n            on_attach = on_attach, -- on_attach is the on_attach function you defined\n            init_options = {\n                format = {\n                    enable = true\n                }\n            }\n        }\n    }\n    nvim_lsp.neocmake.setup({})\nend\n\n```\n\n### Helix\n\n#### `stdio`\n\n```toml\n[[language]]\nname = \"cmake\"\nauto-format = true\nlanguage-servers = [{ name = \"neocmakelsp\" }]\n\n[language-server.neocmakelsp]\ncommand = \"neocmakelsp\"\nargs = [\"--stdio\"]\n```\n\n\n#### `tcp`\n\n```toml\n[[language]]\nname = \"neocmake\"\nauto-format = true\nlanguage-servers = [{ name = \"neocmakelsp\" }]\n\n[language-server.neocmakelsp]\ncommand = \"nc\"\nargs = [\"localhost\", \"9257\"]\n```\n\n### Emacs\n\nTo use `neocmakelsp` with eglot:\n\n``` emacs-lisp\n(use-package cmake-ts-mode\n  :config\n  (add-hook 'cmake-ts-mode-hook\n    (defun setup-neocmakelsp ()\n      (require 'eglot)\n      (add-to-list 'eglot-server-programs `((cmake-ts-mode) . (\"neocmakelsp\" \"stdio\")))\n      (eglot-ensure))))\n```\n\n## Features\n\n-   watchfile\n-   complete\n-   symbol_provider\n-   On hover\n-   Format\n-   CodeAction\n-   document_link\n-   GO TO Definition\n    -   find_package\n    -   include\n-   Search cli\n-   Get the project struct\n-   It is also a cli tool to format\n-   Lint\n-   Rename\n\n## Lint form 6.0.27\n\nLint is controlled by a configuration file. The configuration file can be at the project level (the file named `.neocmake.toml` located in the root of the project) or at the user level (when project-level configuration is not found). The user-level configuration file differs across different operating systems:\n\n* Linux:  `$XDG_CONFIG_HOME/neocmakelsp/config.toml` or  `$HOME/.config/neocmakelsp/config.toml`\n* macOS:  `$HOME/Library/Application Support/neocmakelsp/config.toml`\n* Windows: `{FOLDERID_RoamingAppData}/neocmakelsp/config.toml`\n\n```toml\ncommand_case = \"lower_case\" # or \"upper_case\"\n```\nThis will check the case of all commands.\n\n### `cmake-lint` integration\n\nWhen [`cmake-lint`](https://cmake-format.readthedocs.io/en/latest/cmake-lint.html) is installed, `neocmakelsp` can utilize it to offer linting and code analysis each time the file is saved. This functionality can be enabled or disabled in the `.neocmake.toml` file:\n\n```toml\nenable_external_cmake_lint = true # true to use external cmake-lint, or false to disable it\n```\n\nIf `enable_external_cmake_lint` is turned on but `cmake-lint` is not installed, external linting will not report any error message.\n\n### internal lint\n\ncmake-lint now is disabled by default from 0.8.18. And from 0.8.18, neocmakelsp itself starts to support similar lint functions like cmake-lint.\n\n```toml\nline_max_words = 80 # this define the max words in a line\n```\n\n### If you want to use watchfile in Neovim, set\n\n```lua\ncapabilities = {\n    workspace = {\n        didChangeWatchedFiles = {\n            dynamicRegistration = true,\n            relative_pattern_support = true,\n        },\n\n    },\n\n}\n```\n\nIt will check `CMakeCache.txt`, and get whether the package is exist\n\nSnippet Support\n\n```lua\ncapabilities = {\n   textDocument = {\n       completion = {\n           completionItem = {\n               snippetSupport = true\n           }\n       }\n   }\n}\n```\n\n### LSP init_options\n\n```lua\ninit_options = {\n    format = {\n        enable = true, -- to use lsp format\n    },\n    lint = {\n        enable = true\n    },\n    scan_cmake_in_package = false, -- it will deeply check the cmake file which found when search cmake packages.\n    semantic_token = false,\n    -- semantic_token highlight. if you use treesitter highlight, it is suggested to set with false. it can be used to make better highlight for vscode which only has textmate highlight\n}\n\n```\n\n## TODO\n\n-   Undefined function check\n\n## Visual Examples\n\n### Search\n\n![Search](./images/search.png)\n\n### symbol\n\n![Symbol](./images/ast.png)\n\n### Complete and symbol support\n\n![Complete](./images/findpackage.png)\n![CompleteFindpackage](./images/complete.png)\n\n### OnHover\n\n![onHover](./images/onhover.png)\n\n### GoToDefinition\n\n![Show](https://raw.githubusercontent.com/Decodetalkers/utils/master/cmakelsp/definition.png)\n![JumpToFile](./images/Jump.png)\n\n### Tree\n\n![TreeShow](images/tree.png)\n\n### Format cli\n\n_Note: When formatting files, make sure that your `.editorconfig` file is in your working directory_\n\n```\nformat the file\n\nUsage: neocmakelsp {format|--format|-F} [OPTIONS] \u003cFormatPath\u003e...\n\nArguments:\n  \u003cFormatPath\u003e...  file or folder to format\n\nOptions:\n  -o, --override  override\n  -h, --help      Print help\n```\n\nIt will read `.editorconfig` file to format files, just set like\n\n```ini\n[CMakeLists.txt]\nindent_style = space\nindent_size = 4\n```\n\n#### Note\n\nThe format do the min things, just do `trim` and place the first line to the right place by the indent you set, this means\n\n```cmake\nfunction(A)\n\n        set(A\n        B\n            C\n        )\n\n    endfunction()\n```\n\nit will just become\n\n```cmake\n\nfunction(A)\n\n    set(A\n        B\n            C\n        )\n\nendfunction()\n```\n\nIt just remove the space in the end, replace `\\t` at the begin of each line to ` `, if set `indent_size` to space, and format the first line to right place. It does little, but I think it is enough.\n\n\n## User Feedback\n\n* I do not know if all features will work on macOS and Windows, so if someone use macOS or Windows, please open an issue if you find any bugs.\n* I want a co-maintainer, who ideally is familiar with macOS, Windows and LSP.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneocmakelsp%2Fneocmakelsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneocmakelsp%2Fneocmakelsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneocmakelsp%2Fneocmakelsp/lists"}