Repository navigation
Add support for resource operations in WorkspaceEdit - #2907
Conversation
|
There is also a markdown server that supports creating files via a code action #2499 (comment) I try to test with intelephense(pro) this weekend. |
|
When we create/rename/delete files, And then notifications: |
I wondered the same, but I would assume that we only need to send these request/notifications if the create/rename/delete is caused by a user action. Otherwise maybe this could even lead to an infinite loop (?) I think what we need to do in case of a rename resource operation is, that we need to send a |
Worked nicely with that use case |
Co-authored-by: RafaΕ ChΕodnicki <rchl2k@gmail.com>
Co-authored-by: RafaΕ ChΕodnicki <rchl2k@gmail.com>
|
I tested with LSP-marksman as well. When I click the create file code action, Sublime.Text.mp4If we send the notification, the server will remove that diagnostic. (I hit the same error when I playing around with resources operations in https://github.com/sublimelsp/LSP/tree/resource-operations-wip - I will delete this branch, I just pushed the changes so you can take a look) |
|
Thanks for testing! Ok I will add the notifications. Regarding the blue modified file indicator, I assume that is out of our control and depends on ST itself (?) But I can also not really tell from the video whether you manually save the file after the rename... or otherwise I would expect that the file is still in a modified state after the rename (because the file content on disk was copied into the other file location, but there was no save after the content change), and therefore the blue indicator shouldn't go away. But I might be wrong because I have not tested it. |
I forgot to mention, I am not the one who is pressing save. |
Oh, that makes sense. But yeah, I think this is out of our control and depends on ST (perhaps it takes a bit for ST to react due to the |
|
I will tinker a bit with the code. I have one assumption now... |
β Deploy Preview for sublime-lsp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I have implemented the Edit: I have not implemented these notifications for the MockManager class from Line 30 in 7313cec so I assume they won't be sent during the unit tests. |
|
By the way, what happens if someone has also installed LSP-file-watcher-chokidar - will there be additional notifications triggered by that when a file in the workspace gets created or deleted? Edit: I guess I can answer myself; according to the readme https://github.com/sublimelsp/LSP-file-watcher-chokidar#usage the file watcher seems only be relevant for Edit 2: The description in the specs at https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#workspace_didChangeWatchedFiles for |
Do you still want to test this, or should we merge this PR and if we find some improvements we can do that later? |
Merge would be fine. I will try to revisit the issue that I reported, once I dedicate more time to LSP. Janos, can you just confirm that this part of the spec is present in the PR - "execute the operations in the order in which they are provided"
|
Yes, we should handle it correctly with this implementation. This is the why it is implemented as such an ugly recursive function, because we need to chain the next Promise after each operation (or stop as soon as there is a failure). |
|
Thanks, works like a charm using lsp intelephense β€οΈ |

Resolves #2706
I haven't tested in practice, but provided that tests are passing, I think it should be working.
Iirc the PHP server wanted to use resource operations, so feel free to test with that (or with another server if you know one that uses resource operations).
Edit: According to sublimelsp/LSP-intelephense#112, testing with the PHP server would require a licensed version of that server. But it looks like there is also a code action in rust-analyzer that wants to use this: sublimelsp/LSP-rust-analyzer#119