Semantic Modifications in different Resources (LSP) #3325
Replies: 2 comments 15 replies
-
i dont know any details here but did you check what the rename refactoring does? |
Beta Was this translation helpful? Give feedback.
-
The rename service seems to work quite a bit differently, but ultimately prepares the changes first and then adds a modification for each resource. The rename service has a pretty similar piece of code for the change serialization: However the This essentially adds a modification for each resource. So in that case, it has a clear code path on how modifications for multiple resources are added to the |
Beta Was this translation helpful? Give feedback.
-
Hi, I hope this is the correct place to ask this after the forum shut down.
If not, I'll gladly move this somewhere else.
We're currently implementing some quickfix for our LSP server. Essentially, we just want to add a new line in another file.
After implementing, however, I've found, that it won't allow me to change any resources outside of the one in which the quickfix gets triggered.
After looking into the code a bit, I think the following code is the one that actually creates the changes:
xtext/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/quickfix/DiagnosticResolution.java
Lines 122 to 144 in 57c1890
In here I can see that, indeed, it only seems to care about the current resource.
Both in the TextEdit case, where it definitely only accepts TextEdits for the current resource, but even in the
modification
path, it seems to me, like only that one resource is looked at.At least the way I read the
ChangeSerializer
code, it looks like it only cares about the resources of the objects directly given to it (so again only the original resource).It does seem to correctly apply changes in other resources as long as they are handled by Xtext (e.g.
namedElement.setName("foobar")
), but not when I manually go into these other resources and change the AST.So I guess my question is, how is it intended for quickfixes to create changes in other files/resources?
Beta Was this translation helpful? Give feedback.
All reactions