Validate CodeMirror as alternative blob view implementation
Created by: fkling
This issues keeps track of the work that needs to be done for a baseline implementation of the blob view with CodeMirror.
The feature flag is enableCodeMirrorFileView
.
-
Add minimal implementation behind feature flag #37922 (closed)
- Sync line selection to/from URL
-
Enable syntax highlighting with SCIP data
- POC: #39116
- Client side: #39386
Syntax highlight server #39264-
Syntax highlight server
#2
https://github.com/sourcegraph/sourcegraph/pull/39850 - GraphQL/Go glue https://github.com/sourcegraph/sourcegraph/pull/40166
- Code intel popovers
- Search with meta+F https://github.com/sourcegraph/sourcegraph/pull/39884
- Basic telemetry
- Jump to definition
-
Click to jump to definition
- From @fkling: As long as we have a real text cursor it would be surprising if we implemented this exact behavior. Apparently IDEs support this if a modifier key is pressed, so we should consider to do the same.
- Implementation without modifier: https://github.com/sourcegraph/sourcegraph/pull/40232
- Find references
- Git blame
- Highlight symbol references on hover
- Support status bar (including extensions)
- Support extension API as far as possible and document what isn't supported (if any)
Known issues to be fixed/discussed:
-
Selected line is not synced with cursor position and therefore not sent to extensions
- Handled in https://github.com/sourcegraph/sourcegraph/pull/40131 by sending the information about selected lines to the extensions instead.
- File content is visible under line numbers (looks like line number background is transparent?)
-
Dismissing the hovercard info box causes the hovercard to shrink upwards, "detaching" it from the line/token it was shown for.
- We either need to call CodeMirror's repositioning logic
- this was also done in https://github.com/sourcegraph/sourcegraph/pull/39881
- Or change the style so that the the dimensions of the hovercard don't change.
- We either need to call CodeMirror's repositioning logic
-
Hovercards are disabled in reference panel blob view (see https://github.com/sourcegraph/sourcegraph/pull/40131 for more information)
- From @fkling: Issue was something different. See PR
If replacing<Router />
with<MemoryRouter />
would fix the navigation issue (which I don't know), then we could introduce a special flag/config option to instruct the React wrapper to useMemoryRouter
instead ofRouter
. It's not pretty but doable. But if simply using<MemoryRouter />
would not solve the issue then I don't think there is anything we can do about that (except refactoring the ref panel and hover cards to work differently). So whether or not to fix/change this is up for debate. - https://github.com/sourcegraph/sourcegraph/pull/40249
- From @fkling: Issue was something different. See PR
-
Close button is not functional in un-pinned hovercards
- From @fkling: Planned solution, as discussed below: Hide close button if hovercard is not pinned
- Hide close button: https://github.com/sourcegraph/sourcegraph/pull/40232