Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>FeaturePilotNew to Visual Studio Code? Get it now.
FeaturePilot

FeaturePilot

FeaturePilot

|
9 installs
| (0) | Free
FeaturePilot: Cucumber .feature autocomplete, step indexing, validation diagnostics, sidebar search, and smart formatting.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

FeaturePilot

FeaturePilot 是一个面向 VS Code 的 .feature 语言增强插件,提供 Cucumber Step 自动补齐、定义跳转、未定义诊断、侧边栏检索和自动格式化。

适用场景

适合以下项目:

  • 使用 Cucumber/Gherkin 编写大量 .feature 用例
  • Step definitions 同时来自项目源码和 npm 依赖包
  • 需要稳定的补齐、跳转、诊断与统一格式化体验

核心能力

  • .feature 文件专属增强(Given/When/Then/And/But)
  • Step 自动补齐(支持 snippet 占位)
  • 选择补齐项时,自动替换当前行关键字后的整段文本(避免错误残留)
  • And 语义链场景下提供稳定补齐(例如 And I click ...)
  • Ctrl/定义跳转到对应 Step definitions
  • 未定义 Step 红色波浪线诊断
  • Quick Fix 模板修复:对未定义 Step 提供可选模板并一键替换
  • 双来源扫描(项目 src + Lighthouse 包)
  • 侧边栏 Step 树形浏览、检索、刷新、平台切换
  • .feature 自动格式化(全文/选区/可选 On-Type)

Step 扫描规则

启用前提:工作区存在以下目录

  • node_modules/@lighthouse/lighthouse-implementation

满足前提后,扫描来源为:

  • 项目:src/**/*.ts
  • 包内:node_modules/@lighthouse/lighthouse-implementation/src/step-definitions/<platform>/**/*.ts

平台目录通过配置控制(默认 durandal-platform)。

冲突处理:同一 gherkin + stepText 重复时,项目 src 优先。

侧边栏(Step Explorer)

活动栏入口:FeaturePilot

树结构:

  • 来源(Project / Lighthouse)
  • 平台/目录
  • 文件
  • Step

支持功能:

  • 标题栏刷新按钮(重建缓存)
  • Search Step Definitions 快速检索并跳转
  • Switch Lighthouse Platform 切换平台后自动刷新

自动格式化

  • 全文格式化
  • 选区格式化
  • 可选 On-Type 格式化
  • 表格对齐(含 CJK 宽度处理)
  • DocString 策略(skipDocStringsFormat)
  • """ 中 JSON 美化

命令

  • FeaturePilot: Refresh Step Index
  • FeaturePilot: Search Step Definitions
  • FeaturePilot: Switch Lighthouse Platform

配置

所有配置前缀统一为 featurepilot.*。

常用配置:

  • featurepilot.lighthousePlatforms:启用的平台目录列表
  • featurepilot.strictGherkinCompletion:补齐时是否严格遵循 Gherkin 语义
  • featurepilot.strictGherkinValidation:诊断时是否严格遵循 Gherkin 语义
  • featurepilot.customParameters:自定义参数映射
  • featurepilot.parameterSymbols:参数占位符前后缀(如给 string 自动加引号)
  • featurepilot.onTypeFormat:是否启用 On-Type 格式化
  • featurepilot.formatConfOverride:格式化规则覆盖

默认 customParameters 包含:

[
  { "parameter": "{pronoun}", "value": "(I|he|she|they|his|her|their)" }
]

推荐使用流程

  1. 安装扩展并打开项目工作区根目录
  2. 确认 node_modules/@lighthouse/lighthouse-implementation 已安装
  3. 在侧边栏执行 Refresh Step Index
  4. 如需切换平台,执行 Switch Lighthouse Platform
  5. 在 .feature 中使用补齐、跳转、Quick Fix 与格式化

自动补齐与 Quick Fix 说明

  • 自动补齐:

    • 在 Given/When/Then/And/But 后输入时触发
    • 选择候选后会替换当前行关键字后的全部文本
    • 参数按 featurepilot.parameterSymbols 规则生成(默认字符串参数带双引号)
  • Quick Fix(未定义 Step):

    • 在红色波浪线处使用 Ctrl+. 打开修复建议
    • 提供模板候选并直接替换当前行 Step 文本
    • 参数占位采用空引号形式(例如 ""),便于直接填写

常见问题

  1. 侧边栏显示 Language server is not running
  • 执行 Developer: Reload Window
  • 确认打开的是正确工作区根目录(建议单根)
  1. 修改 Step definitions 后未立即生效
  • 点击侧边栏刷新按钮
  • 或执行 FeaturePilot: Refresh Step Index
  1. 跳转/诊断结果异常
  • 先刷新 Step 索引
  • 再检查当前平台配置 featurepilot.lighthousePlatforms
  1. And I click ... 看不到期望提示
  • 确认光标位于 .feature 文件中
  • 执行 FeaturePilot: Refresh Step Index
  • 执行 Developer: Reload Window

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft