File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1296,6 +1296,14 @@ func (ls *INOLanguageServer) ino2cppTextDocumentItem(logger jsonrpc.FunctionLogg
12961296}
12971297
12981298func (ls * INOLanguageServer ) didChange (logger jsonrpc.FunctionLogger , inoDidChangeParams * lsp.DidChangeTextDocumentParams ) (* lsp.DidChangeTextDocumentParams , error ) {
1299+ // Clear all RangeLengths: it's a deprecated field and if the byte count is wrong the
1300+ // source text file will be unloaded from clangd without notice, leading to a "non-added
1301+ // docuemtn" error for all subsequent requests.
1302+ // https://github.com/clangd/clangd/issues/717#issuecomment-793220007
1303+ for i := range inoDidChangeParams .ContentChanges {
1304+ inoDidChangeParams .ContentChanges [i ].RangeLength = nil
1305+ }
1306+
12991307 inoDoc := inoDidChangeParams .TextDocument
13001308
13011309 // Apply the change to the tracked sketch file.
You can’t perform that action at this time.
0 commit comments