Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>C/C++ .mk IntelliSense UpdaterNew to Visual Studio Code? Get it now.
C/C++ .mk IntelliSense Updater

C/C++ .mk IntelliSense Updater

Jack Sun

|
291 installs
| (0) | Free
Update C/C++ IntelliSense config from *.mk files.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

C/C++ .mk IntelliSense 更新器 / Updater

中文说明

根据构建配置文件更新 VS Code C/C++ IntelliSense 的 include 路径。

本扩展会读取所选构建文件(.mk 文件)中的 include 配置,并更新你的 IntelliSense 配置。

功能

  • 从所选构建文件(.mk 文件)读取 include 相关配置。
  • 自动识别 include 路径变量:不依赖固定变量名,凡是取值为"一组真实存在的目录" 的 make 变量都会被采用,并在结果提示中回报实际使用的变量名。
  • 自动探测每个 .mk 文件的构建根目录,按相对条目真实存在的最近祖先目录解析。
  • 支持 = / := / ?= / += / != 赋值、反斜杠续行、$(VAR) 递归展开, 以及 -I / -D / -L / -l 编译选项。
  • 识别链接库(.a 与 .lib),并可选合并其库构建文件中的 include 配置。
  • 去重 include 路径并保持原顺序;只写入磁盘上确实存在的目录。
  • 更新已有 IntelliSense 配置,或创建新配置。

命令

  • 从此 .mk 文件更新 IntelliSense
    • 在资源管理器中右键 .mk 文件可见。
    • Command ID: mkintellisense.updateIntelliSense
  • 更新 IntelliSense:选择一个 .mk 文件...
    • 手动选择构建文件(.mk 文件)。
    • Command ID: mkintellisense.updateIntelliSensePick

使用流程

  1. 在资源管理器中右键某个项目 .mk 文件。
  2. 选择 从此 .mk 文件更新 IntelliSense。
  3. (可选)勾选需要解析的链接库(.a / .lib),默认全选。
  4. (可选)确认要合并其 include 路径的库 .mk 文件(显示匹配分数)。
  5. 选择要更新的 IntelliSense 配置,或新建一个。
  6. 扩展写入更新后的 IntelliSense 设置,并报告条目来源变量、构建根与跳过数量。

输入要求

  • 所选构建文件(.mk 文件)应包含 include 相关配置项。
  • 若引用了库产物(例如 xxx.a、xxx.lib),可合并其对应库构建配置。
  • 文档示例均为占位名(例如 module_xxx.mk、lib_xxx.a)。

注意

  • 安装或更新 .vsix 之后请执行一次 Developer: Reload Window(重新加载窗口)。 右键菜单文字在窗口加载时解析,未重新加载时可能仍显示为英文;扩展的解析逻辑 同样需要重新加载后才会更新。
  • 若工作区缺少 .vscode/c_cpp_properties.json,扩展会自动创建。
  • 若未找到必需的 include 配置,扩展会提示错误。
  • include 路径在写入前会校验目录是否真实存在;不存在的条目会被跳过, 并在提示中报告"其中 N/M 条路径在本工作区不存在,已跳过"。

设置项

  • mkintellisense.libraryMkSearchGlobs
    • 控制候选库 .mk 文件的搜索范围(可配置多条路径)。
    • 默认:["**/*.mk"]
    • 示例:["libs/**/*.mk", "apps/**/*.mk"]
  • mkintellisense.lowConfidenceThreshold
    • 低于该分数的匹配视为低可信度。
    • 默认:0.7
  • mkintellisense.lowConfidenceMode
    • 控制低可信度匹配的处理方式。
    • discard(默认):直接丢弃低可信度匹配。
    • include_with_warning:保留并标记 LOW,同时给出提醒。
  • mkintellisense.directoryRatioThreshold
    • 当一个 make 变量的取值中至少有该比例的条目能解析为真实存在的目录时, 它被视为 include 路径来源。调高可避免误取仅仅是路径样式的变量。
    • 默认:0.9(范围 0.5–1)
  • mkintellisense.minTokensPerVariable
    • make 变量至少包含多少个条目,才会被当作 include 路径来源来考虑。
    • 默认:2(范围 1–10)
  • mkintellisense.includeVariableSelection
    • 选择哪些符合条件的变量作为 include 路径来源。头文件目录通常以 inc/include/hdr/header 命名;源码目录与链接目录并非头文件根目录, 把它们加入会让 C/C++ 解析器索引整棵目录树。
    • inc-only(默认):仅使用名称含 inc/include/hdr/header 的变量。
    • prefer:优先使用 inc 命名的变量,若没有则回退到全部符合条件的变量。
    • all:使用所有条目能解析为真实目录的变量。

