Skip to content

Discard stale HTML and Vue auto-insert responses - #2317

Open
vogella wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
vogella:fix/stale-auto-insert
Open

vogella wants to merge 1 commit into
eclipse-wildwebdeveloper:masterfrom
vogella:fix/stale-auto-insert

Conversation

@vogella

@vogella vogella commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

A late auto-insert response from the HTML or Vue language server was inserted at its original offset even if the user had kept typing, moved the caret or switched the editor input, which could put closing tags or quotes in the wrong place. Both reconcilers now capture the editor state with the request in a shared EditorSnapshot and drop the response if that state has changed. This also removes a stray System.out.println that ran on every change in Vue editors.

A late response from the language server was inserted at its original offset
even if the document, caret or editor input had changed in the meantime.

Assisted-by: multiple AI agents and layers of automated tooling 🤖

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The regression test can pass without the freshness guard because it asserts before the independently dispatched stale response is guaranteed to be processed.

1 open issue
What changed in this PR

This PR protects HTML and Vue auto-insert operations from late language-server responses by checking that the editor still matches the request’s captured state.

Changes:

  • Adds a shared EditorSnapshot for document, modification-stamp, and caret checks.
  • Guards both reconcilers against stale responses and removes Vue’s per-change console logging.
  • Updates HTML caret setup in tests and adds a stale-response regression test.
File Description
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​vue/​autoinsert/​VueAutoInsertReconciler.java Checks response freshness and removes debug logging.
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​util/​EditorSnapshot.java Introduces shared editor-state capture and validation.
org.eclipse.wildwebdeveloper/​src/​org/​eclipse/​wildwebdeveloper/​html/​autoinsert/​HTMLAutoInsertReconciler.java Checks response freshness before inserting text.
org.eclipse.wildwebdeveloper.tests/​src/​org/​eclipse/​wildwebdeveloper/​tests/​TestHTML.java Updates caret setup and tests stale-response handling.

Review effort: Balanced

DisplayHelper.waitForCondition(PlatformUI.getWorkbench().getDisplay(), 5000,
() -> document.get().startsWith("<foo></foo>")),
"Autoclose not done");
assertFalse(document.get().contains("</bar>"), "Stale response was applied");
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.

3 participants