Open msujew opened 3 years ago
Not sure about the semantics of your language and how your references are implemented, but if find-references finds the usages of pack
in pack.foo
, it should certainly rename these, too.
References are implemented via these rules:
ExternalMethodImplementation:
'method' method=[Method|QualifiedName] ...
QualifiedName:
ID ('.' ID)*;
When searching for references of pack
, only itself appears. When searching for foo
only its definition as well as its reference class pack.foo
appears. This is expected, as pack.foo.bar
is only a qualified name, and not an actual reference to any package
or class
rule. Hence the issue of it not being picked up by the ChangeSerializer
.
Examine the following DSL structure that is split over three files:
When renaming
foo
orpack
via the language server, the fully qualified method referencepack.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 appropriateResource
for the recording mechanism of theChangeSerializer
. However, renamingpack
correctly changes thepack.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 theWorkspaceEdit
.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.