以上设置支持工作区级配置,不同项目可使用不同搜索路径。

更新记录

见 CHANGELOG.md。


English

Update VS Code C/C++ IntelliSense include paths from build configuration files.

This extension reads include settings from a selected build file (.mk file) and updates your IntelliSense configuration.

What It Does

  • Reads include-related settings from the selected build file (.mk file).
  • Discovers include-path variables generically: no fixed variable name is required. Any make variable whose value is a list of directories that exist on disk qualifies, and the names actually used are reported in the result message.
  • Detects the build root per makefile, resolving relative entries against the nearest ancestor directory that makes them exist.
  • Supports = / := / ?= / += / != assignments, backslash continuations, recursive $(VAR) expansion, and the -I / -D / -L / -l compiler flags.
  • Detects linked libraries (.a and .lib) and optionally merges include settings from their library build files.
  • Removes duplicate include paths while preserving order; only directories that exist on disk are written.
  • Updates an existing IntelliSense configuration or creates a new one.

Commands

  • Update IntelliSense from this .mk file
    • Available in Explorer context menu when right-clicking a .mk file.
    • Command ID: mkintellisense.updateIntelliSense
  • Update IntelliSense: Pick a .mk file...
    • Lets you choose a build file (.mk file) manually.
    • Command ID: mkintellisense.updateIntelliSensePick

Workflow

  1. Right-click a project .mk file in Explorer.
  2. Select Update IntelliSense from this .mk file.
  3. (Optional) Tick the linked libraries (.a / .lib) to resolve; all detected entries are pre-selected.
  4. (Optional) Confirm which library .mk files to merge include paths from (the match score is shown).
  5. Pick the IntelliSense configuration to update, or create a new one.
  6. The extension writes the updated IntelliSense settings and reports the source variable(s), the detected build root, and how many entries were skipped.

Input Requirements

  • The selected build file (.mk file) should contain include-related configuration entries.
  • If related library artifacts (such as xxx.a or xxx.lib) are referenced, corresponding library build settings can be merged during update.
  • Documentation examples use placeholder names only (for example, module_xxx.mk, lib_xxx.a).

Notes

  • After installing or updating the .vsix, run Developer: Reload Window. Menu labels are resolved when the window loads, so without a reload the context menu can still appear in English, and the resolution logic is not refreshed either.
  • If .vscode/c_cpp_properties.json is missing, the extension creates it automatically.
  • If required include settings are not found, the extension reports an error message.
  • Include paths are checked against the file system before being written. Entries that do not exist are skipped and reported as N/M path entries ... were skipped.

Settings

  • mkintellisense.libraryMkSearchGlobs
    • Controls where candidate library .mk files are searched (multiple paths).
    • Default: ["**/*.mk"]
    • Example: ["libs/**/*.mk", "apps/**/*.mk"]
  • mkintellisense.lowConfidenceThreshold
    • Match score below this value is treated as low confidence.
    • Default: 0.7
  • mkintellisense.lowConfidenceMode
    • Controls how low-confidence matches are handled.
    • discard (default): drop low-confidence matches directly.
    • include_with_warning: keep and mark LOW with warning.
  • mkintellisense.directoryRatioThreshold
    • The fraction of a variable's entries that must resolve to existing directories before the variable counts as an include-path source. Raise it to avoid picking up variables that merely look like path lists.
    • Default: 0.9 (range 0.5–1)
  • mkintellisense.minTokensPerVariable
    • The minimum number of entries a variable must have to be considered.
    • Default: 2 (range 1–10)
  • mkintellisense.includeVariableSelection
    • Which qualifying variables are used as include-path sources. Header directories are usually named with inc/include/hdr/header; source and link directories are not header roots, and adding them makes the C/C++ parser index the whole tree.
    • inc-only (default): only variables whose name contains inc/include/hdr/header.
    • prefer: prefer inc-named variables, fall back to all qualifying ones if none.
    • all: use every variable whose entries resolve to existing directories.

These settings support workspace-level configuration, so different projects can use different search paths.

Changelog

See CHANGELOG.md.

License

See LICENSE.md.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft