Skip to content

fix: test adt#539

Open
Will-ShaoHua wants to merge 1 commit intoaws:mainfrom
Will-ShaoHua:adt
Open

fix: test adt#539
Will-ShaoHua wants to merge 1 commit intoaws:mainfrom
Will-ShaoHua:adt

Conversation

@Will-ShaoHua
Copy link
Copy Markdown
Contributor

@Will-ShaoHua Will-ShaoHua commented Mar 25, 2026

Issue #, if available:

Description of changes:

When SAP ADT plugin is used, there are two separate IDocument objects for the same file:

  1. Live editing document (from viewer.getDocument()) — updates on every keystroke, attached to the text widget. This is
  what our AutoTriggerDocumentListener listens to.
  2. File buffer document (from editor.getDocumentProvider().getDocument(editorInput)) — only updated when user explicitly
  saves. This is what lsp4e's ConnectDocumentToLanguageServerSetupParticipant connects to and tracks.

  When user types, lsp4e's internal listener fires on the file buffer document, which never changes → no
  textDocument/didChange is sent to the LSP server → LSP server has stale content → suggestions are based on old code.

  For regular editors these two documents are the same object. ADT's remote-server model breaks this assumption.

Solution

1. Detect whether we're in an ADT editor by checking if the active editor is an ADT type (already have
  AbapUtil.isAdtEditor()).
  2. If ADT, get the full current content from e.getDocument().get() and the file URI from
  QEclipseEditorUtils.getOpenFileUri().
  3. Construct a DidChangeTextDocumentParams with a full-content change event (no range, just replace entire content).
  4. Call server.getTextDocumentService().didChange(params) on the AmazonQLspServer proxy before qSes.invoke().

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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.

1 participant