PureBasic 语言支持 for Visual Studio Code
此扩展为 Visual Studio Code 添加了对 PureBasic 编程语言的全面支持。
功能特性
语法高亮
完整的 PureBasic 代码语法高亮,包括:
- 关键字(
If、For、Procedure 等)
- 注释(以
; 开头)
- 字符串(单引号和双引号)
- 数字(十进制、十六进制和二进制)
- 函数和过程
代码补全
IntelliSense 支持:
- 内置 PureBasic 关键字
- 常用代码结构
- 过程和函数名
- 大量API函数和常量
代码片段
快速插入常用代码模式:
proc - 过程块
if - 条件语句
for - For 循环
while - While 循环
struct - 结构体定义
main - 主程序模板
win - Windows程序模板
编译器集成
与 PureBasic 编译器直接集成:
- 使用
Ctrl+Shift+P → "PureBasic: 编译 PureBasic 文件" 编译当前文件
- 使用
Ctrl+Shift+P → "PureBasic: 运行 PureBasic 程序" 运行编译后的程序
错误检查
基本语法错误检测:
文件图标识别
资源管理器中 .pb 和 .pbi 文件的自定义图标。
安装
- 从 Visual Studio Code Marketplace 安装扩展
- 重新加载 Visual Studio Code
配置
可以通过 VS Code 的设置配置扩展:
purebasic.compilerPath:PureBasic 编译器可执行文件的路径
purebasic.buildArguments:传递给编译器的附加参数
purebasic.outputDirectory:编译输出文件的目录
在 Windows 上,编译器路径通常如下所示:
C:/Program Files/PureBasic/Compilers/pbcompiler.exe
在 macOS 上:
/Applications/PureBasic/Compilers/pbcompiler
在 Linux 上:
/usr/local/bin/pbcompiler
使用方法
- 打开任何
.pb 或 .pbi 文件
- 享受语法高亮和代码补全功能
- 通过输入前缀并按
Tab 键使用代码片段
- 使用
Ctrl+Shift+P → "PureBasic: 编译 PureBasic 文件" 进行编译
- 使用
Ctrl+Shift+P → "PureBasic: 运行 PureBasic 程序" 进行运行
示例
在 examples/ 目录中提供了示例文件:
hello-world.pb - 简单的 Hello World 程序
advanced-example.pb - 展示更多高级特性的示例
要求
- Visual Studio Code 1.74.0 或更高版本
- PureBasic 编译器(可选,用于编译功能)
版本说明
1.0.2
- 更新扩展图标为PNG格式
- 修复了一些小问题
- 改进了文档
1.0.1
1.0.0
- 初始版本,提供完整的语法高亮
- 代码补全支持
- 常用模式的代码片段
- 编译器集成
- 基本错误检查
- 文件图标识别
贡献
欢迎贡献!请在 GitHub 上提交问题和拉取请求。
许可证
此扩展根据 MIT 许可证授权。
| |