Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Kostal Commands: Kostal Compile CommandsNew to Visual Studio Code? Get it now.
Kostal Commands: Kostal Compile Commands

Kostal Commands: Kostal Compile Commands

wang934

|
1 install
| (0) | Free
Kostal Commands: Generate compile_commands.json from Eclipse CDT projects for clangd.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

KOSTAL Compile Commands

Version 1.3.0

Generate a compile_commands.json from an Eclipse CDT project's Make dry-run output or an existing compile_commands.txt, and configure clangd or the Microsoft C/C++ extension to use it.

Features

  • Reads .project, .cproject, and the root org.eclipse.cdt.core.prefs file.
  • Lists Eclipse CDT build configurations and Make targets in the VS Code status bar.
  • Remembers the selected build configuration and target for each workspace.
  • Generates compile_commands.txt and converts GCC or TASKING cctc.exe invocations into compile_commands.json.
  • Parses an existing compile_commands.txt without rerunning Make.
  • Configures clangd or the Microsoft C/C++ extension to read the generated database.
  • Shows staged progress and allows the user to cancel command generation.
  • Opens a terminal with the selected Eclipse configuration's environment and runs make.bat <target>.

Build Status

The Build button opens a VS Code terminal in the selected Eclipse configuration's build directory, injects that configuration's environment, and runs its configured build command with the selected target name.

Requirements

  • Visual Studio Code 1.99 or later.
  • Either the clangd extension or the Microsoft C/C++ extension to consume the generated database. Both are optional and are not installed as extension dependencies.
  • An Eclipse CDT project with .project, .cproject, and org.eclipse.cdt.core.prefs files.
  • The project's Make environment and either GCC or the TASKING compiler, available through the configured environment. make.exe is needed only when generating a new Make output log.

Usage

  1. Open the Eclipse CDT project in VS Code.
  2. Select a build target and build configuration from the status bar.
  3. Select Build to build the selected target, or select compile_commands to generate the database. Compilation database generation uses the all_rebuild target with verbose output enabled.
  4. After database generation, the extension configures the available language extension to use the compilation database. See Language Extension Integration for the selection rules.

Use the Kostal Commands: Parse existing compile_commands.txt command from the Command Palette to parse the existing compile_commands.txt under the selected configuration's Make build directory without rerunning Make. It writes compile_commands.json and applies the configured clangd compatibility options when clangd is selected.

The generated files are written under BuildTools/Common/Make/.

Extension Settings

kostal-compile-commands.environment adds or overrides environment variable values used when analyzing and executing an Eclipse configuration.

kostal-compile-commands.makePath is prepended to PATH when the extension runs make.exe to generate a new Make output log. Its default is D:\devtools\Kostal-Eclipse-SWENG\msys64\usr\bin.

kostal-compile-commands.compiler selects which compiler invocations are collected from the Make output. It accepts gcc (default) or cctc.

Example:

{
  "kostal-compile-commands.environment": {
    "eclipse_home": "D:/devtools/Kostal-Eclipse-SWENG",
    "MSYS": "D:/devtools/Kostal-Eclipse-SWENG/msys64/usr/bin"
  },
  "kostal-compile-commands.makePath": "D:/devtools/Kostal-Eclipse-SWENG/msys64/usr/bin",
  "kostal-compile-commands.compiler": "gcc"
}

Language Extension Integration

After generation or parsing, the extension selects a language extension in this order:

  • If the clangd extension is installed and clangd.enabled is true, clangd is used. The extension updates clangd.arguments with the generated database directory, preserving other arguments and replacing any previous --compile-commands-dir argument. An enabled clangd instance is restarted after the setting changes.
  • Otherwise, if the Microsoft C/C++ extension is installed and its IntelliSense engine is set to Default, the extension updates C_Cpp.default.compileCommands to the generated database file.
  • The C/C++ extension's Tag Parser engine is not compatible with the compilation database and is not configured. The extension displays a notice recommending Default or Disabled. If neither integration is available or enabled, the database is still generated but no language-extension setting is changed.

