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

Add support for a file explorer #94

Open
brendan-kellam opened this issue Nov 27, 2024 · 3 comments
Open

Add support for a file explorer #94

brendan-kellam opened this issue Nov 27, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@brendan-kellam
Copy link
Contributor

After performing a search and finding a result, it would be useful if we could click into the file and get a "full-screen" preview of the file, along with a file hierarchy on the right. Something similar to GitHub:

image
@brendan-kellam brendan-kellam added the enhancement New feature or request label Nov 27, 2024
@brendan-kellam brendan-kellam changed the title Add support for file browsing Add support for a file explorer Nov 27, 2024
@KonradStanski
Copy link
Contributor

Looking into this and investigating existing url templates:

Github:

file:
https://github.com/sourcegraph/zoekt/blob/main/json/json.go
branch:
https://github.com/sourcegraph/zoekt/blob/zoekt-debug/json/json.go
specific commit:
https://github.com/sourcegraph/zoekt/blob/87a0b748f0caf8209e493479bef144d5ef241677/json/json.go
Template:
https://github.com/${org}/${repo}/${blob|tree}/${branch-tag-commit}/${file-path}
Important notes:
When navigating, if the file-path is a file, we use "blob". When it is a folder, we use "tree"

Sourcegraph:

folder:
https://sourcegraph.com/github.com/microsoft/vscode/-/tree/src/vs/workbench/contrib/testing/common
file:
https://sourcegraph.com/github.com/microsoft/vscode/-/blob/src/vs/workbench/contrib/testing/common/observableValue.ts
branch:
https://sourcegraph.com/github.com/microsoft/vscode@line-height/-/blob/src/vs/workbench/contrib/testing/common/observableValue.ts
https://sourcegraph.com/github.com/microsoft/vscode/-/blob/src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts
Template:
https://sourcegraph.com/${code-host}/${org}/${repo}/@${branch-tag-commit}/-/${blob|tree}/${file-path}
Important notes:
branch + "@" is optional, if left out defaults to head.
When navigating, if the file-path is a file, we use "blob". When it is a folder, we use "tree"

Gitlab:

file | folder:
https://${gitlab-host}/${user-org}/${repo}/-/${blob|tree}/${branch-tag-commit}/${file-path}?ref_type=heads
Important notes:
When navigating, if the file-path is a file, we use "blob". When it is a folder, we use "tree"

@KonradStanski
Copy link
Contributor

KonradStanski commented Dec 3, 2024

Some observations:

  • Seems like the consensus is put "tree" in the URL path when looking at a folder, and "blob" when looking at file.
  • branches, tags, commits are treated as equivalent.
  • need some way of including the different code host "repo/project/org/user/ect" paths uniformly. Github paths include an org, whereas gerrit projects can include "/" in the repo name to group them in "folders".
    • Sourcegraph probably handles this the best, as it already encodes all of these hosts.
  • should we use query params for some of these?
  • It seems like gitlab and sourcegraph delineate the "org/host/repo" preamble from the path with "/~/"
  • Need to make sure to handle the case where 2 different code hosts have the same repo name.

@KonradStanski
Copy link
Contributor

Will be good to support "goto def" search and "find references" search when browsing code:
This can work like what sourcegraph uses:
https://sourcegraph.com/docs/code-search/code-navigation/search_based_code_navigation
Perhaps in a codemirror tooltip:
https://codemirror.net/examples/tooltip/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants