Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

didChange event removing all contents when closing window shortly after a change #1577

Open
dotdash opened this issue Aug 26, 2024 · 2 comments

Comments

@dotdash
Copy link
Contributor

dotdash commented Aug 26, 2024

When I change the contents of a buffer and close the last open window containing that buffer within a certain timeframe after that change, vim-lsp sends a didChange event to the LSP server claiming that the whole contents of that file have been removed.

Here's a log of a session of opening vim, opening a file in a split window, adding an empty line and then immediately closing the window using :wq.

Mon 26 Aug 2024 11:05:20 AM CEST:["lsp#register_server","server registered","intelephense"]
Mon 26 Aug 2024 11:05:20 AM CEST:["s:on_text_document_did_open()",2,"php","/tmp/vim-lsp-bug","file:///tmp/vim-lsp-bug/test.php"]
Mon 26 Aug 2024 11:05:20 AM CEST:["Starting server","intelephense",["/home/bsteinbrink/.local/share/vim-lsp-settings/servers/intelephense/intelephense","--stdio"]]
Mon 26 Aug 2024 11:05:20 AM CEST:["using native lsp client"]
Mon 26 Aug 2024 11:05:20 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","lsp_id":1,"server_name":"intelephense"},"message":"started lsp server successfully"}}]
Mon 26 Aug 2024 11:05:20 AM CEST:["--->",1,"intelephense",{"method":"initialize","params":{"rootUri":"file:///tmp/vim-lsp-bug","initializationOptions":{},"capabilities":{"workspace":{"workspaceFolders":false,"configuration":true,"symbol":{"dynamicRegistration":false},"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"callHierarchy":{"dynamicRegistration":false},"rename":{"prepareSupport":true,"dynamicRegistration":false,"prepareSupportDefaultBehavior":1},"codeAction":{"isPreferredSupport":true,"disabledSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["markdown","plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":{"dynamicRegistration":false},"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"semanticTokens":{"serverCancelSupport":false,"requests":{"full":false,"range":false},"multilineTokenSupport":false,"dynamicRegistration":false,"overlappingTokenSupport":false,"tokenTypes":["type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":[],"formats":["relative"]},"signatureHelp":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"/tmp/vim-lsp-bug","clientInfo":{"name":"vim-lsp"},"processId":519951,"trace":"off"}}]
Mon 26 Aug 2024 11:05:20 AM CEST:["s:on_text_document_did_open()",2,"php","/tmp/vim-lsp-bug","file:///tmp/vim-lsp-bug/test.php"]
Mon 26 Aug 2024 11:05:20 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:20 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"waiting for lsp server to initialize"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Initialising intelephense 1.12.2","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Reading state from /tmp/intelephense/29cf2313.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Intelephense premium features enabled.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Initialised in 61 ms","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"request":{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///tmp/vim-lsp-bug","initializationOptions":{},"capabilities":{"workspace":{"workspaceFolders":false,"configuration":true,"symbol":{"dynamicRegistration":false},"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"callHierarchy":{"dynamicRegistration":false},"rename":{"prepareSupport":true,"dynamicRegistration":false,"prepareSupportDefaultBehavior":1},"codeAction":{"isPreferredSupport":true,"disabledSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["markdown","plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":{"dynamicRegistration":false},"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"semanticTokens":{"serverCancelSupport":false,"requests":{"full":false,"range":false},"multilineTokenSupport":false,"dynamicRegistration":false,"overlappingTokenSupport":false,"tokenTypes":["type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":[],"formats":["relative"]},"signatureHelp":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"/tmp/vim-lsp-bug","clientInfo":{"name":"vim-lsp"},"processId":519951,"trace":"off"}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["--->",1,"intelephense",{"method":"initialized","params":{}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["--->",1,"intelephense",{"method":"workspace/didChangeConfiguration","params":{"settings":{"intelephense":{"diagnostics":{"noMixedTypeCheck":false,"relaxedTypeChecks":false},"codeLens":{"parent":{"enable":true},"usages":{"enable":true},"references":{"enable":true},"implementations":{"enable":true},"overrides":{"enable":true}},"phpdoc":{"returnVoid":false}}}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["s:update_file_content()",2]
Mon 26 Aug 2024 11:05:21 AM CEST:["--->",1,"intelephense",{"method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php","version":1,"languageId":"php","text":"<?php\n\necho <<<ASD\nasd\nasd\nas\ndas\ndas\nda\nd\nasd\nas\nd\nasd\nas\ndas\nd\nasd\ns\nd\nasd\nas\n\nasd\nad\nASD;\n"}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["--->",1,"intelephense",{"method":"textDocument/foldingRange","on_notification":"---funcref---","bufnr":2,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}},"sync":0}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","filetype":"php","server_name":"intelephense"},"message":"textDocument/open sent"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---","s:on_request",1,{"id":0,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"intelephense"},{"section":"intelephense","scopeUri":"file:///tmp/vim-lsp-bug"}]}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["--->",1,"intelephense",{"id":0,"result":[{"diagnostics":{"noMixedTypeCheck":false,"relaxedTypeChecks":false},"codeLens":{"parent":{"enable":true},"usages":{"enable":true},"references":{"enable":true},"implementations":{"enable":true},"overrides":{"enable":true}},"phpdoc":{"returnVoid":false}},{"diagnostics":{"noMixedTypeCheck":false,"relaxedTypeChecks":false},"codeLens":{"parent":{"enable":true},"usages":{"enable":true},"references":{"enable":true},"implementations":{"enable":true},"overrides":{"enable":true}},"phpdoc":{"returnVoid":false}}]}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"id":2,"jsonrpc":"2.0","result":[{"startLine":2,"endLine":24}]},"request":{"method":"textDocument/foldingRange","jsonrpc":"2.0","id":2,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Searching file:///home/bsteinbrink/.local/share/vim-lsp-settings/servers/intelephense/node_modules/intelephense/lib/stub for files to index.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Searching file:///tmp/vim-lsp-bug for files to index.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Indexing started.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"indexingStarted","jsonrpc":"2.0","params":[null]}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///tmp/vim-lsp-bug/test.php","diagnostics":[]}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Indexing ended. 133 files indexed in 0s.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"indexingEnded","jsonrpc":"2.0","params":[null]}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Writing state to /tmp/intelephense/29cf2313.","type":3}}}]
Mon 26 Aug 2024 11:05:21 AM CEST:["<---",1,"intelephense",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Wrote state in 0.1s.","type":3}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["s:update_file_content()",2]
Mon 26 Aug 2024 11:05:23 AM CEST:["--->",1,"intelephense",{"method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":2},"start":{"character":0,"line":2}},"text":"\n","rangeLength":0}],"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php","version":2}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["--->",1,"intelephense",{"method":"textDocument/foldingRange","on_notification":"---funcref---","bufnr":2,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}},"sync":0}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"textDocument/didChange sent"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["--->",1,"intelephense",{"method":"textDocument/signatureHelp","on_notification":"---funcref---","params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["--->",1,"intelephense",{"method":"textDocument/signatureHelp","on_notification":"---funcref---","params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["<---",1,"intelephense",{"response":{"id":3,"jsonrpc":"2.0","result":[{"startLine":3,"endLine":25}]},"request":{"method":"textDocument/foldingRange","jsonrpc":"2.0","id":3,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["<---",1,"intelephense",{"response":{"id":4,"jsonrpc":"2.0","result":null},"request":{"method":"textDocument/signatureHelp","jsonrpc":"2.0","id":4,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["<---",1,"intelephense",{"response":{"id":5,"jsonrpc":"2.0","result":null},"request":{"method":"textDocument/signatureHelp","jsonrpc":"2.0","id":5,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}}]
Mon 26 Aug 2024 11:05:23 AM CEST:["s:on_text_document_did_change()",2]
Mon 26 Aug 2024 11:05:23 AM CEST:["s:send_didchange_queue() will be triggered"]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:23 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["--->",1,"intelephense",{"method":"textDocument/documentHighlight","on_notification":"---funcref---","params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["<---",1,"intelephense",{"response":{"id":6,"jsonrpc":"2.0","result":[]},"request":{"method":"textDocument/documentHighlight","jsonrpc":"2.0","id":6,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"},"position":{"character":0,"line":1}}}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["<---",1,"intelephense",{"response":{"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///tmp/vim-lsp-bug/test.php","diagnostics":[]}}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["s:on_text_document_did_save()",2]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["--->",1,"intelephense",{"method":"textDocument/didChange","params":{"contentChanges":[],"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php","version":3}}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["--->",1,"intelephense",{"method":"textDocument/foldingRange","on_notification":"---funcref---","bufnr":2,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}},"sync":0}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"textDocument/didChange sent"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["s:update_file_content()",2]
Mon 26 Aug 2024 11:05:24 AM CEST:["--->",1,"intelephense",{"method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}}}]
Mon 26 Aug 2024 11:05:24 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"textDocument/didSave sent"}}]
Mon 26 Aug 2024 11:05:24 AM CEST:["s:on_text_document_did_close()",2]
Mon 26 Aug 2024 11:05:24 AM CEST:["<---",1,"intelephense",{"response":{"id":7,"jsonrpc":"2.0","result":[{"startLine":3,"endLine":25}]},"request":{"method":"textDocument/foldingRange","jsonrpc":"2.0","id":7,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}}}}]
Mon 26 Aug 2024 11:05:27 AM CEST:["s:send_event_queue()"]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:["s:update_file_content()",2]
Mon 26 Aug 2024 11:05:27 AM CEST:["--->",1,"intelephense",{"method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":0,"line":27},"start":{"character":0,"line":0}},"text":"","rangeLength":94}],"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php","version":4}}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"server already started"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","init_result":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"documentHighlightProvider":true,"hoverProvider":true,"typeDefinitionProvider":true,"workspaceSymbolProvider":true,"referencesProvider":true,"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":2,"implementationProvider":true,"codeLensProvider":{"resolveProvider":true},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"declarationProvider":true,"definitionProvider":true,"documentRangeFormattingProvider":true,"typeHierarchyProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","'","\"","*",".","<"]}}}},"server_name":"intelephense"},"message":"lsp server already initialized"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"__data__":"vim-lsp","server_name":"intelephense"},"message":"configuration sent"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"already opened"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"not dirty"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:["--->",1,"intelephense",{"method":"textDocument/foldingRange","on_notification":"---funcref---","bufnr":2,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}},"sync":0}]
Mon 26 Aug 2024 11:05:27 AM CEST:[{"response":{"data":{"path":"file:///tmp/vim-lsp-bug/test.php","__data__":"vim-lsp","server_name":"intelephense"},"message":"textDocument/didChange sent"}}]
Mon 26 Aug 2024 11:05:27 AM CEST:["<---",1,"intelephense",{"response":{"id":8,"jsonrpc":"2.0","result":[]},"request":{"method":"textDocument/foldingRange","jsonrpc":"2.0","id":8,"params":{"textDocument":{"uri":"file:///tmp/vim-lsp-bug/test.php"}}}}]
Mon 26 Aug 2024 11:05:28 AM CEST:["<---",1,"intelephense",{"response":{"method":"textDocument/publishDiagnostics","jsonrpc":"2.0","params":{"uri":"file:///tmp/vim-lsp-bug/test.php","diagnostics":[]}}}]
Mon 26 Aug 2024 11:05:32 AM CEST:["s:on_text_document_did_close()",1]
@dotdash
Copy link
Contributor Author

dotdash commented Aug 26, 2024

diff --git autoload/lsp.vim autoload/lsp.vim
index dbb9d77..646ea47 100644
--- autoload/lsp.vim
+++ autoload/lsp.vim
@@ -1252,7 +1252,7 @@ endfunction
 function! s:send_didchange_queue(...) abort
     call lsp#log('s:send_event_queue()')
     for l:buf in s:didchange_queue
-        if !bufexists(l:buf)
+        if !bufloaded(l:buf)
             continue
         endif
         for l:server_name in lsp#get_allowed_servers(l:buf)

This seems to fix the issue, but I'm not sure if that's a proper fix. Maybe the events need to be sent on BufUnload instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@dotdash and others