Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>300英雄 .s脚本分析器New to Visual Studio Code? Get it now.
300英雄 .s脚本分析器

300英雄 .s脚本分析器

Jumpw

|
4 installs
| (0) | Free
300英雄游戏脚本语法检查和代码分析工具
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

300英雄 .s脚本分析器 - VSCode扩展

完整的300英雄游戏脚本语法分析器,提供语法检查、代码补全、函数提示、自动格式化等功能。

快速安装

Windows

双击运行 build.bat,然后安装生成的 s-script-analyzer-1.0.0.vsix 文件。

Linux/Mac

chmod +x build.sh
./build.sh

功能特性

✅ 语法错误检测

  • 检测逻辑运算符错误(&&, ||, !)
  • 检测 else if 错误
  • 检测 for 循环错误
  • 检测函数参数表达式错误
  • 检测自增自减运算符(++, --)

✅ 智能代码补全

  • API函数自动补全
  • 回调函数模板
  • 关键字补全
  • 玩家属性补全
  • 代码片段(if/while/switch等)

✅ 函数悬停提示

  • 显示函数签名
  • 参数说明
  • 返回值类型
  • 使用示例

✅ 自动格式化

  • 自动缩进
  • 运算符空格
  • 代码对齐

✅ 函数签名帮助

  • 实时参数提示
  • 参数类型说明

✅ 代码质量检查

  • 整数除法精度警告
  • 变量未初始化警告
  • 复杂表达式建议

文件说明

vscode-extension/
├── src/                          # 源代码
│   ├── extension.ts              # 扩展入口
│   ├── analyzer.ts               # 语法分析器
│   ├── completionProvider.ts    # 代码补全
│   ├── hoverProvider.ts         # 悬停提示
│   ├── formattingProvider.ts    # 代码格式化
│   ├── signatureHelpProvider.ts # 函数签名
│   └── apiData.ts               # API函数数据
├── syntaxes/                     # 语法定义
│   └── s-script.tmLanguage.json # 语法高亮
├── package.json                  # 扩展配置
├── tsconfig.json                # TypeScript配置
├── build.bat                    # Windows构建脚本
├── build.sh                     # Linux/Mac构建脚本
├── BUILD.md                     # 构建指南
├── INSTALL.md                   # 安装使用指南
└── README.md                    # 本文件

构建步骤

自动构建(推荐)

Windows:

build.bat

Linux/Mac:

chmod +x build.sh
./build.sh

手动构建

# 1. 安装依赖
npm install

# 2. 编译
npm run compile

# 3. 打包
npm run package

安装扩展

方法1:VSCode界面安装

  1. 打开VSCode
  2. 按 Ctrl+Shift+P
  3. 输入 Extensions: Install from VSIX...
  4. 选择 s-script-analyzer-1.0.0.vsix

方法2:命令行安装

code --install-extension s-script-analyzer-1.0.0.vsix

使用示例

打开任何 .s 文件,扩展会自动激活。

代码补全示例

// 输入 "Get" 自动提示所有 Get 开头的函数
$playerid = GetOwnerID()

错误检测示例

// ❌ 错误:使用逻辑运算符
if $hp > 0 && $mp > 0  // 红色波浪线

// ✅ 正确
if $hp > 0
    if $mp > 0
    endif
endif

格式化示例

// 格式化前
function OnEquip(){
$playerid=GetOwnerID()
if $hp>100
AddPlayerInfo($playerid,"hp",50)
endif
}

// 格式化后 (Shift+Alt+F)
function OnEquip(){
    $playerid = GetOwnerID()
    if $hp > 100
        AddPlayerInfo($playerid, "hp", 50)
    endif
}

配置选项

{
    "sScriptAnalyzer.maxNumberOfProblems": 100,
    "sScriptAnalyzer.enableIntegerDivisionWarnings": true,
    "sScriptAnalyzer.enableStyleChecks": true
}

快捷键

功能 快捷键
代码补全 Ctrl+Space
格式化文档 Shift+Alt+F
参数提示 Ctrl+Shift+Space
查看问题 Ctrl+Shift+M

开发

调试扩展

  1. 在VSCode中打开 vscode-extension 文件夹
  2. 按 F5 启动扩展开发主机
  3. 在新窗口中打开 .s 文件测试

修改代码

编辑 src/ 目录下的TypeScript文件,然后重新编译:

npm run compile

添加新的API函数

编辑 src/apiData.ts,添加函数定义到 API_FUNCTIONS 数组。

添加新的检查规则

编辑 src/analyzer.ts,在 rules 数组中添加新规则。

依赖项

  • Node.js >= 18.0.0
  • TypeScript >= 5.0.0
  • VSCode >= 1.75.0

许可证

MIT License

版本历史

1.0.0 (2024-01-29)

  • 初始版本
  • 完整的语法检查功能
  • 智能代码补全
  • 函数悬停提示
  • 自动格式化
  • 函数签名帮助

反馈

如有问题或建议,欢迎反馈。

相关文档

  • 安装使用指南
  • 构建指南
  • .s脚本语言规范
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft