Skip to content

LSP doesn't work for external dependencies (like jars) #782

Closed

Description

@ericdallo

When coding clojure-lsp integration with this plugin, I noticed that after you find the definition of a symbol that goes to a read only file of a external dependency, no LSP feature works on that opened file, no request besides textDocument/didOpen is sent to server.

Steps to reproduce in clojure-lsp:

  1. Install the plugin + nightly lsp4ij build: clojure-lsp-2.6.4.zip (ref branch)
  2. Open a clojure project, example: ericdallo/clojure-sample
  3. Open a clojure file like foo.clj and wait for LSP initialize.
  4. find definition of a function that belongs to a external lib, like concat or str from clojure.core.
  5. the new file will be opened, but no LSP feature will work there, like find references or go to definition of local variables.

Image

Activity

  1. added
    bug
    on Jan 29, 2025
  2. angelozerr commented on Jan 30, 2025

    @angelozerr
    Contributor

    @ericdallo is it a blocker issue?

  3. angelozerr commented on Jan 30, 2025

    @angelozerr
    Contributor

    I suspect the problem comes from

    if (file == null || !file.isInLocalFileSystem()) {

  4. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    Yes, unfortunately it is @angelozerr, it's something really common in Clojure development

  5. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    And I suspect this may happen for other languages like Java and Dart that have go to definition to external libs

  6. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    I suspect the problem comes from

    Yeah, that makes sense to me, IMO this inLocalSystem should not exists as the LSP protocol states that files could be even in remote system, not only local, although this jar problem is still considered local.

  7. angelozerr commented on Jan 30, 2025

    @angelozerr
    Contributor

    I did that to fix #560

  8. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    Hum, looks like it's not the best way to fix it

  9. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    Any chance we can have a flag or setting to not do that? also, removing that fixes the problem?

  10. angelozerr commented on Jan 30, 2025

    @angelozerr
    Contributor

    Any chance we can have a flag or setting to not do that? also, removing that fixes the problem?

    Customize this behavior is my mind. I need to find time because I am super busy to clean the dap support to create a release.

    If it is easy to do , I will try to do that but I cannot promise that.

  11. ericdallo commented on Jan 30, 2025

    @ericdallo
    ContributorAuthor

    Thanks, let me know if there is anything to help with, I'm interested in releasing this as soon as possible. We would need a release from lsp4ij as well

  12. ericdallo commented on Feb 3, 2025

    @ericdallo
    ContributorAuthor

    Image

    @angelozerr just to give you visibility, I built lsp4ij locally without that isInLocalFileSystem check and the issue fixes for me, although I know it was added because of #560, even so, I do think this check should not live there or jar files should be considered local as well.
    I'm wondering if we could make it configurable by a setting/config or class we can extend to configure it, WDYT?

  13. added 3 commits that reference this issue on Feb 3, 2025
    a119d84
    12fdca5
    20ba08e
  14. angelozerr commented on Feb 3, 2025

    @angelozerr
    Contributor

    @ericdallo could you try #796 please

  15. ericdallo commented on Feb 3, 2025

    @ericdallo
    ContributorAuthor

    @angelozerr that fixes the issue for me!

  16. angelozerr commented on Feb 3, 2025

    @angelozerr
    Contributor

    Thats great! I will try to move this logic inside mapping with the default document matcher in order to have yhe capability to change this logic.

  17. self-assigned this
    on Feb 4, 2025
  18. added this to the 0.10.0 milestone on Feb 4, 2025
  19. angelozerr commented on Feb 4, 2025

    @angelozerr
    Contributor

    Finally I will let like this and this logic cannot be configured.

    I will re-consider that when we will have a concrete sample.

  20. moved this to Pending review in Java Toolingon Feb 4, 2025
  21. added a commit that references this issue on Feb 4, 2025
    50d06cb
  22. moved this from Pending review to Done in Java Toolingon Feb 4, 2025
  23. ericdallo commented on Feb 4, 2025

    @ericdallo
    ContributorAuthor

    Thanks @angelozerr! I think from clojure-lsp side we are ready for the 0.10.0 release, no blockers so far, will test all plugin features tomorrow to confirm

  24. angelozerr commented on Feb 4, 2025

    @angelozerr
    Contributor

    That's great!

    Indeed please test a lot the nighty since @SCWells72 did so many big and great contribution and @FalsePattern contribute to switch to the new API for inlay hint.

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions