drewhannay
10/11/2024, 6:51 AMFirAnonymousFunction#psi …I’m wondering if there’s a way to do an equivalent check without using `.psi`(or some other way to get around the fact that PsiElement is shaded and therefore needs different artifacts for Gradle vs the IDE)dmitriy.novozhilov
10/11/2024, 7:19 AM{ x -> ...}) from anonymous function (fun (x) {...})
This can be done using plain fir by checking firAnonymousFunction.isLambdadrewhannay
10/11/2024, 7:20 AMdrewhannay
10/11/2024, 7:21 AMPsiElement is very annoying though)dmitriy.novozhilov
10/11/2024, 7:23 AMPsiElement is very annoying though
You can get used to it
I always considered PSI as terrible monstrosity, so it was so nice finally be able to operate something more usefuldrewhannay
10/11/2024, 7:24 AMval MY_ERROR by error0<PsiElement>()dmitriy.novozhilov
10/11/2024, 7:25 AMKtElement (e.g. to avoid obvious casts)drewhannay
10/11/2024, 7:27 AMerror0 and steal the psiType class from some built-in error 😅:
private fun error0(strategy: AbstractSourceElementPositioningStrategy = SourceElementPositioningStrategies.DEFAULT) =
DiagnosticFactory0DelegateProvider(
Severity.ERROR,
strategy,
FirErrors.OTHER_ERROR.psiType,
)dmitriy.novozhilov
10/11/2024, 7:27 AMdmitriy.novozhilov
10/11/2024, 7:29 AMPsiElement class?
You can just use KtElement instead of PsiElement. It is located in org.jetbrains.kotlin package, so it isn't affected by shadingdrewhannay
10/11/2024, 7:30 AMDo I understand correctly that you needed because of shaded/unshaded version ofclass?PsiElement
drewhannay
10/11/2024, 7:30 AMdrewhannay
10/11/2024, 7:31 AMdrewhannay
10/11/2024, 7:31 AMdrewhannay
10/11/2024, 7:33 AMdmitriy.novozhilov
10/11/2024, 7:33 AMdrewhannay
10/11/2024, 7:33 AMDrew Hamilton
12/10/2024, 5:25 PMKtElement doesn’t seem to be working for me—still seeing IDE errors when trying to trigger one of my diagnostics. Is there an example usage I can look at?