Giter Site home page Giter Site logo

cmake-language-server's Introduction

cmake-language-server

PyPI AUR version GitHub Actions (Tests) codecov GitHub

CMake LSP Implementation.

Alpha Stage, work in progress.

Features

  • Builtin command completion
  • Documentation for commands and variables on hover
  • Formatting (by cmake-format)

Commands

  • cmake-language-server: LSP server

Installation

$ pip install cmake-language-server

Tested Clients

Neovim

coc.nvim
  "languageserver": {
    "cmake": {
      "command": "cmake-language-server",
      "filetypes": ["cmake"],
      "rootPatterns": [
        "build/"
      ],
      "initializationOptions": {
        "buildDirectory": "build"
      }
    }
  }
vim-lsp
if executable('cmake-language-server')
  au User lsp_setup call lsp#register_server({
  \ 'name': 'cmake',
  \ 'cmd': {server_info->['cmake-language-server']},
  \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'build/'))},
  \ 'whitelist': ['cmake'],
  \ 'initialization_options': {
  \   'buildDirectory': 'build',
  \ }
  \})
endif

Configuration

  • buildDirectory This language server uses CMake's file API to get cached variables. The API communicates using <buildDirectory>/.cmake/api/. buildDirectory is relative path to the root uri of the workspace. To configure the build tree, you need to run the cmake command such as cmake .. -DFOO=bar.

cmake-language-server's People

Contributors

charlievieth avatar dev-bz avatar heywhy avatar jan-grimo avatar kolanich avatar offa avatar otreblan avatar r-burns avatar regen100 avatar rwols 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmake-language-server's Issues

self._api is None during completion request

Hello,

I try to setup cmake-language-server for kakoune, and I am stuck with:

ERRO Error response from server: Failure { jsonrpc: Some(V2), error: Error { code: InvalidParams, message: "AttributeError: \'NoneType\' object has no attribute \'search_variable\'", data: Some(String("{\'traceback\': [\'  File \"/usr/lib/python3.8/site-packages/pygls/protocol.py\", line 324, in _handle_request\\n    self._execute_request(msg_id, handler, params)\\n\', \'  File \"/usr/lib/python3.8/site-packages/pygls/protocol.py\", line 249, in _execute_request\\n    self._send_response(msg_id, handler(params))\\n\', \'  File \"/usr/lib/python3.8/site-packages/cmake_language_server/server.py\", line 75, in completions\\n    variables = self._api.search_variable(token)\\n\']}")) }, id: Num(1) }

In short, it seems the variable _api in server.py line 67 is None and it should not. This variable is also used in the following parts of the method.
I can help debugging this if you need more information.

Best,
Charles

Support python 3.12

Python 3.12 has been released, my guess is this probably just needs updates to tox.ini and pyproject.toml

broken due to pygls API change

❯ cmake-language-server
Traceback (most recent call last):
  File "/usr/bin/cmake-language-server", line 33, in <module>
    sys.exit(load_entry_point('cmake-language-server==0.1.6', 'console_scripts', 'cmake-language-server')())
  File "/usr/bin/cmake-language-server", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/cmake_language_server/server.py", line 8, in <module>
    from pygls.lsp.methods import (
ModuleNotFoundError: No module named 'pygls.lsp.methods'

cmake-language-server: 0.1.6
pygls: 1.0.1

Native neovim lsp -support or example?

Example config in Lua:

local lsp_status = require("lsp-status")

lspconfig.cmake-language-server.setup({
        cmd = {"cmake-language-server"},
        filetypes = {"cmake"},
        on_attach = custom_attach,
        init_options = {
            buildDirectory = "build/"
        }
})

something like this? it is not working for me.

Broken, module not found for 'attrs' package even with attrs installed.

Not able to run. I continue to see this error even after installing attrs package.

Traceback (most recent call last):
  File "/home/frank/.local/bin/cmake-language-server", line 5, in <module>
    from cmake_language_server.server import main
  File "/home/frank/.local/lib/python3.10/site-packages/cmake_language_server/server.py", line 8, in <module>
    from lsprotocol.types import (
  File "/home/frank/.local/lib/python3.10/site-packages/lsprotocol/types.py", line 14, in <module>
    import attrs
ModuleNotFoundError: No module named 'attrs'

"format request failed, no matching language servers" while LSPInfo seems OK and completion is working.

Hi, I am trying to make the formatting function work in neovim & nvim-lspconfig.

I installed cmake-format and cmake-language-server via Mason there is no error shown.

I configured cmake-language-server like this: (NvChad)

-- if you just want default config for the servers then put them in a table
local servers = { "html", "cssls", "tsserver" , "cmake"}

for _, lsp in ipairs(servers) do
  lspconfig[lsp].setup {
    on_attach = on_attach,
    capabilities = capabilities,
  }
end

Now the completion is working, and I can see this via LSPInfo:

image

And, In LSPLog there is an error but it does seems to matter:

image

So, what's the problem?

image

pdm-pep517 is deprecated

https://pypi.org/project/pdm-pep517/ says:

This project has been renamed and re-published as [pdm-backend](https://pypi.org/project/pdm-backend)

Here's a minimal diff to switch:

--- pyproject.toml.orig 2023-03-09 10:01:30.924441300 +0000
+++ pyproject.toml
@@ -38,9 +38,9 @@ cmake-language-server = "cmake_language_
 
 [build-system]
 requires = [
-    "pdm-pep517>=1.0.0",
+    "pdm-backend>=1.0.0",
 ]
-build-backend = "pdm.pep517.api"
+build-backend = "pdm.backend"
 
 [tool.pdm.version]
 source = "scm"

ValueError: 'from' is not a valid parameter name

[stderr]   File "/home/chriselrod/.local/lib/python3.11/site-packages/pydantic/main.py", line 369, in __new__
[stderr]     cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
[stderr]                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr]   File "/home/chriselrod/.local/lib/python3.11/site-packages/pydantic/utils.py", line 231, in generate_model_signature
[stderr]     merged_params[param_name] = Parameter(
[stderr]                                 ^^^^^^^^^^
[stderr]   File "/usr/lib64/python3.11/inspect.py", line 2721, in __init__
[stderr]     raise ValueError('{!r} is not a valid parameter name'.format(name))
[stderr] ValueError: 'from' is not a valid parameter name
[internal] Fri Feb  3 08:23:50 2023:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

I am on python 3.11 and cmake-language-server 0.1.5 (even though 0.1.6 seems to be the latest release) because pip list --outdated doesn't list cmake-language-server and an explicit upgrade claims it's already satisfied

$ pip install cmake-language-server -U
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cmake-language-server in /home/chriselrod/.local/lib/python3.11/site-packages (0.1.5)

how to use it with Sublime Text?

i wasn't able to make the server run in Sublime Text.

here are my settings:

{
  "clients":
  {
    "cmake": {
      "command": ["/home/user/.local/bin/cmake-language-server"],
      "enabled": true,
      "scopes": ["source.cmake"],
      "syntaxes": [
        "Packages/Sublime-CMakeLists/CMake.sublime-syntax"
      ],
      "initializationOptions": {
        "buildDirectory": "build"
      }
    }
  }
}

i am using Sublime Text 3
Sublime LSP plugin

Optimize textDocument/formatting

The response to textDocument/formatting is the entire new buffer. Even when there are no actual changes. It would be nice to receive back only the parts that changed in a document.

format

I install cmake-format and config cmake-language-server

  "languageserver": {
    "cmake": {
      "command": "cmake-language-server",
      "filetypes": ["cmake"],
      "rootPatterns": [
        "build/"
      ],
      "initializationOptions": {
        "buildDirectory": "build"
      }
    }
  }

It can't format CMakeLists.txt when I saved it.

Windows new-line breaks parser

On windows I couldn't get a CMakeLists.txt to parse. I tried adding a test like this:

test_windows_newline = make_parser_test("a()\r\n", [("a", []), '\r', '\n'])

But it doesn't pass and returns no tokens.

    def test() -> None:
        actual_token, actual_remain = ListParser().parse(liststr)
>       assert actual_token == expect_token
E       AssertionError: assert [] == [('a', []), '\r', '\n']
E         Right contains 3 more items, first extra item: ('a', [])
E         Full diff:
E         - [('a', []), '\r', '\n']
E         + []

Use the cmake-file-api to generate goto-definition, workspace symbols, references etc

  • You can use the cache-v2 reply file and trivially transform that information to a workspace-symbol response.
  • You can use the information in a target-x-BuildType file to generate references for a target. e.g. the backtraceGraph.commands array is more-or-less a list of references.
  • You can also use this same file to jump to a target definition.
  • You can evaluate a selected variable recursively to find it's ultimate variable from the above-mentioned cache-v2 reply file.

There's a ton more I'm sure you can do, this was just from looking at it for a few minutes.

[advice] Why not add cmake-format to optional-dependencies ?

cmake-format is also a python project. Why not add it to optional-dependencies of pyproject.toml? And in the code:

formatted = subprocess.check_output(
    ["cmake-format", "-"],
    cwd=str(Path(doc.path).parent),
    input=content,
    universal_newlines=True,
)

subprocess will fork a thread which is slower than call a python module from python.

If

from cmakelang.format.__main__ import process_file, configuration
process_file(configuration.Configuration(), "set (A  1)\n set (B 3)")

, it will be faster.

Install error

Not sure how to proceed.

ERROR: Could not find a version that satisfies the requirement cmake-language-server (from versions: none)
ERROR: No matching distribution found for cmake-language-server

Error: typeguard.TypeCheckError: lsprotocol.types.TextDocumentSaveRegistrationOptions is not an instance of lsprotocol.types.SaveOptions

python version 3.11.5

$ pip install cmake-language-server
$ cmake-language-server
Traceback (most recent call last):
  File "cmake-language-server", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/cmake_language_server/server.py", line 263, in main
    CMakeLanguageServer("cmake-language-server", __version__).start_io()  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/cmake_language_server/server.py", line 207, in __init__
    @self.feature(
     ^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/pygls/feature_manager.py", line 192, in decorator
    if options_type and not is_instance(options, options_type):
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/pygls/lsp/__init__.py", line 136, in is_instance
    check_type(o, t)
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/typeguard/_functions.py", line 74, in check_type
    check_type_internal(value, expected_type, memo)
  File "/home/user/.pyenv/versions/3.11.5/envs/cmake-language-server-dir/lib/python3.11/site-packages/typeguard/_checkers.py", line 680, in check_type_internal
    raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
typeguard.TypeCheckError: lsprotocol.types.TextDocumentSaveRegistrationOptions is not an instance of lsprotocol.types.SaveOptions
$ pip list 
Package               Version
--------------------- ----------
attrs                 23.1.0
build                 1.0.3
cattrs                23.1.2
click                 8.1.7
cmake-language-server 0.1.7
lsprotocol            2023.0.0b1
packaging             23.2
pip                   23.2.1
pip-tools             7.3.0
pygls                 1.1.0
pyproject_hooks       1.0.0
setuptools            68.2.2
typeguard             3.0.2
wheel                 0.41.2

Differences in document hover content

Hello,
I'm switch from coc.nvim to neovim builtin Lsp, but I noticed the document hover content is entirely different.
Document hover from coc.nvim is as follow:
image
However, when I toggle document hover for the same command (add_executable), I only got:

add_executable(<name> [WIN32] [MACOSX_BUNDLE]
               [EXCLUDE_FROM_ALL]
               [source1] [source2 ...])

In addition, when I toggle document hover for for example find_package, I only got find_package() and nothing else.

I'd like to know what the original behavior should be, and whether the detailed documentation is generated by coc-cmake, or whether I'm not getting the same results on nvim-lsp because of the configuration.

Detect Definitions in {project_root}/cmake/XYZ.cmake

I am using the coc.nvim client and I have a CMakeLists.txt which includes a helper.cmake (e.g. include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeHelper.cmake) ) file to define macros.
I would like to be able to jump to the definition of these macros. I know that this is possible with ctags.
Is there a way to use the language-server to jump to such a macro definition instead?

Errors/Warnings are not displayed, difficulty configuring

Hello. I'm having difficulty configuring the language server. I'm using neovim and the server attaches correctly. However, no errors or warnings are being displayed. Probably it's because I failed to configure the CMake API as described here.

How can I create the necessary files for the CMake API? I'm using Ubuntu 22.04 and found the related CMake docs but they don't have any information on generating the related files. I'm assuming I need to generate a file similar to compile-commands.json?

AttributeError: <enum 'Extra'> member has no attribute 'allow'

Hello, When I open a CMakeLists.txt with neovim configured with cmake-language-server, the lsp server exited immediately with errors.

typing :LspLog I get this:

CleanShot 2022-11-13 at 12 20 02@2x

python --version
Python 3.12.0a0

neovim --version
NVIM v0.9.0-dev

system: Ubuntu 22.04

The `textDocument/completion` request may not contains the `request` parameter

Hello,

Thank you for this server,

I have a problem using this LSP server, concerning the textDocument/completion request. It seems the server expect a context parameter while the LSP specification if I am not mistaken has it as optional:
From the microsoft website

Request:

method: ‘textDocument/completion’

params: CompletionParams defined as follows:

export interface CompletionParams extends TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams {
	/**
	 * The completion context. This is only available if the client specifies
	 * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true`
	 */
	context?: CompletionContext;
}

For context, I am trying to make this LSP server works with the kakoune lsp plugin see related issue here.

What does buildDirectory do?

There's a buildDirectory setting in the initializationOptions. It would be nice to have an explanation in the readme on what this setting does.

Thoughts on the formatter

I just noticed that there doesn't seem to be much/any documentation on the formatter's options/args, and was wondering if it's configurable, and/or what the defaults even are?

As an aside, do you have any thoughts on splitting the formatter into its own package? I'm just saying this because I noticed that this LSP actually conflicts (same binary name cmake-format) with https://github.com/cheshirekow/cmake_format which seems to possibly be a more fleshed out formatter.

E5108: Error executing lua ...neovim/HEAD-f2906a4_2/share/nvim/runtime/lua/vim/lsp.lua:1317: table index is nil

❯ pip3 list | grep cmake-language-server
cmake-language-server  0.1.2
❯ pip3 --version
pip 21.1.2 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
❯ nvim --version
NVIM v0.5.0-dev+1384-gf2906a466
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210607-31073-mvxyy9/build/config -I/tmp/neovim-20210607-31073-mvxyy9/src -I/usr/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210607-31073-mvxyy9/build/src/nvim/auto -I/tmp/neovim-20210607-31073-mvxyy9/build/include
Compiled by liyong@mbp

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-f2906a4_2/share/nvim"

Run :checkhealth for more info

When I open a CMakeLists.txt, I got errors:

Error detected while processing CursorHold Autocommands for "*":
E5108: Error executing lua ...neovim/HEAD-f2906a4_2/share/nvim/runtime/lua/vim/lsp.lua:1317: table index is nil

cmake-format from standard input

Can cmake-format have support for formatting a file from standard input to standard output? Something like cmake-format --stdin. This would be useful for editor plugins.

Visual Studio Code support

Is there a way to make this extension work with VSCode?

Perhaps the developers could consider an extensions based on the clangd one?

Thanks!

cmakels error with emacs

I have configured emacs to talk with cmake-language-server for lsp completion. Below, is the error which I get stderr.log. Please let me know how to resolve this issue. The error is continuously occuring, after I open a CMakeLists.txt for editing.

Installed server through macports.

sudo port install cmake-language-server
emacs config is as follows..

`(use-package cmake-mode
:mode ("CMakeLists\.txt\'" "\.cmake\'")
:hook (cmake-mode . lsp-deferred))

(use-package cmake-font-lock
:after cmake-mode
:config (cmake-font-lock-activate))
`
stderr.log file
Traceback (most recent call last):
File "/opt/local/bin/cmake-language-server", line 8, in
sys.exit(main())
^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cmake_language_server/server.py", line 263, in main
CMakeLanguageServer("cmake-language-server", version).start_io() # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/cmake_language_server/server.py", line 65, in init
@self.feature(
^^^^^^^^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pygls/feature_manager.py", line 174, in decorator
raise TypeError(
TypeError: Options of method "textDocument/completion" should be instance of type <class 'lsprotocol.types.CompletionOptions'>

Process cmakels stderr finished

Exception when requesting textDocument/hover

Given the following cmake file: https://github.com/llvm/llvm-project/blob/master/libc/src/stdio/CMakeLists.txt

If I hover over add_entrypoint_object, I see the following exception:

cmake: ERROR:pygls.protocol:Failed to handle request 2 textDocument/hover Object(position=Object(character=7, line=0), textDocument=Object(uri='file:///home/raoul/Documents/Programming/llvm-project/libc/src/stdio/CMakeLists.txt'))
:: --> cmake textDocument/hover(2): {'position': {'character': 7, 'line': 0}, 'textDocument': {'uri': 'file:///home/raoul/Documents/Programming/llvm-project/libc/src/stdio/CMakeLists.txt'}}
cmake: Traceback (most recent call last):
:: <~~ cmake 2: {'message': "AttributeError: 'NoneType' object has no attribute 'get_command_doc'", 'code': -32602, 'data': '{\'traceback\': [\'  File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/pygls/protocol.py", line 317, in _handle_request\\n    self._execute_request(msg_id, handler, params)\\n\', \'  File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/pygls/protocol.py", line 242, in _execute_request\\n    self._send_response(msg_id, handler(params))\\n\', \'  File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/cmake_language_server/server.py", line 142, in hover\\n    doc = c(word[0])\\n\', \'  File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/cmake_language_server/server.py", line 136, in <lambda>\\n    lambda x: self._api.get_command_doc(x.lower()),\\n\']}'}
cmake:   File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/pygls/protocol.py", line 317, in _handle_request
cmake:     self._execute_request(msg_id, handler, params)
cmake:   File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/pygls/protocol.py", line 242, in _execute_request
cmake:     self._send_response(msg_id, handler(params))
cmake:   File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/cmake_language_server/server.py", line 142, in hover
cmake:     doc = c(word[0])
cmake:   File "/home/raoul/.config/sublime-text-3/Cache/LSP-cmake/lib/python3.8/site-packages/cmake_language_server/server.py", line 136, in <lambda>
cmake:     lambda x: self._api.get_command_doc(x.lower()),
cmake: AttributeError: 'NoneType' object has no attribute 'get_command_doc'

Editor: Sublime Text with LSP plugin
cmake-language-server version: 0.1.2

insertTextFormat (and other values) provided as `null`

Values in LSP may only be null where explicitly stated in the spec, i.e. with their type including | null.

insertTextFormat has the specification:

	/**
	 * The format of the insert text. The format applies to both the
	 * `insertText` property and the `newText` property of a provided
	 * `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
	 */
	insertTextFormat?: InsertTextFormat;

And therefore may not be null (but may be omitted, hence the ?).

But cmake-language-server returns null for insertTextFormat. this is not valid, and breaks conforming clients.

Example:

2021-04-20 17:32:21,948 - DEBUG - RX: Received message: b'{"id": 3, "jsonrpc": "2.0", "result": {"isIncomplete": false, "items": [{"label": "set", "kind": 3, "detail": null, "documentation": "```cmake\\nset()\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}, {"label": "set_directory_properties", "kind": 3, "detail": null, "documentation": "```cmake\\nset_directory_properties(PROPERTIES prop1 value1 [prop2 value2] ...)\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set_directory_properties", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}, {"label": "set_property", "kind": 3, "detail": null, "documentation": "```cmake\\nset_property(<GLOBAL                      |\\n              DIRECTORY [<dir>]           |\\n              TARGET    [<target1> ...]   |\\n              SOURCE    [<src1> ...]\\n                        [DIRECTORY <dirs> ...] |\\n                        [TARGET_DIRECTORY <targets> ...]\\n              INSTALL   [<file1> ...]     |\\n              TEST      [<test1> ...]     |\\n              CACHE     [<entry1> ...]    >\\n             [APPEND] [APPEND_STRING]\\n             PROPERTY <name> [<value1> ...])\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set_property", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}, {"label": "set_source_files_properties", "kind": 3, "detail": null, "documentation": "```cmake\\nset_source_files_properties(<files> ...\\n                            [DIRECTORY <dirs> ...]\\n                            [TARGET_DIRECTORY <targets> ...]\\n                            PROPERTIES <prop1> <value1>\\n                            [<prop2> <value2>] ...)\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set_source_files_properties", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}, {"label": "set_target_properties", "kind": 3, "detail": null, "documentation": "```cmake\\nset_target_properties(target1 target2 ...\\n                      PROPERTIES prop1 value1\\n                      prop2 value2 ...)\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set_target_properties", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}, {"label": "set_tests_properties", "kind": 3, "detail": null, "documentation": "```cmake\\nset_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)\\n```", "deprecated": false, "preselect": false, "sortText": null, "filterText": null, "insertText": "set_tests_properties", "insertTextFormat": null, "textEdit": null, "additionalTextEdits": null, "commitCharacters": null, "command": null, "data": null}]}}'

I was led to believe that this was fixed in pygls under openlawlibrary/pygls#139

Missing target_precompile_headers

target_precompile_headers


As a side note, do you have any desire to support included packages (that are distributed) that bring in their own vars/functions? Things like FindPackageHandleStandardArgs, FindPackageMessage, or cmake_dependent_option as an example.

Error Upon running the cmake-language-server binary

I intalled the package in my system using pip
I get the exception upon running the executable:

  File "/home/mohamed-aziz/.local/bin/cmake-language-server", line 8, in <module>
    sys.exit(main())
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/cmake_language_server/server.py", line 263, in main
    CMakeLanguageServer("cmake-language-server", __version__).start_io()  # type: ignore
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/cmake_language_server/server.py", line 212, in __init__
    def run_cmake(*args: Any) -> None:
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/pygls/feature_manager.py", line 192, in decorator
    if options_type and not is_instance(options, options_type):
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/pygls/lsp/__init__.py", line 136, in is_instance
    check_type(o, t)
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/typeguard/_functions.py", line 74, in check_type
    check_type_internal(value, expected_type, memo)
  File "/home/mohamed-aziz/.local/lib/python3.8/site-packages/typeguard/_checkers.py", line 680, in check_type_internal
    raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
typeguard.TypeCheckError: lsprotocol.types.TextDocumentSaveRegistrationOptions is not an instance of lsprotocol.types.SaveOptions ```

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.