cpp-language-server/docs/command-line-options.md at main · microsoft/cpp-language-server · GitHub
Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 3.75 KB

command-line-options.md

File metadata and controls

44 lines (34 loc) · 3.75 KB

Command line options for mscppls

Documentation index

Use these options with npx @microsoft/cpp-language-server [options] or mscppls [options] if installed globally. To customize Copilot CLI server startup, add the relevant launch flags to the args in your LSP configuration. Run standalone commands such as --check directly in your terminal instead.

Option Description
--help or -h Shows a help message with a description of all options.
--version Shows version information and exits.
--accept-eula Permanently accepts the end-user license agreement (EULA). The EULA only needs to be accepted once. However, it is safe to redundantly include this option with any other option, which can be helpful in automated environments.
--stderr Do not redirect stderr to /dev/null. Useful for debugging.
--login Interactively log in to GitHub.
--force-login Force interactive login, even if the user has already logged in.
--allow-plaintext-secret-storage Allow storing credentials in plaintext if secure system storage is unavailable.
--login-hostname <host> GitHub hostname to use when obtaining a token from the GitHub CLI (gh auth token). Enables GitHub Enterprise Cloud support; requires the GitHub CLI to be installed and authenticated. If unspecified, the GitHub CLI's default host is used.
--log-dir <path> Specify the directory for log files. If unspecified, the system temp directory is used.
--log-level <level> Set the logging verbosity from 0 (errors only) to 9 (verbose).
--lsp-config <path> Optional path to the cpp-lsp.json file. If relative, the path will be resolved relative to the current working directory of the mscppls process, which is typically the project root when launched from GitHub Copilot CLI.
--allow-missing-lsp-config Enables fallback to automatic compile_commands.json discovery when --lsp-config is specified but the configuration file does not exist.
--disable-telemetry Permanently disables sending telemetry data.
--check=<file> Fully parses and analyzes a source file using its compile_commands.json entry, prints diagnostics, and exits instead of starting an LSP session. See checking a source file for exit codes.
--check-compile-commands=<path> Specifies a compile_commands.json file or its containing directory to use with --check. If omitted, searches upward from the source file's directory for the database.

Check a source file

Complete license acceptance and authentication before running a check. The source file must have an entry in the compilation database.

npx @microsoft/cpp-language-server --check=src/main.cpp --check-compile-commands=build/compile_commands.json

Omit --check-compile-commands to search the source file's directory and its parents for compile_commands.json. For a database in a separate build directory, pass its path explicitly as shown above. Both options also accept a space-separated value, such as --check src/main.cpp.

Exit code Meaning
0 Analysis completed with no errors; warnings may still be reported.
1 Source errors were reported.
2 Setup or validation failed, such as a missing file or compilation database, an unresolved include, or an analysis timeout.
3 Not authorized; login is required or authentication failed.

Disable telemetry

Run npx @microsoft/cpp-language-server --disable-telemetry (or mscppls --disable-telemetry if installed directly) to permanently disable telemetry. See the data collection notice for details.