clutcher / bh

Issue tracker for Better Highlights Intellij IDEA plugin
7 stars 0 forks source link

Refactor Support #73

Closed mgroth0 closed 7 months ago

mgroth0 commented 10 months ago

I'm sure this is likely a difficult thing to accomplish. But it would be very beneficial if refactoring names of classes and methods were propogated to links through this plugin.

There is a setting in the IDE for including comments and strings in refactors. However, I always have that off as it can have unintended side effects. For example, if you have a member called "the" and refactor it to "them", then every time the word "the" comes up in a comment or string it will be converted to "them".

It would be great if somehow the IDE could recognize links through this plugin as distinct from regular strings and comments.

clutcher commented 10 months ago

@mgroth0 Can you give you particular example? In Java it is working as you described, if you do rename refactor on class it would change name in [[ClassName]] also without search in string/comments checkbox.

mgroth0 commented 10 months ago

@clutcher Sorry for not testing this more thoroughly.

You are correct that this is working in typical cases.

It is not working in the following case:

  1. Create a typical java module (module 1)
  2. Create a kotlin source set
  3. Inside a kotlin file (somefile.kt), write:
    fun globalFunction(){}
  4. Create another typical java module (module 2) with a kotlin source set and kotlin file
  5. There should be no dependencies between these two modules
  6. Create a reference like so in module 2:
    /*[[SomefileKt#globalFunction]]*/
  7. Observe that navigation works correctly
  8. Refactor the name of globalFunction from the declaration in module 1
  9. Observe that the refactor did not properly propogate from the declaration in module 1 to the reference in module 2
clutcher commented 10 months ago

@mgroth0 Thanks for case. By module you mean gradle module? If you will put kotlin files into 1 module rename refactoring will work correctly or also would fail?

mgroth0 commented 10 months ago

By Module, I mean a Gradle subproject (which gets imported to IntelliJ as a an IDE module)

If I take the siutation from above but am within a single module, there is no bug.

clutcher commented 10 months ago

@mgroth0 Looks like some internal bug inside intellij with link resolving. I'll take a look into that more deeply in a month or so. Need to finish UI refactoring firstly.

clutcher commented 9 months ago

@mgroth0 I played around with it and didn't found any issue.

For example, I took repo https://github.com/40CoderPlus/gradle-multi-module-template . Inside api modele in Api class I referenced // [[Core]] from core module, renamed that class and in referenced comment in Api class it also changed.

How exactly you setup multi module project? Maybe something wrong with that setup itself.

clutcher commented 7 months ago

@mgroth0 Is that still relevant?