Skip to content

Fixing compilation errors after platform localization. Some refactoring - #615

Merged
VISTALL merged 1 commit into
consulo:masterfrom
unv-unv:compilation-fix
Oct 12, 2026
Merged

VISTALL merged 1 commit into
consulo:masterfrom
unv-unv:compilation-fix

Conversation

@unv-unv

@unv-unv unv-unv commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@unv-unv

unv-unv commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

@claude review pr with inline comments

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @unv-unv's task in 1m 28s —— View job


PR review

  • Read the context and the diff against origin/master
  • Reviewed the changed files
  • Posted inline comments with one-click suggestions

Overall the migration looks correct. The String → LocalizeValue changes (getPresentableText, getElementDescription), AllIcons → PlatformIconGroup, the switch to pattern-matching instanceof and the reformatting all keep the original logic. I didn't build the project because the platform jars aren't available in this run.

Inline comments

  1. Possible null issue in CSharpElementPresentationProviderBase.java:66: LocalizeValue.of(myDeclaration.getName()) gets a @Nullable name. CSharpNamedTreeElement uses ofNullable for the same case, so I suggest ofNullable here too.
  2. Nit in CSharpElementPresentationProviderBase.java:49: getPresentableText only reads PSI but is marked @RequiredUIAccess, while getIcon in the same class was changed to @RequiredReadAction. I suggest @RequiredReadAction here.
  3. Nit in CSharpNamedTreeElement.java:54: same annotation mismatch. If you apply it, also remove the unused RequiredUIAccess import.
  4. Minor in CSharpFindUsagesProvider.java:167: the assert presentableText != null diagnostic was removed, so an unnamed element now gives an empty node text. I included an optional fallback.

Not flagged

  • In CSharpElementDescriptionProvider the "not handled" result changed from null to LocalizeValue.empty(). This is fine as long as the platform's ElementDescriptionUtil treats an empty value as "no description". I couldn't check this because the platform sources aren't in this checkout.
  • csharp-spellchecker/pom.xml changes only whitespace.

else if (myDeclaration instanceof CSharpIndexMethodDeclaration indexMethodDecl) {
return LocalizeValue.of(CSharpElementPresentationUtil.formatMethod(indexMethodDecl, 0));
}
return LocalizeValue.of(myDeclaration.getName());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getName() is @Nullable on PsiNamedElement, and the old code just returned that null. CSharpNamedTreeElement (same PR) uses LocalizeValue.ofNullable(value.getName()) for the same case. If LocalizeValue.of rejects or mishandles null, this path is also reached from CSharpFindUsagesProvider.getNodeText via getPresentableText().get(). Using ofNullable here keeps the two consistent:

Suggested change
return LocalizeValue.of(myDeclaration.getName());
return LocalizeValue.ofNullable(myDeclaration.getName());

return myDeclaration.getName();
}
@Override
@RequiredUIAccess

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this method only reads PSI (formatMethod / formatTypeWithGenericParameters are @RequiredReadAction), and getIcon() below was switched to @RequiredReadAction in this PR. For consistency (CSharpLambdaTreeElement.getPresentableText already does this), consider using the same annotation here. @RequiredUIAccess is still used by getLocationString, so the import stays.

Suggested change
@RequiredUIAccess
@RequiredReadAction

}
}
@Override
@RequiredUIAccess

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, same as in CSharpLambdaTreeElement: this method only does PSI reads (formatMethod, formatField, formatProperty are @RequiredReadAction), and getChildrenBase above now has @RequiredReadAction. If you apply this, also remove the now-unused consulo.ui.annotation.RequiredUIAccess import.

Suggested change
@RequiredUIAccess
@RequiredReadAction


ItemPresentation itemPresentation = ItemPresentationProvider.getItemPresentation((NavigationItem) element);
if (itemPresentation != null) {
return itemPresentation.getPresentableText().get();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor behaviour change: the old assert presentableText != null : element.getClass().getName() was removed. Now an element with no name silently gives an empty node text. That is probably fine. If you would rather fall through to the DotNetVariable / debugText branches when the text is empty, you could do this:

Suggested change
return itemPresentation.getPresentableText().get();
String presentableText = itemPresentation.getPresentableText().get();
if (!presentableText.isEmpty()) {
return presentableText;
}

@VISTALL
VISTALL merged commit ece21fd into consulo:master Oct 12, 2026
1 check passed
@unv-unv
unv-unv deleted the compilation-fix branch October 12, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants