Skip to content

support adapter for IDocument in LSPEclipseUtils #1500

Open

Description

@raghucssit

org.eclipse.lsp4e.LSPEclipseUtils.getFile(IDocument) and org.eclipse.lsp4e.LSPEclipseUtils.toUri(IDocument) uses the eclipse buffer allocated by buffer manager to IDocument to determine the java.netURI and org.eclipse.core.resources.IFile.

Some framework like Xtext does not connect their document to buffer manager. So LSPEclipseUtils returns null for URI and IFile in such cases.
So we can try to adapt the IDocument to URI and IFile. Off course implementors of IDocument shold adapt themselves for this feature to work.

I have created a PR to support adaption of XtextDocument but that is not precondition for this PR.
eclipse-xtext/xtext#3614

More background:
Github copilot uses LSPEclipseUtils to derive URI and IFile. Which is currently failing for XtextDocuments and lacking the copilot completion support for DSL editors.
microsoft/copilot-for-eclipse#46

Activity

  1. iloveeclipse commented on Apr 1, 2026

    @iloveeclipse
    Contributor

    @rubenporras : thanks for merging #1501.

    Could you please:

    1. Mark this ticket as fixed by Adapt document to IFile when unable to retrieve file from buffer manager #1501
    2. Assign it to @raghucssit
    3. If you use milestones, mark for which milestone / release it is planned.

    Thanks!

  2. iloveeclipse commented on Apr 1, 2026

    @iloveeclipse
    Contributor

    @rubenporras : currently the enhancement only works via (invisible to user) preference.

    Would you mind if we would provide some visible preference option somewhere in LSP4E, something like "Enable support for Xtext like editors" or "Enable document retrieval fallback via resources API"?

  3. iloveeclipse commented on Apr 1, 2026

    @iloveeclipse
    Contributor

    For the record: org.eclipse.lsp4e/org.eclipse.lsp4e.resourceFallback.enabled=true preference can be set via product customization to enable new functionality.

  4. rubenporras commented on Apr 1, 2026

    @rubenporras
    Contributor

    Would it be easier if you enable it with the CoPilot plugin? I have assumed that this is what you had in mind. If not, I would not mind for it to be enabled by default so that it can be disabled if it causes problems.

  5. iloveeclipse commented on Apr 1, 2026

    @iloveeclipse
    Contributor

    Would it be easier if you enable it with the CoPilot plugin? I have assumed that this is what you had in mind. If not, I would not mind for it to be enabled by default so that it can be disabled if it causes problems.

    I mean, if users (in any application) see any issues, they could switch it on/off by themself in an easy way (without manual preferences file editing).

  6. iloveeclipse commented on Apr 2, 2026

    @iloveeclipse
    Contributor

    @raghucssit: just tried latest nightly build of LSP4E with latest nightly build from Copilot, everything works smooth in our Xtext based application! Great! Editing, Chat with ask/agents mode.

    @rubenporras : any estimation when the official 0.30.1 LSP4E release will be created?

  7. rubenporras commented on Apr 2, 2026

    @rubenporras
    Contributor

    @iloveeclipse , if you are happy with the result of the commit (which seems so), I can do the release now

  8. iloveeclipse commented on Apr 2, 2026

    @iloveeclipse
    Contributor

    if you are happy with the result of the commit (which seems so), I can do the release now

    Yes, I'm happy, sure! If you can release it, it would be great, so Copilot guys (and anyone else interesting on Copilot+Xtext) which plan to release next 0.16 release soon could profit from this update too (not only our internal application).

    @jdneo: FYI.

  9. rubenporras commented on Apr 2, 2026

    @rubenporras
    Contributor

    Done

  10. tamasmiklossy commented on Jun 18, 2026

    @tamasmiklossy

    @iloveeclipse: What is exactly the right version combination to make Copilot+Xtext work?

    Currently what I have:

    • Eclipse Platform 2026-06 (4.40.0)
    • Eclipse Xtext 2.43.0
    • Eclipse LSP4E 0.19.12
    • GitHub Copilot 0.18.0
  11. iloveeclipse commented on Jun 18, 2026

    @iloveeclipse
    Contributor

    You need commit 1168eb4 which is in LSP4E 0.30.1, other dependencies are fine (I would simply take latest greatest LSP4E version).

    Of course org.eclipse.lsp4e/org.eclipse.lsp4e.resourceFallback.enabled=true preference must be set.

  12. tamasmiklossy commented on Jun 18, 2026

    @tamasmiklossy

    Somehow if I use the https://download.eclipse.org/lsp4e/releases/latest/ update site, I get LSP4E 0.19.12.

    Image

    @rubenporras : any idea where to get LSP4E 0.30.1 ?

  13. iloveeclipse commented on Jun 18, 2026

    @iloveeclipse
    Contributor

    any idea where to get LSP4E 0.30.1 ?

    I believe there is mismatch what is released on github and what is actually used as bundle versions.

    I was referring to the released version, because this is what I can trace from the commit 1168eb4.

    I have no idea which bundle version corresponds to which release. Ideally the lsp4e bundle version would match github release version.

  14. tamasmiklossy commented on Jun 24, 2026

    @tamasmiklossy

    Now it works for me, I get AI assisted inline code suggestions on Xtext-based editors (*.xtext, *.xtend, *.mwe2, ... files). :-)
    Thank you @iloveeclipse !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions