@nkzw/codiff-core 1.15.0 → 1.16.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.
@@ -40,7 +40,7 @@ type HeaderReviewDiffBlock = {
40
40
  selected?: boolean;
41
41
  };
42
42
  export type ReviewDiffBlock = FileReviewDiffBlock | HeaderReviewDiffBlock;
43
- export declare function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedToggle, blocks, bottomInset, codeEditingStore, codeQualityFindings, collapsed, comments, commitMetadata, diffLineHeight, diffStyle, disableWorkerPool, expandedReviewKeys, files, focusCommentId, focusCommentRequest, forceExpandedPaths, gitIdentity, hunkNavigation, initialMarkdownPreviewSectionIds, isReadOnly, itemVersionByKey, keymap, loadingSectionIds, onActiveBlockChange, onAskCodex, onCommentDraftChange, onCreateComment, onDeleteComment, onFindDefinitions, onLoadImageContent, onLoadSection, onLoadSectionContents, onOpenDefinition, onOpenFile, onRefreshMarkdown, onResolveThread, onSaveCommentEdit, onSelectPathFromScroll, onSubmitComment, onToggleCollapsed, onToggleViewed, onUpdateComment, onUpdateSourceDescription, onUpdateSourceTitle, onUploadSourceDescriptionAsset, reviewIdentityByPath, scrollTarget, searchQuery, selectedPath, showSourceDescription, showWhitespace, source, sourceDescriptionActions, sourceDescriptionFooter, supportsReviewCommentActions, theme, viewed, walkthroughNotes, wordWrap, }: {
43
+ export declare function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedToggle, blocks, bottomInset, codeEditingStore, codeQualityFindings, collapsed, comments, commitMetadata, diffLineHeight, diffStyle, disableWorkerPool, expandedReviewKeys, expandUnchanged, files, focusCommentId, focusCommentRequest, forceExpandedPaths, gitIdentity, hunkNavigation, initialMarkdownPreviewSectionIds, isReadOnly, itemVersionByKey, keymap, loadingSectionIds, onActiveBlockChange, onAskCodex, onCommentDraftChange, onCreateComment, onDeleteComment, onFindDefinitions, onLoadImageContent, onLoadSection, onLoadSectionContents, onOpenDefinition, onOpenFile, onRefreshMarkdown, onResolveThread, onSaveCommentEdit, onSelectPathFromScroll, onSubmitComment, onToggleCollapsed, onToggleViewed, onUpdateComment, onUpdateSourceDescription, onUpdateSourceTitle, onUploadSourceDescriptionAsset, reviewIdentityByPath, scrollTarget, searchQuery, selectedPath, showSourceDescription, showWhitespace, source, sourceDescriptionActions, sourceDescriptionFooter, supportsReviewCommentActions, theme, viewed, walkthroughNotes, wordWrap, }: {
44
44
  activeSearchMatch: DiffSearchMatch | null;
45
45
  agentId: 'codex' | 'claude' | 'opencode' | 'pi';
46
46
  agentLabel: string;
@@ -56,6 +56,7 @@ export declare function ReviewCodeView({ activeSearchMatch, agentId, agentLabel,
56
56
  diffStyle: CodiffDiffStyle;
57
57
  disableWorkerPool?: boolean;
58
58
  expandedReviewKeys?: ReadonlySet<string>;
59
+ expandUnchanged?: boolean;
59
60
  files: ReadonlyArray<ChangedFile>;
60
61
  focusCommentId: string | null;
61
62
  focusCommentRequest: number;
@@ -10,8 +10,10 @@ export type CodiffSettings = {
10
10
  copyCommentsOnClose: boolean;
11
11
  diffStyle: CodiffDiffStyle;
12
12
  editorCommand: string;
13
+ expandUnchanged: boolean;
13
14
  lastRepositoryPath: string;
14
15
  openAIModel: string;
16
+ openAIReasoningEffort: string;
15
17
  opencodeModel: string;
16
18
  piModel: string;
17
19
  reviewCommentsPrefix: string;
package/dist/react.mjs CHANGED
@@ -4056,8 +4056,10 @@ const defaultConfigTemplate = {
4056
4056
  "copyCommentsOnClose": false,
4057
4057
  "diffStyle": "split",
4058
4058
  "editorCommand": "",
4059
+ "expandUnchanged": false,
4059
4060
  "lastRepositoryPath": "",
4060
4061
  "openAIModel": "gpt-5.6-terra",
4062
+ "openAIReasoningEffort": "",
4061
4063
  "opencodeModel": "opencode-default",
4062
4064
  "piModel": "pi-default",
4063
4065
  "reviewCommentsPrefix": "# Address these Review Comments",
@@ -7209,7 +7211,7 @@ const getHunkSelectionRange = (hunk) => {
7209
7211
  } : null;
7210
7212
  };
7211
7213
  const isSameSelection = (a, b) => a.start === b.start && a.end === b.end && a.side === b.side;
7212
- function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedToggle = false, blocks, bottomInset = codeViewLayout.paddingBottom, codeEditingStore, codeQualityFindings = [], collapsed, comments, commitMetadata, diffLineHeight = 20, diffStyle, disableWorkerPool = false, expandedReviewKeys = emptyExpandedReviewKeys, files, focusCommentId, focusCommentRequest, forceExpandedPaths, gitIdentity, hunkNavigation, initialMarkdownPreviewSectionIds = emptyMarkdownPreviewSectionIds, isReadOnly = false, itemVersionByKey, keymap, loadingSectionIds, onActiveBlockChange, onAskCodex, onCommentDraftChange, onCreateComment, onDeleteComment, onFindDefinitions, onLoadImageContent, onLoadSection, onLoadSectionContents, onOpenDefinition, onOpenFile, onRefreshMarkdown, onResolveThread = noopResolveThread, onSaveCommentEdit, onSelectPathFromScroll, onSubmitComment, onToggleCollapsed, onToggleViewed, onUpdateComment, onUpdateSourceDescription, onUpdateSourceTitle, onUploadSourceDescriptionAsset, reviewIdentityByPath, scrollTarget, searchQuery, selectedPath, showSourceDescription = true, showWhitespace, source, sourceDescriptionActions, sourceDescriptionFooter, supportsReviewCommentActions, theme = "system", viewed, walkthroughNotes, wordWrap }) {
7214
+ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedToggle = false, blocks, bottomInset = codeViewLayout.paddingBottom, codeEditingStore, codeQualityFindings = [], collapsed, comments, commitMetadata, diffLineHeight = 20, diffStyle, disableWorkerPool = false, expandedReviewKeys = emptyExpandedReviewKeys, expandUnchanged = false, files, focusCommentId, focusCommentRequest, forceExpandedPaths, gitIdentity, hunkNavigation, initialMarkdownPreviewSectionIds = emptyMarkdownPreviewSectionIds, isReadOnly = false, itemVersionByKey, keymap, loadingSectionIds, onActiveBlockChange, onAskCodex, onCommentDraftChange, onCreateComment, onDeleteComment, onFindDefinitions, onLoadImageContent, onLoadSection, onLoadSectionContents, onOpenDefinition, onOpenFile, onRefreshMarkdown, onResolveThread = noopResolveThread, onSaveCommentEdit, onSelectPathFromScroll, onSubmitComment, onToggleCollapsed, onToggleViewed, onUpdateComment, onUpdateSourceDescription, onUpdateSourceTitle, onUploadSourceDescriptionAsset, reviewIdentityByPath, scrollTarget, searchQuery, selectedPath, showSourceDescription = true, showWhitespace, source, sourceDescriptionActions, sourceDescriptionFooter, supportsReviewCommentActions, theme = "system", viewed, walkthroughNotes, wordWrap }) {
7213
7215
  const codeViewRef = useRef(null);
7214
7216
  const [codeViewElement, setCodeViewElement] = useState(null);
7215
7217
  const [compactHeaders, setCompactHeaders] = useState(false);
@@ -7245,6 +7247,7 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
7245
7247
  const focusedCommentEditorIdRef = useRef(null);
7246
7248
  const definitionHighlightFrameRef = useRef(null);
7247
7249
  const highlightFrameRef = useRef(null);
7250
+ const lastScrolledSearchMatchRef = useRef(null);
7248
7251
  const ignoreNextLineSelectionEndRef = useRef(false);
7249
7252
  const navigatedSelectionRef = useRef(null);
7250
7253
  const initialMarkdownFiles = files.length > 0 ? files : blocks?.map((block) => block.file).filter((file) => file != null) ?? [];
@@ -7804,7 +7807,7 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
7804
7807
  diffStyle,
7805
7808
  enableGutterUtility: !isReadOnly,
7806
7809
  enableLineSelection: !isReadOnly,
7807
- expandUnchanged: false,
7810
+ expandUnchanged: expandUnchanged && loadDiffFiles != null,
7808
7811
  expansionLineCount: 100,
7809
7812
  hunkSeparators: "line-info-basic",
7810
7813
  itemMetrics,
@@ -7921,6 +7924,7 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
7921
7924
  cancelPendingEmptyCommentDeletes,
7922
7925
  createCommentForRange,
7923
7926
  diffStyle,
7927
+ expandUnchanged,
7924
7928
  isReadOnly,
7925
7929
  itemMetadata,
7926
7930
  itemMetrics,
@@ -8331,9 +8335,22 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
8331
8335
  }, []);
8332
8336
  useEffect(() => invalidateDefinitionLookup, [invalidateDefinitionLookup]);
8333
8337
  useEffect(() => {
8338
+ if (!activeSearchMatch) {
8339
+ lastScrolledSearchMatchRef.current = null;
8340
+ return;
8341
+ }
8334
8342
  const handle = codeViewRef.current;
8335
8343
  const viewer = handle?.getInstance();
8336
8344
  if (!handle || !viewer || !resolvedActiveSearchMatch) return;
8345
+ const lastScrolledSearchMatch = lastScrolledSearchMatchRef.current;
8346
+ if (lastScrolledSearchMatch?.match === activeSearchMatch && lastScrolledSearchMatch.itemId === resolvedActiveSearchMatch.itemId) {
8347
+ scheduleSearchHighlights();
8348
+ return;
8349
+ }
8350
+ lastScrolledSearchMatchRef.current = {
8351
+ itemId: resolvedActiveSearchMatch.itemId,
8352
+ match: activeSearchMatch
8353
+ };
8337
8354
  if (resolvedActiveSearchMatch.lineNumber == null) handle.scrollTo({
8338
8355
  align: "center",
8339
8356
  behavior: "smooth-auto",
@@ -8350,7 +8367,11 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
8350
8367
  type: "line"
8351
8368
  });
8352
8369
  scheduleSearchHighlights();
8353
- }, [resolvedActiveSearchMatch, scheduleSearchHighlights]);
8370
+ }, [
8371
+ activeSearchMatch,
8372
+ resolvedActiveSearchMatch,
8373
+ scheduleSearchHighlights
8374
+ ]);
8354
8375
  const renderCodeViewHeader = useCallback(() => /* @__PURE__ */ jsxs("div", {
8355
8376
  className: "codiff-source-description-panel codiff-code-view-source-description",
8356
8377
  children: [/* @__PURE__ */ jsx(SourceDescriptionHeader, {
package/dist/types.d.ts CHANGED
@@ -677,8 +677,10 @@ export type CodiffPreferences = {
677
677
  copyCommentsOnClose: boolean;
678
678
  diffStyle: CodiffDiffStyle;
679
679
  editorCommand: string;
680
+ expandUnchanged: boolean;
680
681
  lastRepositoryPath: string;
681
682
  openAIModel: string;
683
+ openAIReasoningEffort: string;
682
684
  opencodeModel: string;
683
685
  piModel: string;
684
686
  reviewCommentsPrefix: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/codiff-core",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "A fast diff viewer.",
5
5
  "license": "MIT",
6
6
  "author": {