Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Grafana Alloy FormatterNew to Visual Studio Code? Get it now.
Grafana Alloy Formatter

Grafana Alloy Formatter

charles123

|
62 installs
| (0) | Free
Format Alloy configuration files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Grafana Alloy Formatter

VSCode 扩展用于格式化 Alloy 配置文件(.alloy 文件)。该扩展集成了 alloy fmt 命令行工具,使您能够直接在 VSCode 中格式化 Alloy 文件。

功能

  • 自动格式化 .alloy 文件
  • 使用原生 alloy fmt 命令行工具确保标准格式化
  • 支持通过 VSCode 格式化快捷键 (Shift+Alt+F 或 Format Document 命令) 进行格式化

要求

  • 您需要在系统上安装 alloy 命令行工具,并确保它可以在 PATH 中访问。
  • 扩展会使用 alloy fmt 命令进行格式化,因此该命令必须在您的 alloy 工具中可用。

使用方法

  1. 打开任何 .alloy 文件
  2. 使用以下任一方式触发格式化:
    • 按下快捷键:Shift+Alt+F (Windows/Linux) 或 Shift+Option+F (macOS)
    • 右键单击并选择 "格式化文档"
    • 从命令面板 (Ctrl+Shift+P 或 Cmd+Shift+P) 运行 "格式化文档" 命令

扩展设置

此扩展不提供任何额外的配置选项。它使用 alloy fmt 的默认行为。

已知问题

  • 如果 alloy 工具未正确安装或不在 PATH 中,格式化将失败,并显示错误消息。

贡献

欢迎贡献!请随时提交问题或拉取请求到项目的 GitHub 仓库。

许可证

此扩展使用 MIT 许可证。

尽情使用!

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