Skip to content

didChange is being sent before didOpen #1105

Closed

Description

This seems to be causing the issue mentioned here: BetterThanTomorrow/calva#1900.

The spec says:

Before a client can change a text document it must claim ownership of its content using the textDocument/didOpen notification.

I do see that the time is the same second, but the didChange appears first so I'm guessing it came a fraction of a second earlier than didOpen.

[Trace - 11:36:32 PM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file:///Users/pez/Projects/tests/minimal-deps/src/foo.clj",
        "version": 2
    },
    "contentChanges": [
        {
            "text": "(ns foo\n  (:require [clojure.string :as string]))\n\n(defn bar\n  []\n  (let [x 1]\n    x))"
        }
    ]
}


[Trace - 11:36:32 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///Users/pez/Projects/tests/minimal-deps/src/foo.clj",
        "languageId": "clojure",
        "version": 1,
        "text": ""
    }
}

Activity

  1. dbaeumer commented on Oct 28, 2022

    @dbaeumer
    Member

    Brandon Ringe (@bpringe) which version are you using? This looks very similar to #968 which for addressed in 8.0.2 (looks like you are using full text document sync as well).

    If you are on a version > 8.0.2 can you provide me with steps on how to reproduce this?

  2. bpringe commented on Oct 29, 2022

    @bpringe
    Author

    We're using 8.0.2.

    Steps to reproduce are noted here: BetterThanTomorrow/calva#1900 (comment).

    The clojure-lsp server maintainer mentions the ordering issue here: BetterThanTomorrow/calva#1900 (comment).

    If you need more details, let me know.

  3. dbaeumer commented on Oct 31, 2022

    @dbaeumer
    Member

    I was able to reproduce this (see test case https://github.com/dbaeumer/vscode-lsp-1105). It happens only under the following conditions:

    • full text sync
    • save of an untitled file where the language server is not yet started (e.g. doesn't handle untitled files)
  4. added a commit that references this issue on Oct 31, 2022
    9019401
  5. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    info-neededIssue requires more information from poster
    on Oct 31, 2022
  6. added this to the milestone on Oct 31, 2022
  7. bpringe commented on Nov 2, 2022

    @bpringe
    Author

    Thanks for the fix!

  8. added a commit that references this issue on Feb 6, 2024
    ee58574
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

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions