LSP: Diagnostics get out of sync
During editing of JSON file the diagnostics become out of sync with the real state of the file. Happened before in other servers and files also.
"diagnostics_delay_ms": 2000,
"diagnostics_additional_delay_auto_complete_ms": 1000,
st4000-exploration (b1a1fa79a71d215dde2d6c396b559561feaeef5f).
:: -> LSP-json textDocument/didChange: {'textDocument': {'uri': 'file:///project/template/.lokalise.json', 'version': 6}, 'contentChanges': [{'text': ' "filter_langs": ["bg", "de", "en", "es", "fr", "it", "no", "pl", "pt", "pt_BR"],\n', 'range': {'end': {'character': 0, 'line': 7}, 'start': {'character': 0, 'line': 7}}, 'rangeLength': 0}]}
:: <- LSP-json textDocument/publishDiagnostics: {'diagnostics': [{'message': 'Duplicate object key', 'source': 'json', 'code': 520, 'range': {'end': {'character': 22, 'line': 8}, 'start': {'character': 8, 'line': 8}}, 'severity': 2}, {'message': 'Duplicate object key', 'source': 'json', 'code': 520, 'range': {'end': {'character': 22, 'line': 7}, 'start': {'character': 8, 'line': 7}}, 'severity': 2}], 'uri': 'file:///project/template/.lokalise.json'}
:: -> LSP-json textDocument/didChange: {'textDocument': {'uri': 'file:///project/template/.lokalise.json', 'version': 7}, 'contentChanges': [{'text': '', 'range': {'end': {'character': 0, 'line': 9}, 'start': {'character': 0, 'line': 8}}, 'rangeLength': 86}]}
:: --> LSP-json textDocument/documentColor(10): {'textDocument': {'uri': 'file:///project/template/.lokalise.json'}}
:: <<< LSP-json 10: []
:: <- LSP-json textDocument/publishDiagnostics: {'diagnostics': [], 'uri': 'file:///project/template/.lokalise.json'}

As clear from the log, the last state from the server reported no diagnostics but ST is still showing the one that was reported before that.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (18 by maintainers)
Commits related to this issue
- Fix diagnostics getting out of sync when having diagnostics_delay_ms set Resolves #1198 — committed to sublimelsp/LSP by rchl 4 years ago
- Fix diagnostics getting out of sync when having diagnostics_delay_ms set Resolves #1198 — committed to sublimelsp/LSP by rchl 4 years ago
The two denounced calls would be sequential. In that particular case, the second call is not debounced so it runs before the first one that was debounced.
Right. I don’t see how that particular issue could happen in that case.