-
Notifications
You must be signed in to change notification settings - Fork 147
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
(bug) Closed document ownership not transferred back to the filesystem #879
Comments
Spec talks about ownership and that the editor has to send didOpen to take ownership of the document before it can change it: |
I'm a bit confused. I've read those parts of the spec, but I don't know if it explains the inconsistent behavior that occurs when import1.ts has been open - and then closed - on the client vs. when it never has been opened on the client at all. When it's never been opened at all, the imports get updated correctly. However when it's been opened and then closed, suddenly things do not work. Are you saying that prior to running any |
That is the way I understood the spec. If a file is closed |
It feels like there is some distinction being made for files that have programmatic edits triggered by an Here's an example:
import { a } from './export';
import { a } from './mangledimportpath.xyz'
The only difference here between the above edit of a closed file, and this edit of a closed file, is that one was initiated by an |
I've tried it here and it worked fine for me. If you want me to have a look into it then please:
|
I am fairly certain this is a bug, but I would like to confirm my understanding. The expectation I have is not explicitly confirmed or denied in the LSP spec, which is why I'm not 100% sure it's a bug. Here's my expectation that this bug report relies upon:
If a server sends
WorkspaceEdit
s for a file that is not currently open, the client can apply those changes to the file without notifying the server - i.e. not senddidChange
- and rely on the server to watch the filesystem for the changes.^^ If you disagree with this statement, or I have a misunderstanding of the spec, definitely let me know. If you agree with this, read on for the bug report:
Scenario:
export.ts
import1.ts
import2.ts
import1.ts
andimport2.ts
on the client, and send their initial contents to the langauge server.import1.ts
on the client, and send adidClose
notification to the language serverexport.ts
and send aworkspace/willRename
request to the language server. The language server responds with the followingWorkspaceEdit
s:import1.ts
import2.ts
didChange
anddidSave
notifications from the client to the server for import2.ts with the above change.export2.ts
workspace/willRenameFiles
request to the language server. The langauge server responds with the followingWorkspaceEdit
s:At this point it seems good enough to make a bug report, as the above
WorkspaceEdit
is not correct. However, I wanted to add a few more details that led me to believe the root cause specifically is surrounding closed document ownership.Further investigation
didOpen
anddidClose
events for import1.ts - i.e. the file was never opened on the client at all - you will get the correctWorkspaceEdit
results for the secondwillRenameFiles
request.willRenameFiles
from export.ts to export2.ts (for a second time), you will see, once again, import1.ts is included in the list ofWorkspaceEdit
s. This, I assume, I becausetypescript-language-server
still thinks it's open on the client and it's seen no changes since its original version.Attempts to reproduce elsewhere:
tsconfig.json
in the workspace root was required for things to work - but we also have one here)Thanks for bearing with me through the long bug report, please let me know if you have any questions!
The text was updated successfully, but these errors were encountered: