Repository navigation
Fixing compilation errors after platform localization. Some refactoring - #615
Conversation
|
@claude review pr with inline comments |
|
Claude finished @unv-unv's task in 1m 28s —— View job PR review
Overall the migration looks correct. The Inline comments
Not flagged
|
| else if (myDeclaration instanceof CSharpIndexMethodDeclaration indexMethodDecl) { | ||
| return LocalizeValue.of(CSharpElementPresentationUtil.formatMethod(indexMethodDecl, 0)); | ||
| } | ||
| return LocalizeValue.of(myDeclaration.getName()); |
There was a problem hiding this comment.
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:
| return LocalizeValue.of(myDeclaration.getName()); | |
| return LocalizeValue.ofNullable(myDeclaration.getName()); |
| return myDeclaration.getName(); | ||
| } | ||
| @Override | ||
| @RequiredUIAccess |
There was a problem hiding this comment.
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.
| @RequiredUIAccess | |
| @RequiredReadAction |
| } | ||
| } | ||
| @Override | ||
| @RequiredUIAccess |
There was a problem hiding this comment.
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.
| @RequiredUIAccess | |
| @RequiredReadAction |
|
|
||
| ItemPresentation itemPresentation = ItemPresentationProvider.getItemPresentation((NavigationItem) element); | ||
| if (itemPresentation != null) { | ||
| return itemPresentation.getPresentableText().get(); |
There was a problem hiding this comment.
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:
| return itemPresentation.getPresentableText().get(); | |
| String presentableText = itemPresentation.getPresentableText().get(); | |
| if (!presentableText.isEmpty()) { | |
| return presentableText; | |
| } |
73a5995 to
b1b8476
Compare
No description provided.