Linking C# symbols to TypeScript symbols to improve refactoring

Hello,

In my Rider solution I have C# and Angular projects (back-end & front-end), where C# classes are being translated to TS classes, either manually or automatically. 


I'd like to somehow link C# class, property and method names to TypeScript class, property and method names so that when I rename a specific C# symbol, the refactoring would also apply to my Angular project. Referencing could be done with XML comments, for example.

If this feature doesn't exist, would it be possible to make a plugin that would do this?
To listen to a rename event and then rename something else in TS?

Thanks for the help.

 

 

3 comments
Comment actions Permalink

It may not be the solution you're looking for but what I do for this is to create a small DSL that can generate both TypeScript and C# POCO classes. This becomes my "data transfer" model. I then also have a separate C# data model (EF) and TS data model and write conversions from and to the data transfer model from and to the C# and TS data models. This ensures that the TS model must match the data transfer model, and the same for the C# model, and as well I only have to change 1 thing (the DSL scripts) to modify the data transfer model on both sides at the same time. If anything doesn't fit together it won't compile and the DSL ensures that both sides of the DT model match.

0
Comment actions Permalink

Thanks for the suggestion, but what I want is to take advantage of editor refactoring, i.e. update every reference of the specific symbol, after changing it's name. Simple change "on disk" of the class file will not refactor other source files.

0
Comment actions Permalink

Hi Illusive7man

Such a feature doesn't exist. I can't say if it is technically possible, but if yes the best way for implementing it would be to develop a plugin.

There are a lot of articles and tutorials about how to develop IntelliJ plugins:
Rider sample plugin;
An article about Rider Frontend plugin development;
Creating Your First Plugin.

Here is a link to Rider plugin collection. Moreover, we have a slack channel #dotnet-pluginwriters where our plugin writers can ask Rider/R#/IJ developers. Just let me know if you want to be added there.

Feel free to ask any questions. Have a great day!

0

Please sign in to leave a comment.