@adecore/editor-react 0.53.3 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/AnchoredPopup.d.ts +1 -1
  2. package/dist/AnchoredPopup.js +27 -12
  3. package/dist/AttributionCard.d.ts +1 -1
  4. package/dist/BaselineStatus.js +1 -1
  5. package/dist/CallHierarchyPanel.js +11 -10
  6. package/dist/ChangeReview.d.ts +1 -1
  7. package/dist/CodeAuthorsCard.js +2 -2
  8. package/dist/CompletionPopup.js +18 -14
  9. package/dist/DiffView.d.ts +2 -2
  10. package/dist/DiffView.js +159 -143
  11. package/dist/EditorContextMenu.js +1 -1
  12. package/dist/EditorView.d.ts +2 -2
  13. package/dist/EditorView.js +97 -81
  14. package/dist/FindReplace.js +3 -3
  15. package/dist/HoverCard.d.ts +3 -3
  16. package/dist/HoverCard.js +3 -3
  17. package/dist/HoverSections.js +1 -1
  18. package/dist/LanguagePopups.js +1 -1
  19. package/dist/Markdown.js +15 -3
  20. package/dist/PeekPanel.js +124 -103
  21. package/dist/PickPopup.js +8 -4
  22. package/dist/RenameCard.js +7 -7
  23. package/dist/RenderedDocs.d.ts +1 -1
  24. package/dist/RenderedDocs.js +1 -1
  25. package/dist/SplitDiffView.js +21 -4
  26. package/dist/SymbolPicker.js +93 -89
  27. package/dist/WrapCard.js +1 -1
  28. package/dist/call-hierarchy.d.ts +1 -1
  29. package/dist/call-hierarchy.js +3 -3
  30. package/dist/code-actions.js +2 -2
  31. package/dist/code-vision.d.ts +1 -1
  32. package/dist/completion-model.d.ts +1 -1
  33. package/dist/completion-model.js +2 -2
  34. package/dist/completion.d.ts +1 -1
  35. package/dist/completion.js +12 -12
  36. package/dist/diagnostics.d.ts +1 -1
  37. package/dist/diagnostics.js +1 -1
  38. package/dist/diff-overlays.js +2 -2
  39. package/dist/editor-language.d.ts +12 -12
  40. package/dist/editor-language.js +10 -10
  41. package/dist/editor-react.css +4 -4
  42. package/dist/highlights.d.ts +1 -1
  43. package/dist/highlights.js +2 -2
  44. package/dist/host-types.d.ts +4 -4
  45. package/dist/hover.js +1 -1
  46. package/dist/inlay-hints.js +1 -1
  47. package/dist/live-templates.js +1 -1
  48. package/dist/markup.js +1 -1
  49. package/dist/navigation.d.ts +1 -1
  50. package/dist/navigation.js +3 -3
  51. package/dist/peek.js +1 -1
  52. package/dist/popups.d.ts +5 -5
  53. package/dist/project-language.d.ts +4 -4
  54. package/dist/project-language.js +5 -5
  55. package/dist/rename.js +1 -1
  56. package/dist/rendered-docs.d.ts +1 -1
  57. package/dist/rendered-docs.js +1 -1
  58. package/dist/shortcut-keys.d.ts +1 -1
  59. package/dist/signature.js +1 -1
  60. package/dist/snippet-field-transforms.d.ts +2 -2
  61. package/dist/snippet-insert.js +3 -3
  62. package/dist/snippet-session.d.ts +2 -2
  63. package/dist/snippet-session.js +5 -5
  64. package/dist/snippet-transform-queue.d.ts +1 -1
  65. package/dist/surround.js +1 -1
  66. package/dist/symbol-picker.js +2 -2
  67. package/dist/templates.js +1 -1
  68. package/dist/use-problem-counts.d.ts +1 -1
  69. package/package.json +6 -6
  70. package/src/AnchoredPopup.tsx +7 -3
  71. package/src/AttributionCard.tsx +1 -1
  72. package/src/BaselineStatus.tsx +1 -1
  73. package/src/CallHierarchyPanel.tsx +13 -12
  74. package/src/ChangeReview.tsx +1 -1
  75. package/src/CodeAuthorsCard.tsx +2 -2
  76. package/src/CompletionPopup.tsx +16 -13
  77. package/src/DiffView.tsx +12 -6
  78. package/src/EditorContextMenu.tsx +2 -2
  79. package/src/EditorView.tsx +14 -6
  80. package/src/FindReplace.tsx +3 -3
  81. package/src/HoverCard.tsx +7 -7
  82. package/src/HoverSections.tsx +1 -1
  83. package/src/LanguagePopups.tsx +3 -3
  84. package/src/Markdown.tsx +13 -2
  85. package/src/PeekPanel.tsx +13 -13
  86. package/src/PickPopup.tsx +6 -5
  87. package/src/RenameCard.tsx +8 -8
  88. package/src/RenderedDocs.tsx +3 -3
  89. package/src/SplitDiffView.tsx +14 -5
  90. package/src/SymbolPicker.tsx +6 -6
  91. package/src/WrapCard.tsx +2 -2
  92. package/src/call-hierarchy.ts +5 -5
  93. package/src/code-actions.ts +3 -3
  94. package/src/code-authors.ts +1 -1
  95. package/src/code-vision.ts +3 -3
  96. package/src/completion-model.ts +3 -3
  97. package/src/completion.ts +15 -15
  98. package/src/diagnostics.ts +4 -4
  99. package/src/diff-overlays.tsx +4 -4
  100. package/src/editor-language.ts +13 -13
  101. package/src/editor-react.css +4 -4
  102. package/src/format-on-type.ts +1 -1
  103. package/src/highlights.ts +3 -3
  104. package/src/host-types.ts +4 -4
  105. package/src/hover.ts +3 -3
  106. package/src/inlay-hints.ts +1 -1
  107. package/src/line-edits.ts +1 -1
  108. package/src/live-templates.ts +2 -2
  109. package/src/markup.ts +2 -2
  110. package/src/navigation.ts +5 -5
  111. package/src/patch-decorations.ts +1 -1
  112. package/src/peek.ts +3 -3
  113. package/src/pick.ts +1 -1
  114. package/src/popups.ts +5 -5
  115. package/src/postfix.ts +1 -1
  116. package/src/project-language.ts +7 -7
  117. package/src/proposal-model.ts +1 -1
  118. package/src/rename.ts +3 -3
  119. package/src/rendered-docs.ts +2 -2
  120. package/src/shortcut-keys.ts +1 -1
  121. package/src/signature.ts +3 -3
  122. package/src/snippet-field-transforms.ts +2 -2
  123. package/src/snippet-insert.ts +3 -3
  124. package/src/snippet-session.ts +7 -7
  125. package/src/snippet-transform-queue.ts +1 -1
  126. package/src/surround.ts +1 -1
  127. package/src/symbol-picker-model.ts +1 -1
  128. package/src/symbol-picker.ts +3 -3
  129. package/src/templates.ts +1 -1
  130. package/src/use-problem-counts.ts +1 -1
  131. package/src/workspace-edit.ts +1 -1
@@ -1,8 +1,8 @@
1
- import { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
1
+ import { MAX_REPLACEMENT_PAGE, MAX_REPLACEMENT_CHARACTERS, type Editor, type EditorFindState } from '@adecore/editor';
3
2
  import { Button } from '@adecore/ui';
4
3
  import { formatNumber } from '@adecore/ui/format';
5
- import { MAX_REPLACEMENT_PAGE, MAX_REPLACEMENT_CHARACTERS, type Editor, type EditorFindState } from '@adecore/editor';
4
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import { compileFind, EMPTY_FIND_QUERY, type FindQuery } from './find-query.ts';
7
7
 
8
8
  export function FindReplace({ editor, className, onClose }: { editor: Editor; className?: string; onClose?(): void }) {
package/src/HoverCard.tsx CHANGED
@@ -1,15 +1,15 @@
1
- import type { ReactNode } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { CircleX, Info, TriangleAlert } from 'lucide-react';
1
+ import type { EditorPosition } from '@adecore/editor';
4
2
  import { fileUriToPath, type Location } from '@adecore/lsp';
5
3
  import { Button, Icon, Tooltip } from '@adecore/ui';
6
4
  import { formatNumber } from '@adecore/ui/format';
7
- import type { EditorPosition } from '@adecore/editor';
8
- import { basenameOf } from './paths.ts';
9
- import type { EditorLanguage } from './editor-language.ts';
5
+ import { CircleX, Info, TriangleAlert } from 'lucide-react';
6
+ import type { ReactNode } from 'react';
7
+ import { useTranslation } from 'react-i18next';
10
8
  import { codeLabelOf, severityOf, type Problem } from './diagnostics-model.ts';
11
- import type { HoverInfo } from './popups.ts';
9
+ import type { EditorLanguage } from './editor-language.ts';
12
10
  import { SymbolSections } from './HoverSections.tsx';
11
+ import { basenameOf } from './paths.ts';
12
+ import type { HoverInfo } from './popups.ts';
13
13
 
14
14
  const SEVERITY_ICONS = { error: CircleX, warning: TriangleAlert, info: Info, hint: Info } as const;
15
15
  const SEVERITY_COLORS = { error: 'text-status-error', warning: 'text-status-needs-you', info: 'text-status-running', hint: 'text-text-muted' } as const;
@@ -1,5 +1,5 @@
1
- import { useEffect, useState, type MouseEvent } from 'react';
2
1
  import { Tooltip } from '@adecore/ui';
2
+ import { useEffect, useState, type MouseEvent } from 'react';
3
3
  import { BaselineStatus } from './BaselineStatus.tsx';
4
4
  import { hoverSectionsOf, markdownParts, type DocTag, type HoverSection, type HoverText } from './hover-content.ts';
5
5
  import { Markdown } from './Markdown.tsx';
@@ -1,20 +1,20 @@
1
1
  import { useEffect, useReducer, type ReactNode } from 'react';
2
2
  import { useStore } from 'zustand';
3
- import type { EditorLanguage } from './editor-language.ts';
4
3
  import { AnchoredPopup } from './AnchoredPopup.tsx';
5
4
  import { CallHierarchyPanel } from './CallHierarchyPanel.tsx';
6
5
  import { CodeAuthorsCard } from './CodeAuthorsCard.tsx';
7
6
  import { CompletionPopup } from './CompletionPopup.tsx';
7
+ import type { EditorLanguage } from './editor-language.ts';
8
8
  import { EditorContextMenu } from './EditorContextMenu.tsx';
9
9
  import { HoverCard } from './HoverCard.tsx';
10
10
  import { PeekPanel } from './PeekPanel.tsx';
11
11
  import { PickPopup } from './PickPopup.tsx';
12
+ import type { HoverView } from './popups.ts';
12
13
  import { RenameCard } from './RenameCard.tsx';
13
14
  import { RenderedDocs } from './RenderedDocs.tsx';
14
- import { SymbolPicker } from './SymbolPicker.tsx';
15
15
  import { SignatureCard } from './SignatureCard.tsx';
16
+ import { SymbolPicker } from './SymbolPicker.tsx';
16
17
  import { WrapCard } from './WrapCard.tsx';
17
- import type { HoverView } from './popups.ts';
18
18
 
19
19
  export interface LanguagePopupsProps<Language extends EditorLanguage = EditorLanguage> {
20
20
  language: Language;
package/src/Markdown.tsx CHANGED
@@ -1,16 +1,27 @@
1
+ import { ScrollArea } from '@adecore/ui';
1
2
  import ReactMarkdown, { type Components } from 'react-markdown';
2
- import remarkGfm from 'remark-gfm';
3
3
  import remarkBreaks from 'remark-breaks';
4
+ import remarkGfm from 'remark-gfm';
5
+
6
+ /* A code block wider than its card scrolls on its own. */
7
+ const CODE_BLOCKS: Components = {
8
+ pre: ({ children }) => (
9
+ <ScrollArea axis="both" render={<pre />}>
10
+ {children}
11
+ </ScrollArea>
12
+ )
13
+ };
4
14
 
5
15
  /* An image becomes its alt text, so a comment cannot make the editor fetch a page of its choosing. */
6
16
  const WITHOUT_IMAGES: Components = {
17
+ ...CODE_BLOCKS,
7
18
  img: ({ alt }) => <>{alt ?? ''}</>
8
19
  };
9
20
 
10
21
  export function Markdown({ text, images = true }: { text: string; images?: boolean }) {
11
22
  return (
12
23
  <div className="adecore-editor-markdown">
13
- <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]} components={images ? undefined : WITHOUT_IMAGES}>
24
+ <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]} components={images ? CODE_BLOCKS : WITHOUT_IMAGES}>
14
25
  {text}
15
26
  </ReactMarkdown>
16
27
  </div>
package/src/PeekPanel.tsx CHANGED
@@ -1,21 +1,21 @@
1
+ import { fileUriToPath } from '@adecore/lsp';
2
+ import { FileIcon, IconButton, ScrollArea, Tooltip } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
4
+ import { ChevronDown, ChevronRight, X } from 'lucide-react';
1
5
  import { useEffect, useRef, useState } from 'react';
2
6
  import { createPortal } from 'react-dom';
3
7
  import { useTranslation } from 'react-i18next';
4
- import { ChevronDown, ChevronRight, X } from 'lucide-react';
5
- import { fileUriToPath } from '@adecore/lsp';
6
- import { FileIcon, IconButton, Tooltip } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
- import { basenameOf, relativeTo } from './paths.ts';
9
8
  import type { EditorLanguage } from './editor-language.ts';
10
9
  import { shikiLanguageOfPath } from './language-ids.ts';
11
- import { PathText } from './PathText.tsx';
12
- import { PanelResizeHandle } from './PanelResizeHandle.tsx';
13
- import { usePanelBody } from './use-panel-body.ts';
14
10
  import { PANEL_BODY_HEIGHT } from './panel-size.ts';
15
- import { PEEK_HEIGHT } from './peek.ts';
11
+ import { PanelResizeHandle } from './PanelResizeHandle.tsx';
12
+ import { basenameOf, relativeTo } from './paths.ts';
13
+ import { PathText } from './PathText.tsx';
16
14
  import { distinguishingFolders, visualColumnOf, type NameRange, type PeekPlace } from './peek-model.ts';
15
+ import { PEEK_HEIGHT } from './peek.ts';
17
16
  import type { PeekView } from './popups.ts';
18
17
  import { useEditorRendering } from './rendering-context.ts';
18
+ import { usePanelBody } from './use-panel-body.ts';
19
19
 
20
20
  const TAB_SIZE = 4;
21
21
 
@@ -58,7 +58,7 @@ export function Preview({ preview }: { preview: PeekView['preview'] }) {
58
58
  const name = preview.name === null ? null : columnsOf(lines[preview.active] ?? '', preview.name);
59
59
 
60
60
  return (
61
- <div ref={scroller} className="relative min-w-0 flex-1 overflow-auto pt-1">
61
+ <ScrollArea axis="both" viewportRef={scroller} className="flex-1" viewportClassName="relative pt-1">
62
62
  <div className="relative flex min-w-max">
63
63
  <div
64
64
  className="absolute inset-x-0 bg-surface-hover"
@@ -93,7 +93,7 @@ export function Preview({ preview }: { preview: PeekView['preview'] }) {
93
93
  )}
94
94
  </div>
95
95
  </div>
96
- </div>
96
+ </ScrollArea>
97
97
  );
98
98
  }
99
99
 
@@ -141,7 +141,7 @@ function Places({ language, view }: { language: EditorLanguage; view: PeekView }
141
141
  }, [view.active]);
142
142
 
143
143
  return (
144
- <div className="w-1/3 shrink-0 overflow-y-auto border-l border-border py-1">
144
+ <ScrollArea className="w-1/3 shrink-0 border-l border-border" viewportClassName="py-1">
145
145
  {view.files.map((file, fileIndex) => {
146
146
  const collapsed = view.collapsed.includes(file.uri);
147
147
 
@@ -178,7 +178,7 @@ function Places({ language, view }: { language: EditorLanguage; view: PeekView }
178
178
  </div>
179
179
  );
180
180
  })}
181
- </div>
181
+ </ScrollArea>
182
182
  );
183
183
  }
184
184
 
package/src/PickPopup.tsx CHANGED
@@ -1,6 +1,7 @@
1
+ import type { EditorRect } from '@adecore/editor';
2
+ import { ScrollArea } from '@adecore/ui';
1
3
  import { useId, useLayoutEffect, useRef } from 'react';
2
4
  import { createPortal } from 'react-dom';
3
- import type { EditorRect } from '@adecore/editor';
4
5
  import type { EditorLanguage } from './editor-language.ts';
5
6
  import { PathText } from './PathText.tsx';
6
7
  import { keepFocusOutOfList, useInputPopup } from './popup-focus.ts';
@@ -30,11 +31,11 @@ function MatchedLabel({ label, query }: { label: string; query: string | null })
30
31
  function PreviewLines({ preview }: { preview: PickPreview }) {
31
32
  if (preview.kind === 'text') {
32
33
  return (
33
- <div className="max-h-48 overflow-auto border-t border-border p-2 font-mono text-code whitespace-pre">
34
+ <ScrollArea axis="both" className="max-h-48 border-t border-border" viewportClassName="p-2 font-mono text-code whitespace-pre">
34
35
  {preview.added.map((line, index) => (
35
36
  <div key={index}>{line === '' ? ' ' : line}</div>
36
37
  ))}
37
- </div>
38
+ </ScrollArea>
38
39
  );
39
40
  }
40
41
 
@@ -123,7 +124,7 @@ export function PickPopup({ language, view, rect }: { language: EditorLanguage;
123
124
  {view.query !== null && view.query !== '' && <span className="ml-auto shrink-0 font-mono text-text">{view.query}</span>}
124
125
  </div>
125
126
  )}
126
- <div id={listId} role="listbox" className="min-h-0 flex-1 overflow-y-auto p-1">
127
+ <ScrollArea id={listId} role="listbox" className="flex-1" viewportClassName="p-1">
127
128
  {view.groups.map((group, groupIndex) => (
128
129
  <div key={group.title ?? groupIndex} role="group" className="flex flex-col">
129
130
  {group.title !== null && <div className="px-2 pt-1.5 pb-0.5 text-xs font-medium text-text-faint">{group.title}</div>}
@@ -161,7 +162,7 @@ export function PickPopup({ language, view, rect }: { language: EditorLanguage;
161
162
  ))}
162
163
  </div>
163
164
  ))}
164
- </div>
165
+ </ScrollArea>
165
166
  {view.preview !== null && <PreviewLines preview={view.preview} />}
166
167
  </div>,
167
168
  document.body
@@ -1,14 +1,14 @@
1
+ import type { EditorRect } from '@adecore/editor';
2
+ import { fileUriToPath } from '@adecore/lsp';
3
+ import { Button, Icon, ScrollArea } from '@adecore/ui';
4
+ import { formatNumber } from '@adecore/ui/format';
5
+ import { Sparkles } from 'lucide-react';
1
6
  import { useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react';
2
7
  import { createPortal } from 'react-dom';
3
8
  import { useTranslation } from 'react-i18next';
4
- import { Sparkles } from 'lucide-react';
5
- import { fileUriToPath } from '@adecore/lsp';
6
- import type { EditorRect } from '@adecore/editor';
7
- import { Button, Icon } from '@adecore/ui';
8
- import { formatNumber } from '@adecore/ui/format';
9
- import { basenameOf, relativeTo } from './paths.ts';
10
9
  import { AnchoredPopup } from './AnchoredPopup.tsx';
11
10
  import type { EditorLanguage } from './editor-language.ts';
11
+ import { basenameOf, relativeTo } from './paths.ts';
12
12
  import { keepFocusOutOfList } from './popup-focus.ts';
13
13
  import type { RenameView } from './popups.ts';
14
14
 
@@ -99,7 +99,7 @@ function Preview({ language, view }: { language: EditorLanguage; view: RenameVie
99
99
 
100
100
  return (
101
101
  <div className="flex w-[520px] max-w-full flex-col" onPointerDown={(event) => event.preventDefault()}>
102
- <div className="max-h-[320px] overflow-y-auto">
102
+ <ScrollArea className="max-h-[320px]">
103
103
  {view.files.map((file) => {
104
104
  const path = fileUriToPath(file.uri);
105
105
  const shown = path === null ? file.uri : relativeTo(path, folder);
@@ -140,7 +140,7 @@ function Preview({ language, view }: { language: EditorLanguage; view: RenameVie
140
140
  ))}
141
141
  </div>
142
142
  )}
143
- </div>
143
+ </ScrollArea>
144
144
  <div className="flex items-center justify-end gap-2 border-t border-border p-2">
145
145
  <Button size="xs" variant="ghost" onClick={() => language.rename.cancel()}>
146
146
  {t('language.rename.cancel')}
@@ -1,9 +1,9 @@
1
- import { createPortal } from 'react-dom';
2
- import { memo, useSyncExternalStore, type MouseEvent } from 'react';
3
1
  import type { DocComment } from '@adecore/editor';
2
+ import { memo, useSyncExternalStore, type MouseEvent } from 'react';
3
+ import { createPortal } from 'react-dom';
4
4
  import { useTranslation } from 'react-i18next';
5
- import type { EditorLanguage } from './editor-language.ts';
6
5
  import { DOC_LINK_PREFIX, sectionsOf, type DocTagEntry, type ParsedDocComment } from './doc-comment-model.ts';
6
+ import type { EditorLanguage } from './editor-language.ts';
7
7
  import { markdownParts } from './hover-content.ts';
8
8
  import { Signature } from './HoverSections.tsx';
9
9
  import { shikiLanguageOf } from './language-ids.ts';
@@ -1,18 +1,21 @@
1
- import { useLayoutEffect, useMemo, useRef, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { parseChord } from '@adecore/editor/keymap';
4
1
  import type { EditorLineHighlight } from '@adecore/editor';
2
+ import { parseChord } from '@adecore/editor/keymap';
5
3
  import { sourceLineOf, type DiffLineRow, type DiffSplit } from '@adecore/merge';
6
- import type { DiffViewProps } from './DiffView.tsx';
7
- import { repaintOnTokens, type DiffSourceSide } from './diff-syntax.ts';
4
+ import { useOverlayScrollbars } from '@adecore/ui';
5
+ import { useLayoutEffect, useMemo, useRef, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
8
7
  import { DiffOverlays, type MountedDiff } from './diff-overlays.tsx';
8
+ import { repaintOnTokens, type DiffSourceSide } from './diff-syntax.ts';
9
9
  import { wordMarks } from './diff-wordmarks.ts';
10
+ import type { DiffViewProps } from './DiffView.tsx';
10
11
  import { RowHost, LineActionHost } from './row-host.ts';
11
12
  import { splitAlignment } from './split-alignment.ts';
12
13
  import { SplitScroll } from './split-scroll.ts';
13
14
 
14
15
  const SIDES = ['old', 'new'] as const;
15
16
 
17
+ const NO_SCROLLERS: Record<DiffSourceSide, HTMLElement | null> = { old: null, new: null };
18
+
16
19
  interface MountedSplit {
17
20
  old: MountedDiff;
18
21
  new: MountedDiff;
@@ -54,6 +57,9 @@ export function SplitDiffView({
54
57
  const [failure, setFailure] = useState<{ error: unknown } | null>(null);
55
58
  const [mounted, setMounted] = useState<MountedSplit | null>(null);
56
59
  const [height, setHeight] = useState(0);
60
+ const [scrollers, setScrollers] = useState<Record<DiffSourceSide, HTMLElement | null>>(NO_SCROLLERS);
61
+ const oldScrollbars = useOverlayScrollbars(scrollers.old, { axis: 'both' });
62
+ const newScrollbars = useOverlayScrollbars(scrollers.new, { axis: 'both' });
57
63
 
58
64
  useLayoutEffect(() => {
59
65
  current.current = { document, display, tokens, theme, wrap, label };
@@ -194,10 +200,12 @@ export function SplitDiffView({
194
200
  ]);
195
201
 
196
202
  setMounted({ old: sides.old, new: sides.new, align, update, drive: (side) => scroll.drive(side) });
203
+ setScrollers({ old: oldHost.querySelector<HTMLElement>('.se-viewport'), new: newHost.querySelector<HTMLElement>('.se-viewport') });
197
204
  measure();
198
205
 
199
206
  return () => {
200
207
  stopped = true;
208
+ setScrollers(NO_SCROLLERS);
201
209
 
202
210
  for (const stop of stops) {
203
211
  stop();
@@ -399,6 +407,7 @@ export function SplitDiffView({
399
407
  onKeyDownCapture={drive}
400
408
  >
401
409
  <div ref={side === 'old' ? oldElement : newElement} className="adecore-editor-diff-surface" />
410
+ {side === 'old' ? oldScrollbars : newScrollbars}
402
411
  {mounted !== null && mounted[side].engine === engine && (
403
412
  <DiffOverlays mounted={mounted[side]} display={display[side]} unfold={unfold} blocked={blocked} />
404
413
  )}
@@ -1,10 +1,10 @@
1
+ import { fileUriToPath } from '@adecore/lsp';
2
+ import { formatShortcut, Icon, ScrollArea } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
4
+ import { AtSign, Hash } from 'lucide-react';
1
5
  import { useEffect, useRef, useState, type KeyboardEvent } from 'react';
2
6
  import { createPortal } from 'react-dom';
3
7
  import { useTranslation } from 'react-i18next';
4
- import { AtSign, Hash } from 'lucide-react';
5
- import { fileUriToPath } from '@adecore/lsp';
6
- import { formatShortcut, Icon } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import type { EditorLanguage } from './editor-language.ts';
9
9
  import { basenameOf } from './paths.ts';
10
10
  import type { SymbolsView } from './popups.ts';
@@ -123,7 +123,7 @@ export function SymbolPicker({ language, view }: { language: EditorLanguage; vie
123
123
  {language.shortcuts.goToSymbol === null ? '' : formatShortcut(language.shortcuts.goToSymbol, language.apple)}
124
124
  </span>
125
125
  </div>
126
- <div role="listbox" className="max-h-[320px] overflow-y-auto p-1">
126
+ <ScrollArea role="listbox" className="max-h-[320px]" viewportClassName="p-1">
127
127
  {mode.mode === 'line' && (
128
128
  <div className="px-2 py-1.5 text-xs text-text-muted">
129
129
  {mode.line === null ? t('language.symbols.lineHint') : t('language.symbols.goToLine', { line: formatNumber(mode.line) })}
@@ -194,7 +194,7 @@ export function SymbolPicker({ language, view }: { language: EditorLanguage; vie
194
194
  {mode.text === '' ? t('language.symbols.workspaceHint') : t('language.symbols.none')}
195
195
  </div>
196
196
  )}
197
- </div>
197
+ </ScrollArea>
198
198
  <div className="flex items-center gap-3 border-t border-border px-3 py-1.5 text-xs whitespace-nowrap text-text-faint">
199
199
  <span>↑↓ {t('language.symbols.navigate')}</span>
200
200
  <span>↵ {t('language.symbols.open')}</span>
package/src/WrapCard.tsx CHANGED
@@ -1,7 +1,7 @@
1
- import { useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
1
  import type { EditorRect } from '@adecore/editor';
4
2
  import { Input } from '@adecore/ui';
3
+ import { useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
5
  import { AnchoredPopup } from './AnchoredPopup.tsx';
6
6
  import type { EditorLanguage } from './editor-language.ts';
7
7
  import type { WrapView } from './popups.ts';
@@ -1,7 +1,5 @@
1
- import { StaleResultError, type CallHierarchyItem } from '@adecore/lsp';
2
- import { KEY_PRIORITY } from './key-priority.ts';
3
1
  import type { EditorPosition } from '@adecore/editor';
4
- import type { EditorLanguage } from './editor-language.ts';
2
+ import { StaleResultError, type CallHierarchyItem } from '@adecore/lsp';
5
3
  import {
6
4
  CALL_LEVEL_LIMIT,
7
5
  childrenOf,
@@ -17,10 +15,12 @@ import {
17
15
  type CallNode,
18
16
  type CallRow
19
17
  } from './call-hierarchy-model.ts';
20
- import { PEEK_HEIGHT } from './peek.ts';
18
+ import type { EditorLanguage } from './editor-language.ts';
19
+ import { messageOf } from './error-message.ts';
20
+ import { KEY_PRIORITY } from './key-priority.ts';
21
21
  import { snippetOf } from './peek-model.ts';
22
+ import { PEEK_HEIGHT } from './peek.ts';
22
23
  import { isShortcut } from './shortcut-keys.ts';
23
- import { messageOf } from './error-message.ts';
24
24
  import { realTimers, revealRow, type Timers } from './timers.ts';
25
25
 
26
26
  const TOAST_ID = 'language-call-hierarchy';
@@ -1,6 +1,5 @@
1
- import { ErrorCodes, LspError, StaleResultError, type CodeAction, type Command, type Diagnostic, type Position } from '@adecore/lsp';
2
- import { KEY_PRIORITY } from './key-priority.ts';
3
1
  import type { EditorPosition, EditorRange } from '@adecore/editor';
2
+ import { ErrorCodes, LspError, StaleResultError, type CodeAction, type Command, type Diagnostic, type Position } from '@adecore/lsp';
4
3
  import {
5
4
  ACTION_GROUPS,
6
5
  REFACTOR_GROUPS,
@@ -15,11 +14,12 @@ import {
15
14
  } from './code-actions-model.ts';
16
15
  import { comparePositions, type Problem } from './diagnostics-model.ts';
17
16
  import type { EditorLanguage } from './editor-language.ts';
17
+ import { messageOf } from './error-message.ts';
18
+ import { KEY_PRIORITY } from './key-priority.ts';
18
19
  import type { PickGroup, PickPreview } from './popups.ts';
19
20
  import { Refresher } from './refresher.ts';
20
21
  import { isShortcut } from './shortcut-keys.ts';
21
22
  import { realTimers, type Timers } from './timers.ts';
22
- import { messageOf } from './error-message.ts';
23
23
 
24
24
  const METHOD = 'textDocument/codeAction';
25
25
  const PAUSE_MS = 250;
@@ -1,6 +1,6 @@
1
- import type { i18n } from 'i18next';
2
1
  import { diffLines, splitLines } from '@adecore/merge';
3
2
  import { formatNumber } from '@adecore/ui/format';
3
+ import type { i18n } from 'i18next';
4
4
  import type { GitBlameCommit, GitBlameResult } from './host-types.ts';
5
5
 
6
6
  /* A line no commit holds yet; every other line maps to the index of the commit that wrote it. */
@@ -1,10 +1,10 @@
1
- import { splitLines } from '@adecore/merge';
2
- import type { GitBlameCommit, GitBlameResult } from './host-types.ts';
3
1
  import type { EditorCodeVision, EditorCodeVisionEntry, EditorRect } from '@adecore/editor';
4
2
  import type { DocumentSymbolResult, Location } from '@adecore/lsp';
5
- import type { EditorLanguage } from './editor-language.ts';
3
+ import { splitLines } from '@adecore/merge';
6
4
  import { type CodeAuthorship, authorsText, authorshipOf, mapBlame } from './code-authors.ts';
7
5
  import { type CodeVisionDeclaration, declarationsOf, usagesText } from './code-vision-model.ts';
6
+ import type { EditorLanguage } from './editor-language.ts';
7
+ import type { GitBlameCommit, GitBlameResult } from './host-types.ts';
8
8
  import { realTimers, type Timers } from './timers.ts';
9
9
  import { placeKey } from './unique.ts';
10
10
 
@@ -1,12 +1,12 @@
1
- import { labelCollator } from '@adecore/ui/format';
2
- import type { SnippetTransformJob } from './snippet-transform-protocol.ts';
3
1
  import type { EditorContentChange, EditorPosition, EditorRange } from '@adecore/editor';
4
2
  import { applyCompletionDefaults, type CompletionItem, type CompletionResult, type MarkupContent } from '@adecore/lsp';
3
+ import { labelCollator } from '@adecore/ui/format';
5
4
  import { comparePositions, sameRange } from './diagnostics-model.ts';
6
5
  import { escapeMarkdown, isEmptyHover, splitSignatures, type HoverText } from './hover-content.ts';
7
6
  import type { CompletionDocs } from './popups.ts';
8
- import { compileSnippet, parseSnippet, tabOrder, type SnippetField, type SnippetStop, type SnippetTemplate, type SnippetVariableResolver } from './snippet.ts';
9
7
  import { indentSnippet } from './snippet-indent.ts';
8
+ import type { SnippetTransformJob } from './snippet-transform-protocol.ts';
9
+ import { compileSnippet, parseSnippet, tabOrder, type SnippetField, type SnippetStop, type SnippetTemplate, type SnippetVariableResolver } from './snippet.ts';
10
10
 
11
11
  const IDENTIFIER_CHARACTER = /[\p{L}\p{N}\p{M}_$]/u;
12
12
 
package/src/completion.ts CHANGED
@@ -1,12 +1,6 @@
1
- import { SnippetTransformQueueError } from './snippet-transform-queue.ts';
2
- import { KEY_PRIORITY } from './key-priority.ts';
3
- import { SnippetTransformError } from './snippet-transform-client.ts';
4
- import { MAX_TRANSFORM_JOBS, MAX_TRANSFORM_WORK } from './snippet-transform-protocol.ts';
5
- import { jobTable } from './snippet-field-transforms.ts';
6
- import { fileUriToPath, StaleResultError, type CompletionContext, type CompletionItem } from '@adecore/lsp';
7
1
  import type { EditorContentChange, EditorPosition, EditorRange, EditorTextChange } from '@adecore/editor';
8
- import { comparePositions, sameRange, shiftPosition } from './diagnostics-model.ts';
9
- import type { EditorLanguage } from './editor-language.ts';
2
+ import { fileUriToPath, StaleResultError, type CompletionContext, type CompletionItem } from '@adecore/lsp';
3
+ import { PARAMETER_HINTS_COMMAND, isCallItem, planCall, withParentheses, type CallPlan } from './completion-call.ts';
10
4
  import {
11
5
  completionDocsOf,
12
6
  editRangeOf,
@@ -23,18 +17,24 @@ import {
23
17
  type Insertion,
24
18
  type Ranked
25
19
  } from './completion-model.ts';
26
- import { PARAMETER_HINTS_COMMAND, isCallItem, planCall, withParentheses, type CallPlan } from './completion-call.ts';
27
- import { compileSnippet } from './snippet.ts';
28
- import { createSnippetResolver } from './snippet-variables.ts';
29
- import { wordRangeAt } from './rename-model.ts';
30
- import { RecentChoices, recentChoicesOf } from './recent-choices.ts';
20
+ import { comparePositions, sameRange, shiftPosition } from './diagnostics-model.ts';
21
+ import type { EditorLanguage } from './editor-language.ts';
22
+ import { messageOf } from './error-message.ts';
23
+ import { KEY_PRIORITY } from './key-priority.ts';
31
24
  import { shikiLanguageOf } from './language-ids.ts';
32
25
  import { lineTextOf, textBeforeOf } from './line-text.ts';
26
+ import type { CompletionRow, CompletionView } from './popups.ts';
33
27
  import { isEmptyRange } from './proposal-model.ts';
28
+ import { RecentChoices, recentChoicesOf } from './recent-choices.ts';
29
+ import { wordRangeAt } from './rename-model.ts';
34
30
  import { isShortcut } from './shortcut-keys.ts';
35
- import type { CompletionRow, CompletionView } from './popups.ts';
31
+ import { jobTable } from './snippet-field-transforms.ts';
32
+ import { SnippetTransformError } from './snippet-transform-client.ts';
33
+ import { MAX_TRANSFORM_JOBS, MAX_TRANSFORM_WORK } from './snippet-transform-protocol.ts';
34
+ import { SnippetTransformQueueError } from './snippet-transform-queue.ts';
35
+ import { createSnippetResolver } from './snippet-variables.ts';
36
+ import { compileSnippet } from './snippet.ts';
36
37
  import { realTimers, type Timers } from './timers.ts';
37
- import { messageOf } from './error-message.ts';
38
38
 
39
39
  const METHOD = 'textDocument/completion';
40
40
  const START_DELAY_MS = 80;
@@ -1,8 +1,5 @@
1
- import type { Diagnostic } from '@adecore/lsp';
2
- import { KEY_PRIORITY } from './key-priority.ts';
3
1
  import type { EditorContentChange, EditorPosition, EditorReveal } from '@adecore/editor';
4
- import type { EditorLanguage } from './editor-language.ts';
5
- import { isShortcut } from './shortcut-keys.ts';
2
+ import type { Diagnostic } from '@adecore/lsp';
6
3
  import {
7
4
  comparePositions,
8
5
  markerOf,
@@ -14,6 +11,9 @@ import {
14
11
  shiftRange,
15
12
  type Problem
16
13
  } from './diagnostics-model.ts';
14
+ import type { EditorLanguage } from './editor-language.ts';
15
+ import { KEY_PRIORITY } from './key-priority.ts';
16
+ import { isShortcut } from './shortcut-keys.ts';
17
17
 
18
18
  export interface ProblemCounts {
19
19
  readonly error: number;
@@ -1,10 +1,10 @@
1
+ import type { Editor, EditorEngine } from '@adecore/editor';
2
+ import type { DiffDisplay } from '@adecore/merge';
3
+ import { Button, Tooltip } from '@adecore/ui';
4
+ import { formatNumber } from '@adecore/ui/format';
1
5
  import { useSyncExternalStore } from 'react';
2
6
  import { createPortal } from 'react-dom';
3
7
  import { useTranslation } from 'react-i18next';
4
- import { Button, Tooltip } from '@adecore/ui';
5
- import { formatNumber } from '@adecore/ui/format';
6
- import type { Editor, EditorEngine } from '@adecore/editor';
7
- import type { DiffDisplay } from '@adecore/merge';
8
8
  import { RowHost, LineActionHost } from './row-host.ts';
9
9
 
10
10
  export interface MountedDiff {
@@ -1,10 +1,6 @@
1
- import { KEYMAP, type Keymap } from '@adecore/editor/keymap';
2
1
  import type { Editor, EditorKeyHandler, EditorPosition } from '@adecore/editor';
2
+ import { KEYMAP, type Keymap } from '@adecore/editor/keymap';
3
3
  import type { LanguageService, Location, TextDocumentSaveReason } from '@adecore/lsp';
4
- import { DocumentColorsFeature } from './document-colors.ts';
5
- import { DocumentLinksFeature } from './document-links.ts';
6
- import { InlineCompletionFeature } from './inline-completion.ts';
7
- import { LinkedEditingFeature } from './linked-editing.ts';
8
4
  import { CallHierarchyFeature } from './call-hierarchy.ts';
9
5
  import { CodeActionsFeature } from './code-actions.ts';
10
6
  import { CodeVisionFeature } from './code-vision.ts';
@@ -12,33 +8,37 @@ import { CompletionFeature } from './completion.ts';
12
8
  import { ContextMenuFeature } from './context-menu.ts';
13
9
  import { DefinitionLinkFeature } from './definition-link.ts';
14
10
  import { DiagnosticsFeature } from './diagnostics.ts';
11
+ import { DocumentColorsFeature } from './document-colors.ts';
12
+ import { DocumentLinksFeature } from './document-links.ts';
15
13
  import { FoldingFeature } from './folding.ts';
16
14
  import { FormatOnTypeFeature } from './format-on-type.ts';
17
15
  import { HighlightsFeature } from './highlights.ts';
18
16
  import { HistoryFeature } from './history.ts';
19
17
  import { HoverFeature } from './hover.ts';
18
+ import { InlayHintsFeature } from './inlay-hints.ts';
19
+ import { InlineCompletionFeature } from './inline-completion.ts';
20
20
  import { KeyDispatcher } from './key-priority.ts';
21
+ import { LinkedEditingFeature } from './linked-editing.ts';
22
+ import { TemplatesFeature } from './live-templates.ts';
21
23
  import { MarkupFeature } from './markup.ts';
24
+ import type { Place } from './navigation-history.ts';
22
25
  import { NavigationFeature, locationRow } from './navigation.ts';
23
26
  import { PasteHistoryFeature } from './paste-history.ts';
24
27
  import { PeekFeature } from './peek.ts';
25
28
  import { PickFeature } from './pick.ts';
26
- import { SymbolPickerFeature } from './symbol-picker.ts';
29
+ import { createPopupStore } from './popups.ts';
30
+ import type { LanguageDocumentHandle, ProjectLanguage } from './project-language.ts';
27
31
  import { RenameFeature } from './rename.ts';
28
32
  import { RenderedDocsFeature } from './rendered-docs.ts';
29
- import { shortcutsOf } from './shortcut-keys.ts';
30
- import { createPopupStore } from './popups.ts';
31
- import { realTimers, type Timers } from './timers.ts';
32
- import { InlayHintsFeature } from './inlay-hints.ts';
33
33
  import { SelectionRangesFeature } from './selection-ranges.ts';
34
34
  import { SemanticTokensFeature, type SemanticTokensOptions } from './semantic-tokens.ts';
35
+ import { shortcutsOf } from './shortcut-keys.ts';
35
36
  import { SignatureFeature } from './signature.ts';
36
37
  import { SnippetFeature } from './snippet-session.ts';
37
38
  import { SurroundFeature } from './surround.ts';
39
+ import { SymbolPickerFeature } from './symbol-picker.ts';
38
40
  import { SymbolsFeature } from './symbols.ts';
39
- import { TemplatesFeature } from './live-templates.ts';
40
- import type { Place } from './navigation-history.ts';
41
- import type { LanguageDocumentHandle, ProjectLanguage } from './project-language.ts';
41
+ import { realTimers, type Timers } from './timers.ts';
42
42
 
43
43
  /* How long the edits servers want before a save are waited for. */
44
44
  const SAVE_PARTICIPANT_MS = 1_000;
@@ -10,7 +10,6 @@
10
10
  margin: 0;
11
11
  }
12
12
  .adecore-editor-markdown pre {
13
- overflow: auto;
14
13
  font-family: var(--font-mono);
15
14
  }
16
15
  .adecore-editor-markdown a {
@@ -109,12 +108,13 @@
109
108
  .adecore-editor-diff-side + .adecore-editor-diff-side {
110
109
  border-inline-start: 1px solid var(--border);
111
110
  }
111
+ /* No `scrollbar-gutter` on the sides: their bars float over the code and take no width, so the two
112
+ sides line up whether one of them scrolls or both do. Its own stacking layer keeps the editor's
113
+ layers under the bars beside it. */
112
114
  .adecore-editor-diff-surface {
113
115
  position: absolute;
114
116
  inset: 0;
115
- }
116
- .adecore-editor-diff-split .se-viewport {
117
- scrollbar-gutter: stable;
117
+ isolation: isolate;
118
118
  }
119
119
  .adecore-editor-diff-filler {
120
120
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--editor-hatch) 6px 7px);
@@ -1,5 +1,5 @@
1
- import type { TextEdit } from '@adecore/lsp';
2
1
  import type { EditorTextChange } from '@adecore/editor';
2
+ import type { TextEdit } from '@adecore/lsp';
3
3
  import { comparePositions } from './diagnostics-model.ts';
4
4
  import type { EditorLanguage } from './editor-language.ts';
5
5