[ZEPPELIN-6710] Keep Enter as a newline for no-op Monaco suggestions #5490
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5490"
general
weight: 0.35
jongyoul
What is this PR for?
In the New UI paragraph editor (Monaco), pressing Enter can be silently swallowed while the auto-suggest popup is open, dropping a line break so the next characters land on the current line instead of a new one.
The trigger is a no-op suggestion. When word-based suggestions offer a candidate identical to the word the user just finished typing, accepting it changes nothing. With Monaco's
acceptSuggestionOnEnterleft at its default ('on'), Enter accepts that no-op candidate instead of inserting a newline: the keystroke is consumed, the line break never lands, and rapid multi-line typing loses lines.The fix sets
acceptSuggestionOnEnter: 'smart'on the paragraph editor. The auto-suggest popup still appears; only the Enter behavior changes, and only for a focused candidate whose acceptance would not change the text.Why
'smart'over the alternativeswordBasedSuggestions: 'off'— removes the document-word completion feature entirely. That is heavier than the bug warrants, and it is not even the right lever: Monaco's built-in word-based provider already filters out an exact match of the current token (editorSimpleWorker.js,if (word === leadingWord) continue), so turning it off does not target the actual no-op source.completion.service.ts) — the most surgical removal of the candidate, but it changes interpreter completion behavior, which ZEPPELIN-6710 explicitly lists as out of scope ("Changing interpreter completion behavior or the Ctrl+Space-then-Enter accept flow"). It also lives outsideupdateEditorOptions(), which the issue scopes the change to.acceptSuggestionOnEnter: 'smart'— a one-line change insideupdateEditorOptions(), keeps the completion feature intact, and defends the newline regardless of which provider produced the candidate. It matches the issue's scope ("Stop Enter from silently discarding a newline when the focused suggestion would make no textual change") exactly.Trade-offs, and why they are not problems here
'smart'fixes.acceptSuggestionOnEnteris editor-wide (within the paragraph code editor). Behavior only changes for the exact combination "no-op candidate + auto-triggered popup + Enter"; every other completion path — partial-word accept, Ctrl+Space, Tab — is unchanged. There is no scenario where turning a no-op accept into a newline is a regression.'smart'does not coveradditionalTextEdits(auto-import) or snippet candidates — Monaco treats those as text-changing and still accepts them on Enter. This does not apply to Zeppelin: interpreter completions are mapped as plain-stringinsertTextwith noinsertTextRulesoradditionalTextEdits(completion.service.ts), so those candidate shapes are never produced.How
'smart'works internallyMonaco recomputes a context key
suggestionMakesTextEditwhenever the focused suggestion changes. Under'smart', it gates on: the popup was auto-triggered (state === Auto, i.e. not a manual Ctrl+Space), noadditionalTextEdits, not a snippet, and the replace range length equals the insert-text length. When that gate passes, it compares the editor text against the candidate'sinsertText; if they are identical the key is set tofalse.Enter is bound to
acceptSelectedSuggestion, which requiresVisible && textInputFocus && acceptSuggestionOnEnter && suggestionMakesTextEdit. With the keyfalse, that binding no longer matches, so Enter falls through to the editor's default action — a newline. Ctrl+Space (a manual trigger) never enters thestate === Autogate, so interpreter completion's accept-on-Enter is unaffected; inline ghost-text is a separateregisterInlineCompletionsProvidersubsystem and is likewise untouched.What type of PR is it?
Bug Fix
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6710
How should this be tested?
A new Playwright regression,
zeppelin-web-angular/e2e/tests/notebook/monaco-enter-newline.spec.ts, drives the auto-suggest path (typing to let quickSuggestions open the popup, not a manual trigger, since'smart'only applies to auto-triggered popups). It asserts:foobar\nbaz, notfoobarbaz);'smart'only skips no-ops).Verified: the test passes with the fix, and fails deterministically (
foobarandbazmerge onto one line) when the'smart'line is removed — so the regression actually pins the bug.tsc,prettier, andeslintare clean.Screenshots (if appropriate)
https://github.com/user-attachments/assets/e06c66fb-8cea-4837-bcd3-e84689109695
Questions: