Skip to content

bug: rename传播问题,xml inner rule加入后,受到间接影响的identifier依然没有被rename #120

Description

@TsukimiRini

为了实现对xml文件中并非直接与java元素link的identifier的rename,我加入了以下rule:

r-xml-inner:
#    hidden: true
    def:
      lang: XML
      file: (&layoutName).xml
      identifier: android:id
      inline:
        identifier: '@+id\/(&name)'
    use:
      lang: XML
      file: (&layoutName).xml
      identifier: "*constraint*"
      inline:
        identifier: '*\/(&name)'

根据这条rule可以在某个例子中得到如下的inner link:

r-xml-inner
def://app/src/main/res/layout/fragment_description.xml[language=FILE]//androidx.core.widget.NestedScrollView/androidx.constraintlayout.widget.ConstraintLayout/ImageView/android:id[language=XML]//@+id\\/detail_select_description_button[language=ANY]
def://app/src/main/res/layout/fragment_description.xml[language=FILE]//androidx.core.widget.NestedScrollView/androidx.constraintlayout.widget.ConstraintLayout/TextView/app:layout_constraintEnd_toStartOf[language=XML]//@+id\\/detail_select_description_button[language=ANY]

其中上面xll中的def方(第一条uri)与一个java元素绑定:

r-dataBinding
def://app/src/main/res/layout/fragment_description.xml[language=FILE]//androidx.core.widget.NestedScrollView/androidx.constraintlayout.widget.ConstraintLayout/ImageView/android:id[language=XML]//@+id\\/detail_select_description_button[language=ANY]
use://app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java[language=FILE]//DescriptionFragment/disableDescriptionSelection/TooltipCompat.setTooltipText/binding.detailSelectDescriptionButton[language=JAVA]

以上行为都在预期之中,但是当我rename这个java元素时,预期的行为应该是inner link中的两个uri都被rename,但事实上只有databinding link中的xml uri被rename了:

def://app/src/main/res/layout/fragment_description.xml[language=FILE]//androidx.core.widget.NestedScrollView/androidx.constraintlayout.widget.ConstraintLayout/ImageView/android:id[language=XML]//@+id\\/detail_select_description_button[language=ANY]
def://app/src/main/res/layout/fragment_description.xml[language=FILE]//androidx.core.widget.NestedScrollView/androidx.constraintlayout.widget.ConstraintLayout/ImageView/android:id[language=XML]//@+id\\/detailedSelectDescriptionButton[language=ANY]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions