Skip to content

extensions: update git blame UI according to design

Administrator requested to merge taras-yemets/git-blame-redesign into main

Created by: taras-yemets

Second iteration on https://github.com/sourcegraph/sourcegraph/issues/38377 (first https://github.com/sourcegraph/sourcegraph/pull/39133)

Design

Loom (see also this comment)

Changes

  1. Removes blame decorations from the file diff and commit views (context).
  2. Removes extensions decorations column view support (https://github.com/sourcegraph/sourcegraph/pull/36007). Column decorations (if any) will be rendered as inline decorations. We don't expect to have any column decorations as previously only git-extras extension contributed with column decorations (https://github.com/sourcegraph/sourcegraph-git-extras/pull/276), and now it's been migrated to the core workflow (https://github.com/sourcegraph/sourcegraph/pull/39133).
  3. As a result of №2 References panel (client/web/src/codeintel/ReferencesPanel.tsx) has decorations disabled by default.
  4. Refactors blame visibility state management: get rid of React context in favor of rxjs' BehaviorSubject (not to rerender the whole component tree when the value changes).
  5. As we don't support extensions decorations column view (see №2), refactors ColumnDecorator component to be git-blame-specific (and rename it to BlameColumn).
  6. Extracts BlameDecoration into a separate file. It's used by both blob editors (viewers): Monaco and CodeMirror.
  7. Refacors blame decorations from TextDocumentDecoration interface to BlameHunk interface. Wo no longer treat blame decorations as extensions decorations so there's no need to implement the same interface.
  8. Because of №2 and №7, refactors CodeMirror blob decorations to handle inline decorations contributed by Sourcegraph extensions and git blame decorations separately.

Not implemented

  1. Git blame icon will be moved to the vertical sidebar (thread) in a separate PR to avoid conflicts with the ongoing work on https://github.com/sourcegraph/sourcegraph/issues/38378
  2. Extensions decoration column display support (as an experimental feature) will be removed in a separate PR.

Test plan

  • sg start web-standalone
  • ensure git blame works as expected in Monaco and CodeMirror blob viewers (to use the latter, one needs to enable enableCodeMirrorFileView experimental feature in user settings)
  • ensure extensions decorations are displayed in both editors (viewers) if enableLegacyExtensions experimental feature is enabled in sit config

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading