Skip to content

[diffs] Editable CodeView - #821

Closed
amadeus wants to merge 1 commit into
beta-1.3from
amadeus/editor-codeview
Closed

[diffs] Editable CodeView#821
amadeus wants to merge 1 commit into
beta-1.3from
amadeus/editor-codeview

Conversation

@amadeus

@amadeus amadeus commented Jun 16, 2026

Copy link
Copy Markdown
Member

@ije this PR quickly adds an editable toggle to the CodeView demo and hooks it up. It kinda works but if you scroll down things stop working.

I think there's also a higher level API type question we need to resolve -- CodeView uses a shared options interface, so the way we are forcing options to be a certain configuration is not ideal in a CodeView environment and we might want to think about how to handle this.

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffshub Ready Ready Preview Jul 1, 2026 10:01pm
pierre-docs-trees Ready Ready Preview Jul 1, 2026 10:01pm
pierrejs-diff-demo Ready Ready Preview Jul 1, 2026 10:01pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pierre-docs-diffs Skipped Skipped Jul 1, 2026 10:01pm

Request Review

@amadeus
amadeus marked this pull request as draft June 16, 2026 22:45
@amadeus
amadeus requested a review from ije June 16, 2026 22:45
// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,
useTokenTransformer: true,
expandUnchanged: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we HAVE to force expandUnchanged true?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the page may jitter when editing with expand unchanged option. we can support this in the future?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b310cf995b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

enableLineSelection: false,
enableGutterUtility: false,
// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this wont be an issue with #818

enableGutterUtility: false,
// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,
useTokenTransformer: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this is necessary?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the editor depends on the data-char attr for selection rendering

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this only is required with worker pool

Comment on lines +143 to +145
lineHoverHighlight: 'disabled',
enableLineSelection: false,
enableGutterUtility: false,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to toggle this globally for CodeView just to support editing, is there a way we can like let these options be whatever, but then disable the functionality while editing?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the editor will update the options and rerender if the option is not supported. you don't have to add these options.

enableGutterUtility: false,
// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,
useTokenTransformer: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the editor depends on the data-char attr for selection rendering

// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,
useTokenTransformer: true,
expandUnchanged: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the page may jitter when editing with expand unchanged option. we can support this in the future?

Comment on lines +143 to +145
lineHoverHighlight: 'disabled',
enableLineSelection: false,
enableGutterUtility: false,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the editor will update the options and rerender if the option is not supported. you don't have to add these options.

enableGutterUtility: false,
// I assume once you merge the unified support, this won't be a requirement anymore
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,
useTokenTransformer: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this only is required with worker pool

codeView.options = {
...codeView.options,
// Ideally we don't do this...
diffStyle: diffStyle === 'unified' ? 'split' : diffStyle,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unified supported now

@amadeus

amadeus commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Closing this PR because I actually want to make the editing configuration a first class citizen, so this hack to get it working is not really relevant and should never merge.

@amadeus amadeus closed this Jul 2, 2026
@amadeus
amadeus deleted the amadeus/editor-codeview branch July 2, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants