Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Logo Language SupportNew to Visual Studio Code? Get it now.
Logo Language Support

Logo Language Support

StephenKing

|
5,639 installs
| (1) | Free
Syntax highlighting, snippets and language configuration for Logo (PCLogo/UCBLogo/FMSLogo).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Logo Language Support

为 Visual Studio Code 提供 Logo 编程语言支持,兼容 PCLogo / UCBLogo / FMSLogo 等主流方言。

功能特性

语法高亮

  • 控制流关键字:to / end / if / ifelse / repeat / while / for / stop / output / catch / throw 等
  • 海龟绘图命令:fd / bk / rt / lt / pu / pd / ht / cs / setxy / setpc / arc / fill 等
  • 列表与字处理:first / butfirst / word / sentence / list / array / count / memberp 等
  • 数学函数:sum / product / quotient / sqrt / sin / cos / random 等
  • 输入输出:print / type / show / readchar / openread / save / load 等
  • 常量:数字(整数/小数/科学计数法)、布尔值 TRUE / FALSE
  • 变量:形如 :name 的参数引用、"name 的字面量
  • 运算符:+ - * / = < > <= >= <>
  • 注释:以 ; 起始的行注释
  • Hair 扩展语法:hair / $ 前缀的特殊标识

代码片段 (Snippets)

内置 19 个常用代码片段,通过前缀智能提示触发:

前缀 说明
to / tonp 带参/无参过程定义
repeat / for / while 循环结构
if / ifelse 条件分支
make / localmake 变量赋值
pr / print 输出
op 过程返回
square / triangle / polygon / star / circle 常用绘图过程模板
; 行注释

语言配置

  • 括号自动配对:[ ]、{ }、( )
  • 自动缩进:to 起始的过程体自动缩进,end 处回退缩进
  • 代码折叠:to ... end 块可折叠
  • 注释延续:回车自动延续 ; 注释
  • 单词分隔规则适配 Logo 语法(正确处理 [ ] ( ) : " ;)

支持的文件扩展名

  • .lgo
  • .lg
  • .logo

安装

在 VS Code 扩展市场中搜索 "Logo Language Support" 并安装,或通过命令行安装本地 vsix:

code --install-extension logo-1.1.0.vsix

使用方法

  1. 安装扩展后,打开任意 .lgo / .lg / .logo 文件
  2. 语法高亮、自动补全、代码片段将自动启用
  3. 输入片段前缀(如 to、repeat)后按 Tab 展开代码片段

示例

to square :size
    repeat 4 [fd :size rt 90]
end

to star :size
    repeat 5 [fd :size rt 144]
end

; 画一个边长 100 的正方形
square 100

问题反馈

如有问题或改进建议,请在 GitHub 仓库提交 issue:https://github.com/StephenKingJJY/Hair/issues

更新日志

1.1.0

  • 修复:方括号被错误标记为非法字符的问题
  • 修复:function-calls 规则引用未定义导致的语法解析失败
  • 修复:关键字列表中的重复项(list、word、define 等)
  • 新增:海龟绘图、IO、列表、数学等命令分类高亮
  • 新增:布尔常量 TRUE? / FALSE? 识别
  • 新增:19 个常用代码片段(过程定义、循环、绘图模板等)
  • 新增:语言配置(自动缩进、代码折叠、注释延续)
  • 新增:.logo 文件扩展名支持
  • 优化:关键字大小写不敏感(Logo 不区分大小写)
  • 优化:package.json 元数据(license、keywords、repository)
  • 优化:.vscodeignore 打包排除规则

1.0.0

  • 初始版本发布
  • 基本语法高亮支持
  • Hair 语法支持

许可证

MIT

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