When both extensions are available, enabled clangd takes precedence. To use the Microsoft C/C++ extension instead, disable clangd or set clangd.enabled to false.

For clangd, the managed setting looks like this:

"clangd.arguments": [
  "--compile-commands-dir=./BuildTools/Common/Make/",
]

For the Microsoft C/C++ extension, C_Cpp.default.compileCommands points directly to the generated compile_commands.json file. Existing clangd arguments unrelated to the managed compile-commands directory are preserved.

Clangd Compatibility for oversized generated files

Clang's source-location representation is limited to 2^31 bytes, so repeatedly included large generated headers can exceed the limit in generated translation units and crash clangd even when TASKING builds the project successfully.

The optional compatibility layer provides two independent mechanisms:

  • Clangd compilation database variant: writes a filtered database under a configurable subdirectory and leaves the normal compile_commands.json used by the build untouched. Exclusion patterns are configurable and default to an empty list.
  • Stub headers: discovers matching headers in the compilation commands' -I directories, creates empty files in a stub directory, and adds that directory with -iquote in .clangd. Quoted includes search the includer's directory first, then -iquote, before -I directories.

The extension creates or updates .clangd only when the file is absent or its first line contains the managed marker # managed by kostal-compile-commands (clangd compatibility) — do not remove. A user-owned .clangd is never overwritten; add the stub directory with -iquote manually in that case. Disable kostal-compile-commands.stubs.enable when no headers need interception, or when the project maintains its own .clangd configuration and you prefer to manage include ordering yourself.

To enable both mechanisms, add settings appropriate for the generated filenames in the project:

{
  "kostal-compile-commands.clangdVariant.enable": true,
  "kostal-compile-commands.clangdVariant.exclude": ["**/generated_*.c"],
  "kostal-compile-commands.clangdVariant.outputSubdir": "clangd",
  "kostal-compile-commands.stubs.enable": true,
  "kostal-compile-commands.stubs.dir": ".clangd-stubs",
  "kostal-compile-commands.stubs.headerPatterns": ["*MemMap*.h"]
}

The patterns above are examples; replace them with globs matching the project files that need exclusion or interception. The generated layout is:

<build directory>/compile_commands.json             # unchanged database for the real build
<build directory>/clangd/compile_commands.json      # clangd variant
<project root>/.clangd-stubs/                      # empty matching header files
<project root>/.clangd                             # managed -iquote configuration

After generation, clangd's --compile-commands-dir points to the variant directory when clangdVariant.enable is on; otherwise it points to the normal database directory. If the generated stub pattern finds no headers, the extension reports that no stubs were prepared and does not create or update .clangd.

Turning an enable setting off stops that mechanism from generating or updating files on subsequent runs; it does not delete files from earlier runs. To fully stop using previously generated stubs, remove .clangd only if its first line has the extension's managed marker, and remove the generated stub directory if it is no longer needed. Do not delete or replace a user-owned .clangd file.

The six compatibility settings are:

Setting Default Description
kostal-compile-commands.clangdVariant.enable false Generate a clangd-specific compilation database.
kostal-compile-commands.clangdVariant.exclude [] Filename or path glob patterns excluded from that database.
kostal-compile-commands.clangdVariant.outputSubdir "clangd" Variant directory, relative to the normal database directory.
kostal-compile-commands.stubs.enable false Discover stub headers and configure .clangd.
kostal-compile-commands.stubs.dir ".clangd-stubs" Stub directory, relative to the project root.
kostal-compile-commands.stubs.headerPatterns [] Header filename globs to discover in -I directories.

Both mechanisms are disabled by default. Enabling one does not enable the other.

Preview Limitations

  • Compile command generation currently uses all_rebuild regardless of the selected target.
  • The parser recognizes either gcc or TASKING cctc output from the project's Make wrapper, based on kostal-compile-commands.compiler.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft