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'}

Screenshot 2020-07-20 at 12 53 10

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

Most upvoted comments

debouncing f at time t1 and debouncing f at time t2 might result in the second f being called earlier, if that makes sense

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.

But @ayoub-benali notes that his diagnostics_delay_ms setting is zero, so that puzzles me a bit.

Right. I don’t see how that particular issue could happen in that case.