cquery

The details below describe how to install and configure the cquery language server found here.

Installing the Language Server

Refer to the installation details found here.
With the software installed test the installation by running cquery.exe -h at the command line prompt, which should result in the following output:
cquery is a low-latency C/C++/Objective-C language server.

Mode:
  --check <path>
                Load the project and try to create a translation unit for path.
                This can be used to quickly test to see if your project
                configuration will work. The current directory is used as the
                project directory.
  --test-unit   Run unit tests.
  --test-index <opt_filter_path>
                Run index tests. opt_filter_path can be used to specify which
                test to run (ie, "foo" will run all tests which contain "foo"
                in the path). If not provided all tests are run.
  (default if no other mode is specified)
                Run as a language server over stdin and stdout

Other command line options:
  --init <initializationOptions>
                Override client provided initialization options
         https://github.com/cquery-project/cquery/wiki/Initialization-options
  --record <path>
                Writes stdin to <path>.in and stdout to <path>.out
  --log-file <path>
                Logging file for diagnostics
  --log-file-append <path>
                Like --log-file, but appending
  --log-all-to-stderr
                Write all log messages to STDERR.
  --wait-for-input
                Wait for an '[Enter]' before exiting
  --help        Print this help information.
  --ci          Prevents tests from prompting the user for input. Used for
                continuous integration so it can fail faster instead of timing
                out.
  --print-env   Print all environment variables cquery is running with.

See more on https://github.com/cquery-project/cquery/wiki
If that output is not produced check the installation and also check to make sure the executuble installation folder has been added to the system PATH environment variable.

Configuration

Start Zeus and use the Options, Document Types menu to edit the C/C++ document type and in the Language Server panel apply the following configuration settings:
Program Type: Executable
     Program: cquery.exe
   Arguments: --init={"index": {"comments": 2}}
     Options: { "initializationOptions": { "cacheDirectory": "D:/Experimental/LLVM/cquery/cache" } }
          [x] Use Language Server details for autocomplete
NOTE: The executable directory option can be omitted provided the executable folder is found in the system PATH environment variable.
IMPORTANT NOTE: The options value contains details about the location of the cquery cache which needs to be modified to suit.
This value must reference an existing directory and if this is not the case the following error will be generated:
Output: (   0.005s) [querydb]    initialize.cc:536   | cacheDirectory cannot be empty.

JSON Compilation Database Format Specification

The clangd tool uses a JSON Compilation Database file to describe the files that make up the project. More details on the specification of this file and tools that can be used to create this file can be found here.
The resulting compile_commands.json database file should be placed in the root folder location, which if left blank defaults to the directory of the currently open workspace.
NOTE: Zeus provides a compile_commands_json.py macro which can create a poor man's version of this datbase file. The macro creates the file using details found in the Zeus workspace. While the resulting database file does work to some extent, better results can be achieved by using a database file created with tool designed to create these files, for example CMake.
To use the macro open a Zeus workspace, open a file from that workspace and use the Macros, Tools, Create compile_commands.json file menu to create the file.

Using the Language Server

To test the configuration create a simple test.cpp file and fire off an auto-complete request:
lsp cquery

If the following output is display in the Language Server output window it means the cquery.exe executable has not been installed correctly or the executable folder is not location in the system PATH environment variable.
Error: Cannot launch process: cquery.exe


Latest Version: Zeus 3.99b
Released: 29th January 2024