Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Ninja IntellisenseNew to Visual Studio Code? Get it now.
Ninja Intellisense

Ninja Intellisense

Alec269

|
2 installs
| (0) | Free
IntelliSense support for Ninja build files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ninja IntelliSense

Version VS Code

Ninja IntelliSense brings language support and IntelliSense features to Ninja build files (.ninja) in Visual Studio Code. Perfect for developers working with CMake-generated Ninja files or writing custom Ninja build scripts.

Features

Syntax Highlighting

Syntax highlighting for Ninja build file elements:

  • Keywords: rule, build, default, pool, include, subninja
  • Variables: $var and ${var} references
  • Compiler Flags: -D, -I, -W, -O, /EHsc, and more
  • Constants: DEBUG, RELEASE, WIN32, _WINDOWS
  • File Paths: Automatic detection and highlighting
  • Comments: Line comments with #

Syntax Highlighting Example

Auto-Completion

Context-aware completions that speed up your workflow:

  • Keyword Snippets: Type rule, build, etc., and get complete templates
  • Rule Variables: Inside rule blocks, get completions for command, description, depfile, and more
  • Built-in Variables: Type $ to see $in, $out, $builddir
  • User Variables: Automatic detection and completion of all variables defined in your file

Auto-Completion Example

Hover Documentation

Hover over any keyword or variable to see detailed documentation:

  • Ninja Keywords: Learn what each keyword does
  • Rule Variables: Understand command, depfile, deps, and more
  • Built-in Variables: See what $in, $out, and $builddir represent
  • CMake Variables: Get help with DEFINES, FLAGS, INCLUDES, TARGET_PDB, and more
  • User Variables: See where variables are defined and their values

Hover Documentation Example

Go to Definition

Navigate your build files effortlessly:

  • Ctrl+Click (or Cmd+Click on Mac) on variables to jump to their definitions
  • Ctrl+Click on rule names in build statements to jump to rule definitions
  • Quick navigation through complex build files

Document Outline

Get a bird's-eye view of your build file structure:

  • See all rules, build targets, variables, and pools
  • Click to navigate instantly
  • Perfect for large, auto-generated files

Document Outline Example

CMake Integration (Requires more testing)

Should be optimized for CMake-generated Ninja files with:

  • Recognition of CMake-specific variables
  • Hover documentation for common CMake build variables
  • Syntax highlighting for MSVC and GCC compiler flags
  • Support for C++20 module scanning variables

Supported CMake Variables

The extension provides hover documentation for:

Variable Description
DEFINES Preprocessor definitions (-D flags)
FLAGS Compiler flags for the target
INCLUDES Include directories (-I flags)
DEP_FILE Dependency file path
OBJECT_DIR Object file directory
OBJECT_FILE_DIR Target-specific object directory
TARGET_PDB Program database file (MSVC)
CONFIG Build configuration (Debug/Release)
DYNDEP_MODULE_MAP_FILE C++20 module map file

And many more!

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Ninja IntelliSense"
  4. Click Install

From Source

  1. Clone this repository
  2. Run npm install
  3. Run npm run compile
  4. Press F5 to launch the extension in a new VS Code window

Usage

Simply open any .ninja file and the extension will automatically activate!

Quick Start

  1. Create or open a .ninja file
  2. Start typing - Auto-completion should suggest keywords and snippets
  3. Hover over keywords - See detailed documentation
  4. Ctrl+Click variables - Jump to definitions
  5. Open Outline view - Navigate through your build file structure

Example Ninja File

# Build configuration
builddir = build
cflags = -Wall -O2

rule cc
  command = gcc $cflags -c $in -o $out
  description = Compiling $in

rule link
  command = gcc $in -o $out
  description = Linking $out

build $builddir/main.o: cc src/main.c
build $builddir/app: link $builddir/main.o

default $builddir/app

Keyboard Shortcuts

Action Windows/Linux macOS
Trigger Completion Ctrl+Space Cmd+Space
Go to Definition Ctrl+Click or F12 Cmd+Click or F12
Show Hover Ctrl+K Ctrl+I Cmd+K Cmd+I
Open Outline Ctrl+Shift+O Cmd+Shift+O

Requirements

  • Visual Studio Code version 1.107.0 or higher
  • Ninja v1.12+

Extension Settings

This extension does not add any VS Code settings. It works out of the box!

Issues

  • Please report issues on our GitHub repository

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Release Notes

See CHANGELOG.md for detailed release notes.

License

This extension is licensed under the MIT License.

Acknowledgments

  • Built for the Ninja and CMake community
  • Inspired by the need for better tooling around build systems
  • Thanks to all contributors and users!

Enjoy building with Ninja!

If you find this extension helpful, please consider:

  • Starring the repository
  • Writing a review
  • Reporting issues
  • Suggesting features
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft