-
Notifications
You must be signed in to change notification settings - Fork 99
Code navigation #315
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
Merged
Merged
Code navigation #315
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
fa86370
Initial POC
brendan-kellam 19b59c4
Add cursor style rule
brendan-kellam 012823c
wip: resolve symbol definition in pop-up box
brendan-kellam ed056ab
further wip
brendan-kellam 8536185
wip
brendan-kellam d82cdb5
wip: started work on bottom panel
brendan-kellam 30f1e6b
wip: move find references to server action
brendan-kellam eb2793d
wip
brendan-kellam 64ca374
wip on fast readonly syntax highlighting using code mirror
brendan-kellam f2158b1
refactor things around
brendan-kellam f08f38e
Further wip: discovered that typical HighlightStyle.define highlighte…
brendan-kellam ed7f80e
wip: Add line number suppoert to the readonly code block
brendan-kellam 78d9e6e
further wip: refactored how the bottom panel is rendered s.t., we don…
brendan-kellam 7e6a0e5
perf: memoize highlight ranges to prevent unecessary re-renders
brendan-kellam 41d2aa9
chore: move search results list to use readonly ediotr
brendan-kellam 83b8964
rename readOnlyCodeBlock to lightweightCodeHighlighter
brendan-kellam 410dfc1
improve syntax highlighting
brendan-kellam 3529fb0
nits with keyboard shortcuts
brendan-kellam 52a6bca
move match count aggregation into API layer
brendan-kellam 02ce63c
wip on adding definitions tab to bottom panel
brendan-kellam 12c50d4
Add eslint rule for tanstack query
brendan-kellam b9127e2
Improve how we communicate multiple symbol definitions
brendan-kellam 98430db
Add support for revisions
brendan-kellam a02ad6c
chore: move stylized resize handle into shared component
brendan-kellam e1f4cf8
chore: refactor code nav UI into ee
brendan-kellam fb11a44
chore: made /browse the default path when clicking on a search result…
brendan-kellam 5823168
add code nav to preview panel
brendan-kellam 8f94f3e
small bug fixes
brendan-kellam 70d3623
wip: add scroll restoration to search results panel
brendan-kellam 27eb6fa
small nit improvements
brendan-kellam c77c58d
subtle changes to highlighting style
brendan-kellam 68a657a
Use word boundaries for references
brendan-kellam 6e2eb7a
make bottom panel larger
msukkari cbbcdbe
fix visual artifact issues with filter panel
brendan-kellam 2a350cd
bidirectional filtering
brendan-kellam ec9ee65
debug code
brendan-kellam c5e4efd
Improve search heuristic by filtering by language
brendan-kellam 239b774
Improved collapsed preview panel style
brendan-kellam ed814e5
add node types for a bunch of langs
msukkari 30f20fa
nit: add tooltip to focus search bar shortcut hint
brendan-kellam 6d3a059
Add cmd+click to open preview panel
brendan-kellam 2399350
feedback
brendan-kellam 9b90ca7
changelog
brendan-kellam ff0e4a3
posthog events
brendan-kellam acf75fd
wip on docs
brendan-kellam fce15e8
docs and changelog
brendan-kellam 8417242
improve code nav search heuristics: search across repositories, and e…
brendan-kellam 6e05378
delete unused /references route
brendan-kellam 11a18be
improve search contexts news sub_header
brendan-kellam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
description: | ||
globs: | ||
alwaysApply: true | ||
--- | ||
- Always use 4 spaces for indentation | ||
- Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Code navigation | ||
sidebarTitle: Code navigation (EE) | ||
--- | ||
|
||
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx' | ||
|
||
<Note> | ||
This feature is only available with an active Enterprise license. Please add your [license key](/self-hosting/license-key) to activate it. | ||
</Note> | ||
|
||
**Code navigation** allows you to jump between symbol definition and references when viewing source files in Sourcebot. This feature is enabled **automatically** when a valid license key is present and works with all popular programming languages. | ||
|
||
|
||
<video src="https://framerusercontent.com/assets/B9ZxrlsUeO9NJyzkKyvVV2KSU4.mp4" className="w-full aspect-video" controls></video> | ||
|
||
## Features | ||
|
||
| Feature | Description | | ||
|:--------|:------------| | ||
| **Hover popover** | Hovering over a symbol reveals the symbol's definition signature as a inline preview. | | ||
| **Go to definition** | Clicking the "go to definition" button in the popover or clicking the symbol name navigates to the symbol's definition. | | ||
| **Find references** | Clicking the "find all references" button in the popover lists all references in the explore panel. | | ||
| **Explore panel** | Lists all references and definitions for the symbol selected in the popover. | | ||
|
||
## How does it work? | ||
|
||
Code navigation is **search-based**, meaning it uses the same code search engine and [query language](/docs/search/syntax-reference) to estimate a symbol's references and definitions. We refer to these estimations as "search heuristics". We have two search heuristics to enable the following operations: | ||
|
||
### Find references | ||
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search: | ||
|
||
```bash | ||
\\b{symbolName}\\b rev:{git_revision} lang:{language} case:yes | ||
``` | ||
|
||
### Find definitions | ||
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search: | ||
|
||
```bash | ||
sym:\\b{symbolName}\\b rev:{git_revision} lang:{language} | ||
``` | ||
|
||
Note that the `sym:` prefix is used to filter the search by symbol definitions. These are created at index time by [universal ctags](https://ctags.io/). |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# File browser | ||
|
||
This directory contains Sourcebot's file browser implementation. URL paths are used to determine what file the user wants to view. The following template is used: | ||
|
||
```sh | ||
/browse/<repo-name>[@<optional-revision-name>]/-/(blob|tree)/<path_to_file> | ||
``` | ||
|
||
For example, to view `packages/backend/src/env.ts` in Sourcebot, we would use the following path: | ||
```sh | ||
/browse/github.com/sourcebot-dev/sourcebot@HEAD/-/blob/packages/backend/src/env.ts | ||
``` |
150 changes: 0 additions & 150 deletions
150
packages/web/src/app/[domain]/browse/[...path]/codePreview.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.