-
For example I have the following code in my language server worker:
How to update text of a Langium document by URI in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @AresEkb, It depends a bit on what the context of the changed document is. Do you want to change a document which is already open in an editor? If so, you should instruct the language client to change the text via the expected notification. The server should not change the text of a document by itself. If the document is not open, you can use a combination of |
Beta Was this translation helpful? Give feedback.
I see, then you should definitively instruct the client to update the document - otherwise the document in the editor and the one in your language server will desync.
You can use
sharedServices.lsp.Connection
to communicate with the client. I believe you should be able to useConnection.workspace.applyEdit
to apply the change on the client.