ast-grep / ast-grep-vscode

ast-grep VSCode is a structural search and replace extension for many languages.

Home Page:https://marketplace.visualstudio.com/items?itemName=ast-grep.ast-grep-vscode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve VSCode extension

HerringtonDarkholme opened this issue · comments

State of Art

Feature List

  • Single File Search
  • Project Files Search
  • Replace preview
  • Replace All
  • Include/Exclude files
  • Toggle Context Line
  • YAML mode
  • Debug on Playground

VSCode seems only support JSON schema validation.

For YAML, we probably need third-party extensions, such as https://github.com/redhat-developer/vscode-yaml

Figured out a way to get YAML intelliSense:

  1. Install VSCode YAML extension
  2. Add config below to .vscode/settings.json
    {
      // ...
      "yaml.schemas": {
        "https://raw.githubusercontent.com/ast-grep/ast-grep/main/schema/project.json": "sgconfig.yml"
      }
    }

The schema needs to be accessible via URL, another PR here: ast-grep/ast-grep#543

It's a little verbose, but would work.

image

@pd4d10 looks like yaml language server is a better choice. https://github.com/redhat-developer/yaml-language-server