Repository navigation
didChange/didOpen appear to be sent out of order for global search-and-replace #1176
Copy link
Copy link
Closed
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
This is a related bug to one i filed recently #1133
With global search-and-replace we are getting that didChange and didOpen events are out of order with full document sync -
Example from my test repo -
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh",
"version": 2
},
"contentChanges": [
{
"text": "#pragma once\n\n// abcdefgh abcdefgh abcdefgh\nnamespace foo {\n\nvoid Foo();\n\n} // namespace foo\n"
}
]
}
[Trace - 3:09:24 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts",
"languageId": "typescript",
"version": 1,
"text": "// abcdef abcdef abcdef abcdef abcdef\nexport const foo = 2;\n"
}
}
[Trace - 3:09:24 PM] Sending notification 'textDocument/didChange'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts",
"version": 2
},
"contentChanges": [
{
"text": "// abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh\nexport const foo = 2;\n"
}
]
}
[Trace - 3:09:24 PM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh",
"languageId": "cpp",
"version": 1,
"text": "#pragma once\n\n// abcdef abcdef abcdef\nnamespace foo {\n\nvoid Foo();\n\n} // namespace foo\n"
}
}
[Trace - 3:09:24 PM] Sending request 'textDocument/formatting - (2)'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts"
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
[Trace - 3:09:24 PM] Sending request 'textDocument/formatting - (3)'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh"
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
[Trace - 3:09:24 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"diagnostics": [],
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh"
}
[Trace - 3:09:24 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"diagnostics": [],
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts"
}
[Trace - 3:09:25 PM] Received response 'textDocument/formatting - (2)' in 747ms.
Result: [
{
"newText": "// abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh\nexport const foo = 2;\n",
"range": {
"end": {
"character": 4611686018427388000,
"line": 4611686018427388000
},
"start": {
"character": 0,
"line": 0
}
}
}
]
[Trace - 3:09:25 PM] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts"
}
}
[Trace - 3:09:25 PM] Sending notification 'textDocument/didClose'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/hello.ts"
}
}
[Trace - 3:09:25 PM] Received response 'textDocument/formatting - (3)' in 803ms.
Result: [
{
"newText": "#pragma once\n\n// abcdefgh abcdefgh abcdefgh\nnamespace foo {\n\nvoid Foo();\n\n} // namespace foo\n",
"range": {
"end": {
"character": 4611686018427388000,
"line": 4611686018427388000
},
"start": {
"character": 0,
"line": 0
}
}
}
]
[Trace - 3:09:25 PM] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh"
}
}
[Trace - 3:09:25 PM] Sending notification 'textDocument/didClose'.
Params: {
"textDocument": {
"uri": "file:///Users/lauri/work/trunk-format-on-save-bug/foo.hh"
}
}
The repro steps are identical to the one attached in the aforementioned bug.
The extension works correctly - we currently have code to re-order the events in the LSP so that didOpen events are processed after didChange even if they are received after them, but we'd like to remove it as it's hacky. This incorrectly ordered event stream can be observed in the extension output.
We are currently on vscode-languageclient version 8.1.0-next.3 - trunk version 3.3.6.
Thank you very much for your help!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Activity
Fixes #1176: didChange/didOpen appear to be sent out of order for glo…
Merge pull request #1177 from microsoft/dbaeumer/aggressive-junglefow…
dbaeumer commentedon Jan 16, 2023
release client and server @8.1.0-next.6
Let me know how it goes.
laurit17 commentedon Jan 23, 2023
This fixes our issue - thank you so much!
package.json: update vscode-languageclient to 8.1.0