{"id":14263263,"url":"https://github.com/ast-grep/ast-grep-vscode","last_synced_at":"2025-04-12T23:29:47.369Z","repository":{"id":63162380,"uuid":"562961168","full_name":"ast-grep/ast-grep-vscode","owner":"ast-grep","description":"ast-grep VSCode is a structural search and replace extension for many languages.","archived":false,"fork":false,"pushed_at":"2025-04-08T10:12:04.000Z","size":4416,"stargazers_count":179,"open_issues_count":22,"forks_count":18,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-08T11:24:34.594Z","etag":null,"topics":["ast","linter","search-replace","structural-search","vscode","vscode-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=ast-grep.ast-grep-vscode","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ast-grep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-07T16:06:56.000Z","updated_at":"2025-04-06T08:30:26.000Z","dependencies_parsed_at":"2024-04-03T00:28:45.231Z","dependency_job_id":"7999fca0-f54f-497b-98be-aca24c70ba94","html_url":"https://github.com/ast-grep/ast-grep-vscode","commit_stats":{"total_commits":637,"total_committers":13,"mean_commits":49.0,"dds":0.4505494505494505,"last_synced_commit":"25c09aef6a90697571dbff28ef0e4df251598dd6"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ast-grep%2Fast-grep-vscode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ast-grep%2Fast-grep-vscode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ast-grep%2Fast-grep-vscode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ast-grep%2Fast-grep-vscode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ast-grep","download_url":"https://codeload.github.com/ast-grep/ast-grep-vscode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647010,"owners_count":21139079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","linter","search-replace","structural-search","vscode","vscode-extension"],"created_at":"2024-08-22T13:06:10.023Z","updated_at":"2025-04-12T23:29:47.328Z","avatar_url":"https://github.com/ast-grep.png","language":"TypeScript","funding_links":[],"categories":["vscode-extension","TypeScript"],"sub_categories":[],"readme":"# ast-grep VSCode\n\n_ast-grep VSCode, a structural search and replace extension._\n\nIt uses ASTs to find and modify code patterns. No more tedious and error-prone text manipulation.\n\n## Introduction\n\nHave you ever spent hours trying to find and replace a code pattern using plain text or regular expressions? If so, you know how tedious and error-prone it can be. However, there is a better way to do this: **Structural Search and Replace**, a [technique](https://www.jetbrains.com/help/idea/structural-search-and-replace.html) that allows you to find and modify code patterns based on their syntax and semantics, not just their text.\n\n[ast-grep](https://ast-grep.github.io/) is a structural search/replace tool that uses abstract syntax trees (ASTs) to represent the syntax and structure of your code, and lets you write patterns as if you are writing ordinary code.\n\nIt can help you search and replace code elements more precisely and efficiently than using regular expressions or plain text. You can also use ast-grep to perform linting and rewriting tasks, and write your own rules using YAML configuration.\n\n## Features\n\nThe ast-grep VSCode is an extension to bridge the power of ast-grep and the beloved editor VSCode.\n\nIt includes two parts: a UI for ast-grep CLI and a client for ast-grep LSP.\n\n### Code search\n\nUse [pattern](https://ast-grep.github.io/guide/pattern-syntax.html) to structural search your codebase.\n\n|Search Pattern|Search In Folder|\n|--|--|\n|\u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/blob/main/readme/search-pattern.png?raw=true\"\u003e|\u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/blob/main/readme/search-in-folder.png?raw=true\"\u003e|\n\n### Code Replace\n\nUse pattern to [replace](https://ast-grep.github.io/guide/rewrite-code.html) matching code.\n\n|Replace Preview|Commit Replace|\n|--|--|\n|\u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/blob/main/readme/replace.png?raw=true\"\u003e|\u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/blob/main/readme/commit-replace.png?raw=true\"\u003e|\n\n### Code Linting and Actions(\\*)\n*Require LSP setup*\n\nCode linting and code actions require [setting up `sgconfig.yml`](https://ast-grep.github.io/guide/scan-project.html) in your workspace root.\n\n\u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/blob/main/readme/linter.png?raw=true\"\u003e\n\n## Requirements\n\n- [ast-grep](https://ast-grep.github.io/) binary in your path.\n\n```bash\n# install via npm\nnpm i @ast-grep/cli -g\n\n# install via cargo\ncargo install ast-grep\n\n# install via homebrew\nbrew install ast-grep\n```\n\nAlso see the [quickstart guide](https://ast-grep.github.io/guide/quick-start.html) for installation.\n\n- (optional) setting up ast-grep [project](https://ast-grep.github.io/guide/scan-project.html).\n\n  This is an optional step to enable code linting and code actions. It requires at least one file and one folder to work:\n\n  - `sgconfig.yml`, the [project configuration file](https://ast-grep.github.io/reference/sgconfig.html)\n  - a directory storing rule files, conventionally `rules/`\n\nYou can also use the [command line tool](https://ast-grep.github.io/reference/cli/new.html) to set it up.\n\n```bash\nast-grep new\n```\n\n## Available Commands\n\n- `ast-grep.restartLanguageServer`\n  Restart ast-grep langauge server. Useful to reload rule or configuration changes.\n\n- `ast-grep.searchInFolder`\n  Find ast-grep pattern in the specified folder in a project.\n\n- `ast-grep.executeAutofix`\n  Fix all auto-fixable Problems\n\n## Extension Settings\n\nThis extension contributes the following settings:\n\n- `astGrep.serverPath`: Specify the language server binary path. It can be a relative path to workspace root or an absolute path.\n\n- `astGrep.serverPath`: Customize ast-grep config file path relative. Default is `sgconfig.yml`\n\n## Video Introduction\n\nSee the introduction on YouTube! Please give it a like~\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.youtube.com/watch?v=1ZM4RfIvWKc\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://github.com/ast-grep/ast-grep-vscode/assets/2883231/62face2b-3ee4-4f70-b1e0-4a922471794d\" alt=\"ast-grep VSCode introduction\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fast-grep%2Fast-grep-vscode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fast-grep%2Fast-grep-vscode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fast-grep%2Fast-grep-vscode/lists"}