Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: go import handler based on treesitter #47

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

sportshead
Copy link
Contributor

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.

Copy link
Owner

@chrishrb chrishrb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handler works as expected. 👍 Can you please add some tests and maybe change the hyphens in the readme back to asterisks?

README.md Outdated Show resolved Hide resolved
@chrishrb chrishrb mentioned this pull request Mar 13, 2024
@chrishrb chrishrb merged commit 4136a82 into chrishrb:main Apr 29, 2024
2 checks passed
@sportshead sportshead deleted the go-handler branch April 29, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants