Skip to content

Two textDocument/didChange events being sent in Goland #583

Closed

Description

@rcjsuen

I'm assuming I'm doing something wrong...because I feel like someone else would have filed this bug already. What's interesting is...

  • the version numbers differ
  • the uri has the absolute path and then just the file name...?
  • the contentChanges are identical

Note that I am using TextDocumentSyncKind.Full (which is equivalent to 1 from what I can tell).

[Trace - 18:20:40] Sending notification 'textDocument/didChange'
Params: {
  "textDocument": {
    "version": 14,
    "uri": "file:///Users/rcjsuen/abc.xyz"
  },
  "contentChanges": [
    {
      "text": "same thing"
    }
  ]
}
[Trace - 18:20:40] Sending notification 'textDocument/didChange'
Params: {
  "textDocument": {
    "version": 15,
    "uri": "file:///abc.xyz"
  },
  "contentChanges": [
    {
      "text": "same thing"
    }
  ]
}

Activity

  1. angelozerr commented on Oct 26, 2024

    @angelozerr
    Contributor

    You mean that you have registered a language server with lsp4ij and you have this kind of lsp didChange notifications?

    If it is that it is very strange. Could you tell me which ls you are starting and give me some explanation how to start it please.

    Thanks

  2. angelozerr commented on Oct 26, 2024

    @angelozerr
    Contributor

    You mean that you have registered a language server with lsp4ij and you have this kind of lsp didChange notifications?

    If it is that it is very strange. Could you tell me which ls you are starting and give me some explanation how to start it please.

    Thanks

    I have never tested a language server with text full synchronization, perhaps there is a bug with this synch kind?

  3. rcjsuen commented on Oct 26, 2024

    @rcjsuen
    ContributorAuthor

    You mean that you have registered a language server with lsp4ij and you have this kind of lsp didChange notifications?

    Correct. I am pasting stuff from the "Traces" view.

    If it is that it is very strange. Could you tell me which ls you are starting and give me some explanation how to start it please.

    Sorry, I am unable to share details about the language server I am using.

    Here is something else I noticed.

    In the initialize message from the client, I see { "rootUri": null, "workspaceFolders": [] } when I have GoLand opened to a project. The background is brown though which suggests to me the IDE has gotten into some strange state.

    image

    I think this is likely the root cause of the issue...? Probably? The IDE seems to know I have a file opened at the full path but also since it's "not really in a project" perhaps it cannot (or does not try to) do any path resolution and also seems to think I have a file opened "nowhere" and hence just has it at file:///?

  4. rcjsuen commented on Oct 26, 2024

    @rcjsuen
    ContributorAuthor

    I have never tested a language server with text full synchronization, perhaps there is a bug with this synch kind?

    I changed the code to use TextDocumentSyncKind.Incremental (and I can see the value of 2 in the logs) and it still happens so we can probably rule that out. 👍

  5. angelozerr commented on Oct 26, 2024

    @angelozerr
    Contributor

    You mean that you have registered a language server with lsp4ij and you have this kind of lsp didChange notifications?

    Correct. I am pasting stuff from the "Traces" view.

    If it is that it is very strange. Could you tell me which ls you are starting and give me some explanation how to start it please.

    Sorry, I am unable to share details about the language server I am using.

    Here is something else I noticed.

    In the initialize message from the client, I see { "rootUri": null, "workspaceFolders": [] } when I have GoLand opened to a project. The background is brown though which suggests to me the IDE has gotten into some strange state.

    image

    I think this is likely the root cause of the issue...? Probably? The IDE seems to know I have a file opened at the full path but also since it's "not really in a project"

    If your file doesnt belong to a project I think yiu could have strange behaviour like you have since I have not tested this usecase.

  6. rcjsuen commented on Oct 27, 2024

    @rcjsuen
    ContributorAuthor

    @angelozerr I was able to reproduce the problem with my open source language server with GoLand opened to the moby/buildkit repository.

    image

    I don't have any strange "brown background" in my Dockerfile or the files around it so I think the system recognizes the file as being "inside a project"...?

    image

    You can setup my Dockerfile language server with npm install and then npm run prepublishOnly. The language server is setup in GoLand as follows without anything for "Configuration".

    image image

    Since the LSP logs are so big I have attached it instead of putting it directly into this comment. You can see the doubled textDocument/didOpen on lines 406 and 963 and the doubled textDocument/didChange on 12791 and 12816. Hope this helps!

    redhat-lsp4ij-issue583.txt

  7. rcjsuen commented on Oct 27, 2024

    @rcjsuen
    ContributorAuthor

    My new theory is that it is related to textDocument/semanticTokens/full somehow. When I disable semantic highlighting support from the server's initialize response I cannot seem to get the issue to reproduce itself.

  8. angelozerr commented on Oct 27, 2024

    @angelozerr
    Contributor

    My new theory is that it is related to textDocument/semanticTokens/full somehow. When I disable semantic highlighting support from the server's initialize response I cannot seem to get the issue to reproduce itself.

    @rcjsuen it is difficult for me to try to fix issues that we have not in our IJ Quarkus because my current goal is to release IJ Quarkus which requires some issue to implement like #570

    If you have time to debug and better create a PR I will be happy to review it.

    If you need some help with the code base or other thing dont hesitate to ask me.

  9. angelozerr commented on Nov 3, 2024

    @angelozerr
    Contributor

    My new theory is that it is related to textDocument/semanticTokens/full somehow. When I disable semantic highlighting support from the server's initialize response I cannot seem to get the issue to reproduce itself.

    @rcjsuen it is difficult for me to try to fix issues that we have not in our IJ Quarkus because my current goal is to release IJ Quarkus which requires some issue to implement like #570

    If you have time to debug and better create a PR I will be happy to review it.

    If you need some help with the code base or other thing dont hesitate to ask me.

    Have you the same problem with IJ Community?

    As Goland is not free, it is difficult for me to test it.

  10. angelozerr commented on Nov 3, 2024

    @angelozerr
    Contributor

    My new theory is that it is related to textDocument/semanticTokens/full somehow. When I disable semantic highlighting support from the server's initialize response I cannot seem to get the issue to reproduce itself.

    @rcjsuen it is difficult for me to try to fix issues that we have not in our IJ Quarkus because my current goal is to release IJ Quarkus which requires some issue to implement like #570

    If you have time to debug and better create a PR I will be happy to review it.

    If you need some help with the code base or other thing dont hesitate to ask me.

    Have you the same problem with IJ Community?

    As Goland is not free, it is difficult for me to test it.

    @rcjsuen it would be nice if you could debug lsp4ij and set a breakpoint at https://github.com/redhat-developer/lsp4ij/blob/main/src%2Fmain%2Fjava%2Fcom%2Fredhat%2Fdevtools%2Flsp4ij%2FConnectDocumentToLanguageServerSetupParticipant.java#L57 . My first feeling is that in goland this fileOpened is called twice, but perhaps I am wrong.

  11. rcjsuen commented on Nov 5, 2024

    @rcjsuen
    ContributorAuthor

    Have you the same problem with IJ Community?

    From a quick test just now, I was unable to reproduce it with IntelliJ IDEA 2024.2.4 (Build #IC-242.23726.103).

  12. angelozerr commented on Nov 5, 2024

    @angelozerr
    Contributor

    Have you the same problem with IJ Community?

    From a quick test just now, I was unable to reproduce it with IntelliJ IDEA 2024.2.4 (Build #IC-242.23726.103).

    OK so it seems the problem comes from with goland.

  13. changed the title [-]Two `textDocument/didChange` events being sent[/-] [+]Two `textDocument/didChange` events being sent in Goland[/+] on Nov 13, 2024
  14. added a commit that references this issue on Nov 19, 2024
    57a43ea
  15. added this to the 0.8.0 milestone on Nov 20, 2024
  16. angelozerr commented on Nov 20, 2024

    @angelozerr
    Contributor

    @rcjsuen I close the issue since you cannot reproduce it. Please reopen if youhave again the problem.

  17. rcjsuen commented on Nov 20, 2024

    @rcjsuen
    ContributorAuthor

    @angelozerr I am okay with that decision. I think we need to understand the exact nuance of how a JetBrains IDE operates.

  18. angelozerr commented on Nov 20, 2024

    @angelozerr
    Contributor

    @angelozerr I am okay with that decision. I think we need to understand the exact nuance of how a JetBrains IDE operates.

    I agree with you. I dont like issues which are fixed but without understand.

    We will see if you can reproduce it.

  19. added
    bug
    on Nov 21, 2024
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions