Send a minimal text edit over LSP
commit1ccb15e77fb52ba737513972fa61d480b5d05203
authorWilfred Hughes <wilfred@fb.com>
Tue, 8 Mar 2022 22:16:25 +0000 (8 14:16 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 8 Mar 2022 22:16:25 +0000 (8 14:16 -0800)
tree7b11fc1a8e2add68e85b42521f6e32ddcbe393e9
parentf76de01538d428c0cf40ed5fe5b640981d309bd6
Send a minimal text edit over LSP

Summary:
VS Code does not try to preserve the cursor position when you modify a large amount of text. We seem to exceed this limit on files that are >3000 LOC or >96 KiB. This is frustrating for users: their cursor jumps to the beginning/end of a file when they save.

Don't send unchanged lines in the LSP text edit. This means that we send much smaller responses and VS Code still preserves cursor position.

Reviewed By: ljw1004

Differential Revision: D34590469

fbshipit-source-id: 2a4d40b4644a865779d02ff23efeb14e35ec564e
hphp/hack/src/server/serverFormat.ml
hphp/hack/test/integration/test_lsp.py