eclipse-xtext / eclipse-xtext/xtext
Renaming misses some qualified names in special cases
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
Examine the following DSL structure that is split over three files:
package pack {
extern class foo;
}
class pack.foo {
extern method bar;
}
method pack.foo.bar {
...
}
pack.fooandpack.foo.barare dot separated references to the respective external class or method definition, each defined in another file
When renaming foo or pack via the language server, the fully qualified method reference pack.foo.bar never changes. While debugging the issue I noticed that the framework never notices the fully qualified name should change. It doesn't even pick up the appropriate Resource for the recording mechanism of the ChangeSerializer. However, renaming pack correctly changes the pack.foo external class reference. Meaning, the reason behind this issue is somewhere in the recursive referencing nature of the grammar.
Instead of trying to change anything inside the likes of the ChangeSerializer, we instead opted to override the RenameService. There, we simply added our own code that operated directly on the WorkspaceEdit.
We don't think that this use case needs a fix within the framework. Instead I would like to propose an overridable method that is called after all other renaming changes have been applied. I'll complement this issue with a PR, where discussion about this proposal is appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/rename/RenameService2.java, especially the area around line 142, and trace how ChangeSerializer produces the WorkspaceEdit for qualified references. Reproduce the three-file DSL case while renaming foo or pack. Done means the proposed overridable post-processing hook can apply the missing rename changes without modifying ChangeSerializer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100