Skip to content

Marskey/telescope-sg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Telescope ast-grep

ast-grep picker for telescope.nvim

Inspired by this PR

Requires

ast-grep to be installed ( version >= 0.10.0 ). You can install it by the following commands.

npm install --global @ast-grep/cli
pip install ast-grep-cli
cargo install ast-grep

What it does

ast-grep is a AST-based tool to search code by pattern code. Think it as your old-friend grep but it matches AST nodes instead of text. You can write patterns as if you are writing ordinary code. It will match all code that has the same syntactical structure. You can use $ sign + upper case letters as wildcard, e.g. $MATCH, to match any single AST node. Think it as REGEX dot ., except it is not textual.

See ast-grep

Check Health

Make sure you call :checkhealth telescope after intalling to ensure everything is set up correctly.

Configuration

require('telescope').setup {
    extensions = {
        ast_grep = {
            command = {
                "sg",
                "--json=stream",
            }, -- must have --json=stream
            grep_open_files = false, -- search in opened files
            lang = nil, -- string value, specify language for ast-grep `nil` for default
        }
    }
}

Usage

Telescope ast_grep

About

Ast-grep picker for telescop.nvim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages