dsh-remote-vs 0.26.0 → 0.27.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.
- package/README.en.md +4 -11
- package/README.md +4 -8
- package/THIRD-PARTY-NOTICES.md +7 -2
- package/lib/client.js +6622 -5821
- package/lib/index.js +275 -1
- package/lib/types/client/CodeEditor.d.ts +14 -0
- package/lib/types/client/OutlinePanel.d.ts +22 -0
- package/lib/types/client/ProcessesSection.d.ts +19 -0
- package/lib/types/client/api.d.ts +5 -1
- package/lib/types/client/blame-model.d.ts +77 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/outline-model.d.ts +59 -0
- package/lib/types/client/scm/actions.d.ts +12 -1
- package/lib/types/client/store.d.ts +18 -0
- package/lib/types/client/vsc/blame.d.ts +19 -0
- package/lib/types/client/vsc/kit.d.ts +0 -2
- package/lib/types/client/vsc/preview-document.d.ts +46 -0
- package/lib/types/client/vsc/preview-model.d.ts +31 -0
- package/lib/types/client/vsc/preview-services.d.ts +24 -0
- package/lib/types/git-ops.d.ts +18 -0
- package/lib/types/processes.d.ts +43 -0
- package/lib/types/protocol.d.ts +34 -0
- package/package.json +2 -1
- package/src/client/CodeEditor.tsx +43 -1
- package/src/client/EditorPane.tsx +520 -37
- package/src/client/MonitorView.tsx +16 -5
- package/src/client/OutlinePanel.tsx +287 -0
- package/src/client/ProcessesSection.tsx +292 -0
- package/src/client/api.ts +8 -0
- package/src/client/blame-model.ts +242 -0
- package/src/client/i18n.ts +194 -0
- package/src/client/index.tsx +4 -0
- package/src/client/outline-model.ts +775 -0
- package/src/client/scm/HistoryPanel.tsx +38 -1
- package/src/client/scm/actions.ts +55 -2
- package/src/client/store.tsx +54 -5
- package/src/client/vsc/blame.ts +147 -0
- package/src/client/vsc/kit.tsx +3 -11
- package/src/client/vsc/preview-document.tsx +323 -0
- package/src/client/vsc/preview-model.ts +216 -0
- package/src/client/vsc/preview-services.ts +118 -0
- package/src/client/vsc/vsc.css +6509 -5716
- package/src/git-ops.ts +34 -0
- package/src/processes.ts +177 -0
- package/src/protocol.ts +37 -0
- package/src/routes.ts +118 -0
|
@@ -28,14 +28,21 @@ import { isConnectionFailure, useConnectionStatus } from './connection.ts'
|
|
|
28
28
|
import { sameLocalDir } from './composer.ts'
|
|
29
29
|
import { editorViewStateOf, pruneEditorViewStates, registerLiveEditor, rememberEditorViewState } from './live-editor.ts'
|
|
30
30
|
import { useRemoteChatTarget } from './use-remote-chat-target.ts'
|
|
31
|
-
import { useExplorer, gotoChange, markChangeStale, undoChange, type EditorTab } from './store.tsx'
|
|
31
|
+
import { useExplorer, gotoChange, markChangeStale, repoRelative, undoChange, type EditorTab } from './store.tsx'
|
|
32
32
|
import { DiffView } from './scm/DiffView.tsx'
|
|
33
|
+
import { loadBlame, loadFileHistory } from './scm/actions.ts'
|
|
34
|
+
import { isCommittedBlame, planBlameWindow, type BlameLine, type FileHistoryCommit } from './blame-model.ts'
|
|
33
35
|
import { Btn } from './ui.tsx'
|
|
34
|
-
import {
|
|
36
|
+
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
35
37
|
import { langLabel, langFromPath } from './vsc/tokenize.ts'
|
|
36
|
-
import { installSaveShortcut } from './vsc/save-shortcut.ts'
|
|
38
|
+
import { FOREIGN_TARGET, installSaveShortcut, isModalLayerOpen } from './vsc/save-shortcut.ts'
|
|
39
|
+
import { OutlinePanel } from './OutlinePanel.tsx'
|
|
40
|
+
import type { OutlineEntry } from './outline-model.ts'
|
|
37
41
|
import { Breadcrumb } from './vsc/breadcrumb.tsx'
|
|
38
42
|
import { ImagePreview } from './vsc/image-preview.tsx'
|
|
43
|
+
import { hasTextSource, isBytePreview, previewKindLabel, previewKindOf, type PreviewKind } from './vsc/preview-model.ts'
|
|
44
|
+
import { BytePreview, SvgPreview, TablePreview } from './vsc/preview-document.tsx'
|
|
45
|
+
import { isDarkScheme, subscribeColorScheme } from './theme.ts'
|
|
39
46
|
import {
|
|
40
47
|
editorSettingsSnapshot,
|
|
41
48
|
stepFontSize,
|
|
@@ -66,6 +73,48 @@ import {
|
|
|
66
73
|
/** How many hunks of a conflict diff are rendered before the rest is summarised. */
|
|
67
74
|
const CONFLICT_DIFF_HUNKS = 20
|
|
68
75
|
|
|
76
|
+
/**
|
|
77
|
+
* 「大纲」是否可用:一个真正的文本文件 tab,读完且没读错,不是二进制/图片。
|
|
78
|
+
*
|
|
79
|
+
* 预览模式(markdown/HTML)也排除:那时 CodeMirror 被 CSS 隐藏,跳过去虽然改了
|
|
80
|
+
* 选区,屏幕上却什么也看不到 —— 一个看起来没反应的按钮比没有按钮更糟。
|
|
81
|
+
*/
|
|
82
|
+
function outlineAvailable(tab: EditorTab | undefined): tab is EditorTab {
|
|
83
|
+
if (tab === undefined || tab.kind !== 'file') return false
|
|
84
|
+
if (tab.image || tab.binary || tab.loading || tab.error !== undefined) return false
|
|
85
|
+
return !(tab.preview && hasTextSource(previewKindOf(tab.fullPath)))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const BLAME_PREF_KEY = 'dsh-remote-vs.editor.blame'
|
|
89
|
+
const EMPTY_BLAME: ReadonlyMap<number, BlameLine> = new Map()
|
|
90
|
+
|
|
91
|
+
/** Inline blame is on by default, but the choice survives a reload. */
|
|
92
|
+
function readBlamePreference(): boolean {
|
|
93
|
+
try {
|
|
94
|
+
return localStorage.getItem(BLAME_PREF_KEY) !== '0'
|
|
95
|
+
} catch {
|
|
96
|
+
return true
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function writeBlamePreference(value: boolean): void {
|
|
101
|
+
try {
|
|
102
|
+
localStorage.setItem(BLAME_PREF_KEY, value ? '1' : '0')
|
|
103
|
+
} catch {
|
|
104
|
+
// Private mode: the preference simply does not persist.
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Number of lines a loaded buffer has (the last empty line still counts). */
|
|
109
|
+
function lineCountOf(text: string): number {
|
|
110
|
+
if (text === '') return 1
|
|
111
|
+
let count = 1
|
|
112
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
113
|
+
if (text.charCodeAt(index) === 10) count += 1
|
|
114
|
+
}
|
|
115
|
+
return count
|
|
116
|
+
}
|
|
117
|
+
|
|
69
118
|
/**
|
|
70
119
|
* Reject a remote call that never answers.
|
|
71
120
|
*
|
|
@@ -318,6 +367,10 @@ function StatusBar(props: {
|
|
|
318
367
|
export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
319
368
|
const store = useExplorer()
|
|
320
369
|
const { t, tabs, activeTab, alias } = store
|
|
370
|
+
// Commands run in `repoRoot`, not in the workspace root: a repository that
|
|
371
|
+
// lives in a subdirectory (`repoSubdir`) would otherwise get a workspace-
|
|
372
|
+
// relative path and fail with `no such path`.
|
|
373
|
+
const repoRel = activeTab === undefined ? '' : repoRelative(store.repoRoot, activeTab.fullPath)
|
|
321
374
|
const settings = useEditorSettings()
|
|
322
375
|
/**
|
|
323
376
|
* Which chrome this mount renders. Derived from the store's EFFECTIVE surface
|
|
@@ -384,6 +437,160 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
384
437
|
useEffect(() => {
|
|
385
438
|
setCaret(undefined)
|
|
386
439
|
}, [activeTab?.id])
|
|
440
|
+
|
|
441
|
+
// --- inline blame + per-file history -------------------------------------
|
|
442
|
+
const [blameOn, setBlameOn] = useState<boolean>(readBlamePreference)
|
|
443
|
+
const [blameRows, setBlameRows] = useState<ReadonlyMap<number, BlameLine>>(EMPTY_BLAME)
|
|
444
|
+
const [blameViewport, setBlameViewport] = useState<{ from: number; to: number } | undefined>(undefined)
|
|
445
|
+
const [blameError, setBlameError] = useState<string | undefined>(undefined)
|
|
446
|
+
const blameTicket = useRef(0)
|
|
447
|
+
const blameRequested = useRef(new Set<string>())
|
|
448
|
+
const blameFailed = useRef('')
|
|
449
|
+
const blameViewportTimer = useRef<number | undefined>(undefined)
|
|
450
|
+
const [fileHistoryOpen, setFileHistoryOpen] = useState(false)
|
|
451
|
+
const [fileHistoryRows, setFileHistoryRows] = useState<FileHistoryCommit[]>([])
|
|
452
|
+
const [fileHistoryLoading, setFileHistoryLoading] = useState(false)
|
|
453
|
+
const [fileHistoryError, setFileHistoryError] = useState<string | undefined>(undefined)
|
|
454
|
+
|
|
455
|
+
// A new buffer (or an edited one) invalidates both windows and their line
|
|
456
|
+
// numbers; the next viewport report starts a fresh read.
|
|
457
|
+
useEffect(() => {
|
|
458
|
+
blameTicket.current += 1
|
|
459
|
+
blameRequested.current.clear()
|
|
460
|
+
blameFailed.current = ''
|
|
461
|
+
setBlameViewport(undefined)
|
|
462
|
+
setBlameRows(EMPTY_BLAME)
|
|
463
|
+
setBlameError(undefined)
|
|
464
|
+
setFileHistoryOpen(false)
|
|
465
|
+
setFileHistoryRows([])
|
|
466
|
+
setFileHistoryError(undefined)
|
|
467
|
+
}, [activeTab?.id, activeTab?.dirty, activeTab?.reloadNonce])
|
|
468
|
+
|
|
469
|
+
const toggleBlame = useCallback(() => {
|
|
470
|
+
setBlameOn(current => {
|
|
471
|
+
const next = !current
|
|
472
|
+
writeBlamePreference(next)
|
|
473
|
+
return next
|
|
474
|
+
})
|
|
475
|
+
}, [])
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* One `-L` read per uncovered viewport window.
|
|
479
|
+
*
|
|
480
|
+
* `blameRequested` is the cheap "this exact window was already asked for"
|
|
481
|
+
* guard; it is cleared on a buffer/dirty change, and a failed read deletes its
|
|
482
|
+
* key so a later scroll can retry it. Only one request may be in flight —
|
|
483
|
+
* CodeMirror scroll events are frequent and the exec channel is shared.
|
|
484
|
+
*/
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
const tab = activeTab
|
|
487
|
+
if (
|
|
488
|
+
!blameOn || tab === undefined || tab.kind !== 'file' || tab.loading || tab.dirty || tab.binary || tab.truncated || tab.preview
|
|
489
|
+
|| isBytePreview(previewKindOf(tab.fullPath))
|
|
490
|
+
|| alias === '' || store.repoRoot === undefined || repoRel === '' || blameViewport === undefined
|
|
491
|
+
) {
|
|
492
|
+
setBlameRows(EMPTY_BLAME)
|
|
493
|
+
return
|
|
494
|
+
}
|
|
495
|
+
const total = lineCountOf(tab.text)
|
|
496
|
+
const failureKey = `${tab.id}:${tab.reloadNonce ?? 0}:${repoRel}:${blameOn ? '1' : '0'}`
|
|
497
|
+
if (blameFailed.current === failureKey) return
|
|
498
|
+
const window = planBlameWindow(
|
|
499
|
+
blameViewport.from,
|
|
500
|
+
blameViewport.to,
|
|
501
|
+
total,
|
|
502
|
+
new Set(blameRows.keys()),
|
|
503
|
+
)
|
|
504
|
+
if (window === undefined) return
|
|
505
|
+
const { from, to } = window
|
|
506
|
+
const key = `${tab.id}:${tab.reloadNonce ?? 0}:${from}:${to}`
|
|
507
|
+
if (blameRequested.current.has(key)) return
|
|
508
|
+
blameRequested.current.add(key)
|
|
509
|
+
const ticket = ++blameTicket.current
|
|
510
|
+
const controller = new AbortController()
|
|
511
|
+
void loadBlame(alias, store.repoRoot, repoRel, from, to, { signal: controller.signal })
|
|
512
|
+
.then((rows) => {
|
|
513
|
+
if (ticket !== blameTicket.current) return
|
|
514
|
+
setBlameRows((previous) => {
|
|
515
|
+
const next = new Map(previous)
|
|
516
|
+
for (const row of rows) next.set(row.line, row)
|
|
517
|
+
return next
|
|
518
|
+
})
|
|
519
|
+
setBlameError(undefined)
|
|
520
|
+
})
|
|
521
|
+
.catch((error: unknown) => {
|
|
522
|
+
blameRequested.current.delete(key)
|
|
523
|
+
if (controller.signal.aborted) return
|
|
524
|
+
if (ticket !== blameTicket.current) return
|
|
525
|
+
blameFailed.current = failureKey
|
|
526
|
+
setBlameError(error instanceof Error ? error.message : String(error))
|
|
527
|
+
})
|
|
528
|
+
return () => { controller.abort() }
|
|
529
|
+
}, [
|
|
530
|
+
activeTab?.id,
|
|
531
|
+
activeTab?.dirty,
|
|
532
|
+
activeTab?.reloadNonce,
|
|
533
|
+
blameOn,
|
|
534
|
+
blameRows,
|
|
535
|
+
blameViewport?.from,
|
|
536
|
+
blameViewport?.to,
|
|
537
|
+
alias,
|
|
538
|
+
repoRel,
|
|
539
|
+
store.repoRoot,
|
|
540
|
+
])
|
|
541
|
+
|
|
542
|
+
const onEditorViewport = useCallback((first: number, last: number) => {
|
|
543
|
+
if (blameViewportTimer.current !== undefined) window.clearTimeout(blameViewportTimer.current)
|
|
544
|
+
blameViewportTimer.current = window.setTimeout(() => {
|
|
545
|
+
blameViewportTimer.current = undefined
|
|
546
|
+
setBlameViewport(previous => (
|
|
547
|
+
previous !== undefined && previous.from === first && previous.to === last
|
|
548
|
+
? previous
|
|
549
|
+
: { from: first, to: last }
|
|
550
|
+
))
|
|
551
|
+
}, 140)
|
|
552
|
+
}, [])
|
|
553
|
+
useEffect(() => () => {
|
|
554
|
+
if (blameViewportTimer.current !== undefined) window.clearTimeout(blameViewportTimer.current)
|
|
555
|
+
}, [])
|
|
556
|
+
|
|
557
|
+
useEffect(() => {
|
|
558
|
+
const tab = activeTab
|
|
559
|
+
if (!fileHistoryOpen || tab === undefined || tab.kind !== 'file' || alias === '' || store.repoRoot === undefined || repoRel === '') {
|
|
560
|
+
setFileHistoryRows([])
|
|
561
|
+
setFileHistoryError(undefined)
|
|
562
|
+
setFileHistoryLoading(false)
|
|
563
|
+
return
|
|
564
|
+
}
|
|
565
|
+
let cancelled = false
|
|
566
|
+
setFileHistoryLoading(true)
|
|
567
|
+
setFileHistoryError(undefined)
|
|
568
|
+
void loadFileHistory(alias, store.repoRoot, repoRel, 100)
|
|
569
|
+
.then((rows) => {
|
|
570
|
+
if (cancelled) return
|
|
571
|
+
setFileHistoryRows(rows)
|
|
572
|
+
setFileHistoryLoading(false)
|
|
573
|
+
})
|
|
574
|
+
.catch((error: unknown) => {
|
|
575
|
+
if (cancelled) return
|
|
576
|
+
setFileHistoryError(error instanceof Error ? error.message : String(error))
|
|
577
|
+
setFileHistoryLoading(false)
|
|
578
|
+
})
|
|
579
|
+
return () => { cancelled = true }
|
|
580
|
+
}, [fileHistoryOpen, activeTab?.id, activeTab?.dirty, alias, repoRel, store.repoRoot])
|
|
581
|
+
|
|
582
|
+
useEffect(() => {
|
|
583
|
+
if (!fileHistoryOpen) return
|
|
584
|
+
const onKeyDown = (event: KeyboardEvent): void => {
|
|
585
|
+
if (event.key !== 'Escape') return
|
|
586
|
+
event.preventDefault()
|
|
587
|
+
event.stopPropagation()
|
|
588
|
+
setFileHistoryOpen(false)
|
|
589
|
+
}
|
|
590
|
+
window.addEventListener('keydown', onKeyDown, true)
|
|
591
|
+
return () => window.removeEventListener('keydown', onKeyDown, true)
|
|
592
|
+
}, [fileHistoryOpen])
|
|
593
|
+
|
|
387
594
|
/**
|
|
388
595
|
* The "see the difference" payload of a refused save.
|
|
389
596
|
*
|
|
@@ -491,26 +698,64 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
491
698
|
const previewIsHtml = activeTab?.html === true
|
|
492
699
|
const previewIsMarkdown = activeTab?.markdown === true
|
|
493
700
|
const previewVisible = activeTab?.preview === true
|
|
701
|
+
const previewKind: PreviewKind = activeTab?.kind === 'file' ? previewKindOf(activeTab.fullPath) : 'text'
|
|
702
|
+
const bytePreview = isBytePreview(previewKind)
|
|
703
|
+
|
|
704
|
+
const darkScheme = useSyncExternalStore(subscribeColorScheme, isDarkScheme)
|
|
705
|
+
|
|
706
|
+
const htmlDoc = useMemo(() => {
|
|
707
|
+
if (!previewIsHtml) return ''
|
|
708
|
+
const dark = darkScheme
|
|
709
|
+
const csp = [
|
|
710
|
+
"default-src 'none'",
|
|
711
|
+
"style-src 'unsafe-inline'",
|
|
712
|
+
'img-src data: blob:',
|
|
713
|
+
'font-src data:',
|
|
714
|
+
'media-src data: blob:',
|
|
715
|
+
"form-action 'none'",
|
|
716
|
+
"base-uri 'none'",
|
|
717
|
+
].join('; ')
|
|
718
|
+
return [
|
|
719
|
+
'<!doctype html><meta charset="utf-8">',
|
|
720
|
+
`<meta http-equiv="Content-Security-Policy" content="${csp}">`,
|
|
721
|
+
'<style>',
|
|
722
|
+
`:root{color-scheme:${dark ? 'dark' : 'light'}}`,
|
|
723
|
+
`html,body{background:${dark ? '#1e1e1e' : '#ffffff'};color:${dark ? '#d4d4d4' : '#1f1f1f'}}`,
|
|
724
|
+
'body{margin:14px;font:14px/1.65 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;overflow-wrap:break-word}',
|
|
725
|
+
'img,video,canvas{max-width:100%;height:auto}',
|
|
726
|
+
'table{border-collapse:collapse}',
|
|
727
|
+
`td,th{border:1px solid ${dark ? 'rgba(255,255,255,.14)' : 'rgba(0,0,0,.12)'};padding:4px 8px}`,
|
|
728
|
+
'pre{overflow:auto}',
|
|
729
|
+
'</style>',
|
|
730
|
+
previewText ?? '',
|
|
731
|
+
].join('')
|
|
732
|
+
}, [previewIsHtml, previewText, darkScheme])
|
|
494
733
|
|
|
495
|
-
|
|
734
|
+
/** Stable labels identity: the platform renderer keys its cache on it. */
|
|
735
|
+
const markdownLabels = useMemo(() => ({
|
|
736
|
+
code: {
|
|
737
|
+
copyLabel: t('preview.copyCode'),
|
|
738
|
+
copiedLabel: t('preview.copied'),
|
|
739
|
+
},
|
|
740
|
+
footnotes: t('preview.footnotes'),
|
|
741
|
+
}), [t])
|
|
496
742
|
|
|
497
743
|
/**
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* re-parsed the whole document into a fresh element tree on EVERY store
|
|
502
|
-
* publish: this component subscribes to the store, so opening another file,
|
|
503
|
-
* saving, a git refresh or switching a panel all paid for a parse of text
|
|
504
|
-
* that had not changed. `renderMarkdown` is a pure function of the text, so
|
|
505
|
-
* the memo key is the TEXT (a stable identity while the bytes are) plus the
|
|
506
|
-
* two mode flags — see `previewText` above for why the tab object is the wrong
|
|
507
|
-
* key. The guards keep the parse from happening at all for a file that is
|
|
508
|
-
* being read in source mode.
|
|
744
|
+
* Markdown preview through the host's platform renderer (the same one the
|
|
745
|
+
* chat uses): GFM tables, code highlighting and footnotes come for free and
|
|
746
|
+
* raw HTML in a remote document is not inserted into the app DOM.
|
|
509
747
|
*/
|
|
510
748
|
const markdownPreview = useMemo(() => {
|
|
511
749
|
if (!previewIsMarkdown || !previewVisible || previewText === undefined) return null
|
|
512
|
-
return
|
|
513
|
-
|
|
750
|
+
return (
|
|
751
|
+
<div className="rvs-preview-scroll">
|
|
752
|
+
{activeTab?.truncated === true && <div className="rvs-preview-banner">{t('preview.truncated')}</div>}
|
|
753
|
+
<div className="rvs-preview-markdown rvs-markdown" data-preview-path={activeTab?.fullPath ?? ''}>
|
|
754
|
+
<MarkdownText text={previewText} labels={markdownLabels} variant="body" />
|
|
755
|
+
</div>
|
|
756
|
+
</div>
|
|
757
|
+
)
|
|
758
|
+
}, [previewIsMarkdown, previewVisible, previewText, markdownLabels, activeTab?.fullPath, activeTab?.truncated, t])
|
|
514
759
|
|
|
515
760
|
/**
|
|
516
761
|
* The status bar's indent hint, derived from the loaded text.
|
|
@@ -771,11 +1016,114 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
771
1016
|
const tab = saveShortcutTabRef.current
|
|
772
1017
|
// Working-tree diffs are `DiffView`'s own onSave contract; previews have no
|
|
773
1018
|
// buffer at all. `saveActive` would misreport both.
|
|
774
|
-
if (tab === undefined || tab.kind !== 'file' || tab.image || tab.binary) return undefined
|
|
1019
|
+
if (tab === undefined || tab.kind !== 'file' || tab.image || tab.binary || isBytePreview(previewKindOf(tab.fullPath))) return undefined
|
|
775
1020
|
return () => { void saveActiveRef.current() }
|
|
776
1021
|
})
|
|
777
1022
|
}, [props.visible])
|
|
778
1023
|
|
|
1024
|
+
// --- 符号大纲(Ctrl+Shift+O)---------------------------------------------
|
|
1025
|
+
/**
|
|
1026
|
+
* 打开中的大纲。
|
|
1027
|
+
*
|
|
1028
|
+
* 存的是「打开那一刻的实时缓冲区全文」,而不是 `tabId` + 每次渲染再去读 ——
|
|
1029
|
+
* 面板打开期间焦点在筛选框里,缓冲区不可能再变,所以一份快照足够;把全文放进
|
|
1030
|
+
* state 也让 `OutlinePanel` 的 `useMemo` 有稳定输入(不会每帧重扫文件)。
|
|
1031
|
+
*
|
|
1032
|
+
* `tabId` 留在里面是为了自检:换 tab 时旧大纲不能继续挂在屏幕上的新文件上。
|
|
1033
|
+
*/
|
|
1034
|
+
const [outline, setOutline] = useState<{ tabId: string; path: string; text: string } | undefined>(undefined)
|
|
1035
|
+
|
|
1036
|
+
// 换 tab / 重载后旧大纲的行号已经不属于屏幕上的文件了:直接关掉,绝不猜。
|
|
1037
|
+
useEffect(() => {
|
|
1038
|
+
setOutline(undefined)
|
|
1039
|
+
}, [activeTab?.id, activeTab?.reloadNonce])
|
|
1040
|
+
// Hiding this surface (panel switch, rail tab, float window) must take the
|
|
1041
|
+
// portal down with it: the mask is `position: fixed` and would otherwise stay
|
|
1042
|
+
// painted over whatever surface replaced this one.
|
|
1043
|
+
useEffect(() => {
|
|
1044
|
+
if (!props.visible) setOutline(undefined)
|
|
1045
|
+
}, [props.visible])
|
|
1046
|
+
|
|
1047
|
+
const openOutline = useCallback(() => {
|
|
1048
|
+
const tab = saveShortcutTabRef.current
|
|
1049
|
+
if (!outlineAvailable(tab)) return
|
|
1050
|
+
// 实时 buffer 优先:`tab.text` 是加载时的字节,输入从来没有回写进去
|
|
1051
|
+
// (见下方 editor host 的注释)。dirty 文件只有这里能拿到正确内容。
|
|
1052
|
+
setOutline({ tabId: tab.id, path: tab.fullPath, text: editorRef.current?.getContent() ?? tab.text })
|
|
1053
|
+
}, [])
|
|
1054
|
+
const closeOutline = useCallback(() => { setOutline(undefined) }, [])
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* 跳转:复用现有的「选中行区间 + 滚到中央 + 点灯」,1-based 行号。
|
|
1058
|
+
*
|
|
1059
|
+
* 跳转放到下一个 task:浮层卸载时会把焦点还给打开它的按钮(portal 的常规
|
|
1060
|
+
* 做法,见 QuickOpen),先 `revealRange` 再卸载的话,焦点会被那一步抢回去,
|
|
1061
|
+
* 用户接着敲的字就落空了。等卸载稳定后再把焦点交给编辑器。
|
|
1062
|
+
*/
|
|
1063
|
+
const jumpToOutline = useCallback((entry: OutlineEntry) => {
|
|
1064
|
+
setOutline(undefined)
|
|
1065
|
+
window.setTimeout(() => { editorRef.current?.revealRange(entry.line, entry.line) }, 0)
|
|
1066
|
+
}, [])
|
|
1067
|
+
|
|
1068
|
+
// window 监听用 ref 取最新值:effect 只为可见性重装,不随每次渲染重装。
|
|
1069
|
+
const openOutlineRef = useRef(openOutline)
|
|
1070
|
+
openOutlineRef.current = openOutline
|
|
1071
|
+
const closeOutlineRef = useRef(closeOutline)
|
|
1072
|
+
closeOutlineRef.current = closeOutline
|
|
1073
|
+
const outlineOpenRef = useRef(false)
|
|
1074
|
+
outlineOpenRef.current = outline !== undefined
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Ctrl/Cmd+Shift+O:转到符号。
|
|
1078
|
+
*
|
|
1079
|
+
* 用 window 冒泡监听而不是 CodeMirror keymap:和 Ctrl+S 同理 —— 点过 tab 条、
|
|
1080
|
+
* 信息栏或侧栏之后光标已经不在编辑器里,keymap 根本不会触发。只在这个座位可见
|
|
1081
|
+
* 时安装(多个 EditorPane 可能同时挂载,隐藏的那个不该抢键)。
|
|
1082
|
+
*
|
|
1083
|
+
* 不抢别人的键:
|
|
1084
|
+
* - 终端:xterm 已经把 ^O 发给远端 shell(readline 的 operate-and-get-next),
|
|
1085
|
+
* 再开浮层就是一次按键两个动作;
|
|
1086
|
+
* - 其他输入框(聊天输入、对话框输入)与任何模态层(宿主审批、右键菜单)都保留
|
|
1087
|
+
* 这个键;
|
|
1088
|
+
* - 不满足条件时**不** preventDefault:浏览器自己的 Ctrl+Shift+O 在别处仍是它
|
|
1089
|
+
* 的(我们只接管自己确实要处理的那一次按键)。
|
|
1090
|
+
*/
|
|
1091
|
+
useEffect(() => {
|
|
1092
|
+
if (!props.visible) return
|
|
1093
|
+
const onKey = (event: KeyboardEvent): void => {
|
|
1094
|
+
// Another owner (host shortcut, an outer handler) already claimed this
|
|
1095
|
+
// key: bubble phase must yield, same contract as save-shortcut.ts.
|
|
1096
|
+
if (event.defaultPrevented) return
|
|
1097
|
+
const ctrlShiftO = (event.ctrlKey || event.metaKey) && event.shiftKey && !event.altKey
|
|
1098
|
+
const altO = event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey
|
|
1099
|
+
if (!ctrlShiftO && !altO) return
|
|
1100
|
+
if (event.key.toLowerCase() !== 'o') return
|
|
1101
|
+
// 按住不放不该让浮层闪;输入法组字期间这也不是一个命令。
|
|
1102
|
+
if (event.repeat || event.isComposing === true) return
|
|
1103
|
+
// 自己开着:再按一次关闭(与 Ctrl+P 的「再按一次退出」同一习惯)。
|
|
1104
|
+
if (outlineOpenRef.current) {
|
|
1105
|
+
event.preventDefault()
|
|
1106
|
+
closeOutlineRef.current()
|
|
1107
|
+
return
|
|
1108
|
+
}
|
|
1109
|
+
if (isModalLayerOpen()) return
|
|
1110
|
+
const focused = document.activeElement
|
|
1111
|
+
if (focused instanceof HTMLElement && focused.closest('.xterm') !== null) return
|
|
1112
|
+
// CodeMirror 的 `.cm-content` 是 contenteditable,天然在 FOREIGN_TARGET 里:
|
|
1113
|
+
// 只放过**本插件编辑器**里那一份(`.rvs-editor-host` 的子树),宿主自己的
|
|
1114
|
+
// 聊天输入同样是 CodeMirror —— 在别人的编辑器里抢键和在别人的输入框里抢键
|
|
1115
|
+
// 是同一件事。
|
|
1116
|
+
if (focused instanceof HTMLElement
|
|
1117
|
+
&& focused.closest(FOREIGN_TARGET) !== null
|
|
1118
|
+
&& focused.closest('.rvs-editor-host') === null) return
|
|
1119
|
+
if (!outlineAvailable(saveShortcutTabRef.current)) return
|
|
1120
|
+
event.preventDefault()
|
|
1121
|
+
openOutlineRef.current()
|
|
1122
|
+
}
|
|
1123
|
+
window.addEventListener('keydown', onKey)
|
|
1124
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
1125
|
+
}, [props.visible])
|
|
1126
|
+
|
|
779
1127
|
if (tabs.length === 0) {
|
|
780
1128
|
if (center) {
|
|
781
1129
|
return (
|
|
@@ -816,7 +1164,9 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
816
1164
|
const displayPath = activeTab?.fullPath ?? ''
|
|
817
1165
|
const language = isDiff
|
|
818
1166
|
? 'Diff'
|
|
819
|
-
: activeTab?.image === true
|
|
1167
|
+
: activeTab?.image === true
|
|
1168
|
+
? 'Image'
|
|
1169
|
+
: previewKindLabel(previewKind) ?? langLabel(langFromPath(activeTab?.rel ?? ''))
|
|
820
1170
|
const activeImageKey = activeTab === undefined ? undefined : imageCacheKey(activeTab)
|
|
821
1171
|
const imageSrc = activeTab !== undefined && activeTab.image && activeImageKey !== undefined
|
|
822
1172
|
? images[activeImageKey]
|
|
@@ -824,9 +1174,10 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
824
1174
|
const imageFailure = activeTab !== undefined && activeTab.image && activeImageKey !== undefined
|
|
825
1175
|
? imageError[activeImageKey]
|
|
826
1176
|
: undefined
|
|
1177
|
+
const caretBlame = caret === undefined ? undefined : blameRows.get(caret.line)
|
|
827
1178
|
|
|
828
1179
|
return (
|
|
829
|
-
<div className="rvs-pane grow rvs-edge" style={fontStyle}>
|
|
1180
|
+
<div className="rvs-pane grow rvs-edge" style={{ ...(fontStyle ?? {}), position: 'relative' }}>
|
|
830
1181
|
{/* Tab strip: switch / close / dirty dot / diff glyph. Middle-click closes
|
|
831
1182
|
too — the muscle memory shared with VS Code and browsers. */}
|
|
832
1183
|
<div className="rvs-etabs" role="tablist" aria-label={t('editor.tabsLabel')}>
|
|
@@ -919,7 +1270,7 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
919
1270
|
)
|
|
920
1271
|
: <span className="rvs-einfo-path" title={displayPath}>{displayPath}</span>}
|
|
921
1272
|
<span className="rvs-einfo-actions">
|
|
922
|
-
{activeTab.kind === 'file' && (
|
|
1273
|
+
{activeTab.kind === 'file' && hasTextSource(previewKind) && (
|
|
923
1274
|
<Segmented<'preview' | 'source'>
|
|
924
1275
|
value={activeTab.preview ? 'preview' : 'source'}
|
|
925
1276
|
onChange={(next) => store.updateTab(activeTab.id, { preview: next === 'preview' })}
|
|
@@ -944,7 +1295,7 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
944
1295
|
so the stamp says WHICH code is running, and the token count
|
|
945
1296
|
says whether the grammar actually produced colored tokens. */}
|
|
946
1297
|
<span className="rvs-build" title={`dsh-remote-vs build ${__RVS_BUILD__}`}>{__RVS_BUILD__}</span>
|
|
947
|
-
{tokenCount !== undefined && (
|
|
1298
|
+
{tokenCount !== undefined && !bytePreview && (
|
|
948
1299
|
<span className="rvs-build" title={t('editor.tokenCount')}>tok {tokenCount}</span>
|
|
949
1300
|
)}
|
|
950
1301
|
{activeTab.kind === 'file' && (
|
|
@@ -953,19 +1304,34 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
953
1304
|
both the class and the label, while the project's own
|
|
954
1305
|
review checklist forbids nested ternaries. One lookup per
|
|
955
1306
|
concern instead. */}
|
|
956
|
-
|
|
957
|
-
{
|
|
958
|
-
|
|
1307
|
+
{!bytePreview && !activeTab.image && (
|
|
1308
|
+
<span className={`rvs-status ${tabStatusClass(activeTab)}`}>
|
|
1309
|
+
{t(tabStatusKey(activeTab))}
|
|
1310
|
+
</span>
|
|
1311
|
+
)}
|
|
959
1312
|
<IconButton title={t('editor.reloadFile')} onClick={() => { void reloadWithGuard(activeTab) }} disabled={offline || activeTab.loading}>
|
|
960
1313
|
<IconRefresh size={13} />
|
|
961
1314
|
</IconButton>
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1315
|
+
{!bytePreview && !activeTab.image && (
|
|
1316
|
+
<IconButton
|
|
1317
|
+
title={`${t('editor.save')} (Ctrl+S)`}
|
|
1318
|
+
onClick={() => { void saveActive() }}
|
|
1319
|
+
disabled={offline || activeTab.loading || activeTab.binary || activeTab.truncated || !activeTab.dirty}
|
|
1320
|
+
>
|
|
1321
|
+
<IconSave size={13} />
|
|
1322
|
+
</IconButton>
|
|
1323
|
+
)}
|
|
1324
|
+
{/* 大纲:只对文本文件出现。`≡` 是行内字形(与 blame 的 `B`、
|
|
1325
|
+
浮窗的图标同一套做法),不额外引一个图标组件。 */}
|
|
1326
|
+
{!activeTab.image && !activeTab.binary && !isBytePreview(previewKind) && (
|
|
1327
|
+
<IconButton
|
|
1328
|
+
title={`${t('editor.outline')} (Ctrl+Shift+O)`}
|
|
1329
|
+
onClick={openOutline}
|
|
1330
|
+
disabled={!outlineAvailable(activeTab)}
|
|
1331
|
+
>
|
|
1332
|
+
<span className="rvs-glyph-text">≡</span>
|
|
1333
|
+
</IconButton>
|
|
1334
|
+
)}
|
|
969
1335
|
</>
|
|
970
1336
|
)}
|
|
971
1337
|
{activeTab.kind === 'diff' && (
|
|
@@ -987,7 +1353,7 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
987
1353
|
)}
|
|
988
1354
|
</>
|
|
989
1355
|
)}
|
|
990
|
-
{activeTab.kind === 'file' && !activeTab.image && !activeTab.binary && (
|
|
1356
|
+
{activeTab.kind === 'file' && !activeTab.image && !activeTab.binary && !bytePreview && (
|
|
991
1357
|
<IconButton
|
|
992
1358
|
title={t('editor.wrap')}
|
|
993
1359
|
onClick={() => updateEditorSettings({ wrap: !settings.wrap })}
|
|
@@ -995,11 +1361,37 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
995
1361
|
<IconWrap size={13} />
|
|
996
1362
|
</IconButton>
|
|
997
1363
|
)}
|
|
1364
|
+
{activeTab.kind === 'file' && !activeTab.image && !activeTab.binary && !isBytePreview(previewKind) && repoRel !== '' && (
|
|
1365
|
+
<>
|
|
1366
|
+
<IconButton
|
|
1367
|
+
title={blameError === undefined ? t('editor.blameToggle') : `${t('editor.blameToggle')}: ${blameError}`}
|
|
1368
|
+
className={blameOn ? 'rvs-hbtn-on' : undefined}
|
|
1369
|
+
onClick={toggleBlame}
|
|
1370
|
+
>
|
|
1371
|
+
<span className="rvs-glyph-text">B</span>
|
|
1372
|
+
</IconButton>
|
|
1373
|
+
<IconButton
|
|
1374
|
+
title={t('editor.fileHistory')}
|
|
1375
|
+
className={fileHistoryOpen ? 'rvs-hbtn-on' : undefined}
|
|
1376
|
+
onClick={() => { setFileHistoryOpen(open => !open) }}
|
|
1377
|
+
>
|
|
1378
|
+
<IconDiff size={13} />
|
|
1379
|
+
</IconButton>
|
|
1380
|
+
{blameOn && caretBlame !== undefined && isCommittedBlame(caretBlame.hash) && (
|
|
1381
|
+
<IconButton
|
|
1382
|
+
title={t('editor.blameOpenCaret')}
|
|
1383
|
+
onClick={() => { store.focusCommit(caretBlame.hash) }}
|
|
1384
|
+
>
|
|
1385
|
+
<span className="rvs-glyph-text">↗</span>
|
|
1386
|
+
</IconButton>
|
|
1387
|
+
)}
|
|
1388
|
+
</>
|
|
1389
|
+
)}
|
|
998
1390
|
<span className="rvs-einfo-actions-divider" aria-hidden="true" />
|
|
999
1391
|
{/* The floating window owns its OWN Ctrl+wheel zoom (a property of
|
|
1000
1392
|
that window, persisted per window): the shared preference is not
|
|
1001
1393
|
what paints there, so these two would look dead inside it. */}
|
|
1002
|
-
{variant !== 'float' && (
|
|
1394
|
+
{variant !== 'float' && !bytePreview && !activeTab.image && activeTab.kind !== 'diff' && (
|
|
1003
1395
|
<>
|
|
1004
1396
|
<IconButton
|
|
1005
1397
|
title={t('editor.fontSmaller')}
|
|
@@ -1039,6 +1431,65 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
1039
1431
|
</span>
|
|
1040
1432
|
</div>
|
|
1041
1433
|
|
|
1434
|
+
{fileHistoryOpen && activeTab.kind === 'file' && (
|
|
1435
|
+
<div className="rvs-file-history" role="dialog" aria-label={t('editor.fileHistory')}>
|
|
1436
|
+
<div className="rvs-file-history-head">
|
|
1437
|
+
<span className="rvs-file-history-title">{t('editor.fileHistory')}</span>
|
|
1438
|
+
<span className="rvs-file-history-path" title={repoRel}>{repoRel}</span>
|
|
1439
|
+
<button
|
|
1440
|
+
type="button"
|
|
1441
|
+
className="rvs-file-history-close"
|
|
1442
|
+
title={t('common.close')}
|
|
1443
|
+
aria-label={t('common.close')}
|
|
1444
|
+
onClick={() => { setFileHistoryOpen(false) }}
|
|
1445
|
+
>
|
|
1446
|
+
<IconClose size={11} />
|
|
1447
|
+
</button>
|
|
1448
|
+
</div>
|
|
1449
|
+
{fileHistoryLoading && <div className="rvs-file-history-note">{t('common.loading')}</div>}
|
|
1450
|
+
{!fileHistoryLoading && fileHistoryError !== undefined && (
|
|
1451
|
+
<div className="rvs-file-history-note error">{fileHistoryError}</div>
|
|
1452
|
+
)}
|
|
1453
|
+
{!fileHistoryLoading && fileHistoryError === undefined && fileHistoryRows.length === 0 && (
|
|
1454
|
+
<div className="rvs-file-history-note">{t('editor.fileHistoryEmpty')}</div>
|
|
1455
|
+
)}
|
|
1456
|
+
{!fileHistoryLoading && fileHistoryError === undefined && fileHistoryRows.length > 0 && (
|
|
1457
|
+
<div className="rvs-file-history-list">
|
|
1458
|
+
{fileHistoryRows.map(commit => (
|
|
1459
|
+
<button
|
|
1460
|
+
type="button"
|
|
1461
|
+
key={commit.hash}
|
|
1462
|
+
className="rvs-file-history-row"
|
|
1463
|
+
onClick={() => {
|
|
1464
|
+
setFileHistoryOpen(false)
|
|
1465
|
+
store.openCommitFile(commit.hash, commit.path, commit.origPath)
|
|
1466
|
+
}}
|
|
1467
|
+
>
|
|
1468
|
+
<span className="rvs-file-history-hash">{commit.hash.slice(0, 7)}</span>
|
|
1469
|
+
<span className="rvs-file-history-subject" title={commit.subject}>{commit.subject}</span>
|
|
1470
|
+
<span className="rvs-file-history-meta">
|
|
1471
|
+
{commit.author} · {new Date(commit.date * 1000).toLocaleDateString()}
|
|
1472
|
+
</span>
|
|
1473
|
+
</button>
|
|
1474
|
+
))}
|
|
1475
|
+
</div>
|
|
1476
|
+
)}
|
|
1477
|
+
</div>
|
|
1478
|
+
)}
|
|
1479
|
+
|
|
1480
|
+
{/* 大纲浮层:portal 到 <body>,所以放在 JSX 的哪一层都不影响定位;
|
|
1481
|
+
放在信息栏旁边只是让它和触发它的按钮读在一起。`tabId` 判定是最后
|
|
1482
|
+
一道闸:换 tab 之后旧大纲绝不挂在新文件上。 */}
|
|
1483
|
+
{outline !== undefined && outline.tabId === activeTab.id && (
|
|
1484
|
+
<OutlinePanel
|
|
1485
|
+
t={t}
|
|
1486
|
+
path={outline.path}
|
|
1487
|
+
text={outline.text}
|
|
1488
|
+
onPick={jumpToOutline}
|
|
1489
|
+
onClose={closeOutline}
|
|
1490
|
+
/>
|
|
1491
|
+
)}
|
|
1492
|
+
|
|
1042
1493
|
<div className="rvs-body" ref={bodyRef}>
|
|
1043
1494
|
{/*
|
|
1044
1495
|
A REFUSED save: the remote file moved on, so nothing was written.
|
|
@@ -1155,6 +1606,32 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
1155
1606
|
<div>{imageFailure ?? t('common.loading')}</div>
|
|
1156
1607
|
</div>
|
|
1157
1608
|
)}
|
|
1609
|
+
{!activeTab.image && isBytePreview(previewKind) && (
|
|
1610
|
+
<BytePreview
|
|
1611
|
+
alias={alias}
|
|
1612
|
+
path={activeTab.fullPath}
|
|
1613
|
+
sessionId={chatEnabled ? chat.sessionId : undefined}
|
|
1614
|
+
kind={previewKind}
|
|
1615
|
+
revision={activeTab.reloadNonce ?? 0}
|
|
1616
|
+
t={t}
|
|
1617
|
+
/>
|
|
1618
|
+
)}
|
|
1619
|
+
{!activeTab.image && !activeTab.binary && activeTab.preview && previewKind === 'svg' && (
|
|
1620
|
+
<SvgPreview
|
|
1621
|
+
path={activeTab.rel}
|
|
1622
|
+
text={previewText ?? ''}
|
|
1623
|
+
truncated={activeTab.truncated}
|
|
1624
|
+
t={t}
|
|
1625
|
+
/>
|
|
1626
|
+
)}
|
|
1627
|
+
{!activeTab.image && !activeTab.binary && activeTab.preview && previewKind === 'table' && (
|
|
1628
|
+
<TablePreview
|
|
1629
|
+
path={activeTab.rel}
|
|
1630
|
+
text={previewText ?? ''}
|
|
1631
|
+
truncated={activeTab.truncated}
|
|
1632
|
+
t={t}
|
|
1633
|
+
/>
|
|
1634
|
+
)}
|
|
1158
1635
|
{!activeTab.image && activeTab.binary && (
|
|
1159
1636
|
<div className="rvs-editor-notice">
|
|
1160
1637
|
<div className="rvs-editor-notice-title">{t('editor.binaryTitle')}</div>
|
|
@@ -1164,7 +1641,10 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
1164
1641
|
)}
|
|
1165
1642
|
{!activeTab.image && !activeTab.binary && activeTab.markdown && activeTab.preview && markdownPreview}
|
|
1166
1643
|
{!activeTab.image && !activeTab.binary && activeTab.html && activeTab.preview && (
|
|
1167
|
-
<
|
|
1644
|
+
<div className="rvs-preview-frame-wrap">
|
|
1645
|
+
{activeTab.truncated && <div className="rvs-preview-banner">{t('preview.truncated')}</div>}
|
|
1646
|
+
<iframe className="rvs-html-frame" title={activeTab.rel} sandbox="" srcDoc={htmlDoc} />
|
|
1647
|
+
</div>
|
|
1168
1648
|
)}
|
|
1169
1649
|
{/* The editor host stays MOUNTED and is hidden with CSS in
|
|
1170
1650
|
preview mode. Unmounting it (the old behaviour) rebuilt the
|
|
@@ -1175,9 +1655,9 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
1175
1655
|
caret across preview/source switches, and sibling surfaces
|
|
1176
1656
|
(the image/HTML previews) end up in the same DOM positions
|
|
1177
1657
|
as before, so their own remount behaviour is unchanged. */}
|
|
1178
|
-
{!activeTab.image && !activeTab.binary && (
|
|
1658
|
+
{!activeTab.image && !activeTab.binary && !isBytePreview(previewKind) && (
|
|
1179
1659
|
<div
|
|
1180
|
-
className={`rvs-editor-host${activeTab.preview && (
|
|
1660
|
+
className={`rvs-editor-host${activeTab.preview && hasTextSource(previewKind) ? ' rvs-hidden' : ''}`}
|
|
1181
1661
|
>
|
|
1182
1662
|
{activeTab.truncated && <div className="rvs-banner warn">{t('editor.truncated')}</div>}
|
|
1183
1663
|
<CodeEditor
|
|
@@ -1198,6 +1678,9 @@ export function EditorPane(props: { visible: boolean }): ReactNode {
|
|
|
1198
1678
|
{...(activeTab.line === undefined ? {} : { revealLine: activeTab.line })}
|
|
1199
1679
|
{...(activeTab.lineNonce === undefined ? {} : { revealNonce: activeTab.lineNonce })}
|
|
1200
1680
|
{...(activeTab.changeSet === undefined ? {} : { changeSet: activeTab.changeSet })}
|
|
1681
|
+
blame={blameOn ? blameRows : undefined}
|
|
1682
|
+
onOpenBlame={(entry) => { store.focusCommit(entry.hash) }}
|
|
1683
|
+
onViewport={onEditorViewport}
|
|
1201
1684
|
{...(activeTab.revealHunkLine === undefined ? {} : { revealHunkLine: activeTab.revealHunkLine })}
|
|
1202
1685
|
{...(activeTab.revealHunkNonce === undefined ? {} : { revealHunkNonce: activeTab.revealHunkNonce })}
|
|
1203
1686
|
{...(editorViewStateOf(activeTab.id) === undefined
|