chrishrb / gx.nvim

Implementation of gx without the need of netrw
Apache License 2.0
186 stars 19 forks source link

feat: go import handler based on treesitter #47

Closed sportshead closed 2 months ago

sportshead commented 4 months ago

Uses treesitter in order to find a Go import-spec, then opens https://pkg.go.dev/ for the package.

e.g.:

import "fmt" // https://pkg.go.dev/fmt

import (
    "github.com/joho/godotenv" // https://pkg.go.dev/github.com/joho/godotenv
    git "github.com/jesseduffield/lazygit" // https://pkg.go.dev/github.com/jesseduffield/lazygit
)

Note the last example: using gx while focused anywhere from the git alias to the end of the path string opens the correct URL, since the handler searches for the parent import-spec statement.