lonami / uniffi-dl Goto Github PK
View Code? Open in Web Editor NEWUnofficial IntelliJ plugin for Mozilla's UniFFI Definition Language (UDL)
Home Page: https://plugins.jetbrains.com/plugin/20527-uniffi-dl
License: Mozilla Public License 2.0
Unofficial IntelliJ plugin for Mozilla's UniFFI Definition Language (UDL)
Home Page: https://plugins.jetbrains.com/plugin/20527-uniffi-dl
License: Mozilla Public License 2.0
Hey Lonami,
First, thanks for taking the time to make this plugin! I'm trying it out for one of my (very early stage) projects, Ferrostar.
Unfortunately it crashes upon loading the UDL file. I've included the IntelliJ (well, CLion) stack trace and the UDL file that reproduces the issue:
Stack trace:
java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiElement.getNode()" because the return value of "com.intellij.psi.PsiElement.getFirstChild()" is null
at dev.lonami.uniffidl.psi.impl.UdlPsiImplUtil.getNameIdentifier(UdlPsiImplUtil.java:128)
at dev.lonami.uniffidl.psi.impl.UdlRegularOperationImpl.getNameIdentifier(UdlRegularOperationImpl.java:44)
at com.intellij.model.psi.impl.PsiElement2Declaration.getIdentifyingElement(PsiElement2Declaration.java:119)
at com.intellij.model.psi.impl.PsiElement2Declaration.getIdentifyingElement(PsiElement2Declaration.java:112)
at com.intellij.model.psi.impl.PsiElement2Declaration.getDeclarationRangeFromPsi(PsiElement2Declaration.java:73)
at com.intellij.model.psi.impl.PsiElement2Declaration.createFromDeclaredPsiElement(PsiElement2Declaration.java:68)
at com.intellij.model.psi.impl.TargetsKt.declarationsOrReferences(targets.kt:126)
at com.intellij.model.psi.impl.TargetsKt.declaredReferencedData(targets.kt:42)
at com.intellij.model.psi.impl.TargetsKt.targetSymbols(targets.kt:24)
at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.getTargetSymbols(IdentifierHighlighterPass.java:202)
at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.highlightReferencesAndDeclarations(IdentifierHighlighterPass.java:194)
at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.doCollectInformation(IdentifierHighlighterPass.java:91)
at com.intellij.codeInsight.highlighting.BackgroundHighlighter.lambda$submitIdentifierHighlighterPass$5(BackgroundHighlighter.java:203)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:746)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:778)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:573)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:537)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1102)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:72)
at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:63)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:129)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:110)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$1(ProgressManager.java:70)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:70)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:107)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:72)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:537)
at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:444)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:833)
UDL:
//
// Namespace to encapsulate top-level functions
//
namespace ferrostar {
RouteRequestGenerator create_valhalla_request_generator(string endpoint_url, string profile);
RouteResponseParser create_osrm_response_parser(u32 polyline_precision);
};
//
// Error types
//
[Error]
enum RoutingRequestGenerationError {
"NotEnoughWaypoints",
"JsonError",
"UnknownError"
};
[Error]
interface RoutingResponseParseError {
ParseError(string error);
UnknownError();
};
//
// Data structures
//
dictionary GeographicCoordinates {
double lat;
double lng;
};
dictionary Course {
double degrees;
double accuracy;
};
dictionary UserLocation {
GeographicCoordinates coordinates;
double horizontal_accuracy;
Course? course;
};
dictionary Route {
sequence<GeographicCoordinates> geometry;
sequence<GeographicCoordinates> waypoints;
};
[Enum]
interface RouteRequest {
HttpPost(string url, record<DOMString, string> headers, sequence<u8> body);
};
//
// Callback interfaces (foreign code can implement these to extend functionality)
//
callback interface RouteRequestGenerator {
[Throws=RoutingRequestGenerationError]
RouteRequest generate_request(sequence<GeographicCoordinates> waypoints);
};
callback interface RouteResponseParser {
[Throws=RoutingResponseParseError]
sequence<Route> parse_response(sequence<u8> response);
};
interface RouteAdapter {
constructor(RouteRequestGenerator request_generator, RouteResponseParser response_parser);
[Name=new_valhalla_http]
constructor(string endpoint_url, string profile);
[Throws=RoutingRequestGenerationError]
RouteRequest generate_request(sequence<GeographicCoordinates> waypoints);
[Throws=RoutingResponseParseError]
sequence<Route> parse_response(sequence<u8> response);
};
interface NavigationController {
constructor(UserLocation last_user_location, Route route);
void update_user_location(UserLocation location);
// TODO: Expose read-only model
};
First of all, thank you for creating this project ๐
I'm experiencing an issue where callback interfaces (like the one that follows) can't be resolved when used as parameters in either top-level functions or interface
methods.
callback interface CallbackXyz {
...
};
Example:
interface ExampleInterface {
constructor(CallbackXyz callback_xyz);
};
CallbackXyz
can't be resolved in this last code snippet.
The plugin has trouble dealing with error interfaces such as the one that follows:
[Error]
interface ExampleError {
ExampleErrorOne(string msg);
ExampleErrorTwo(string msg);
};
Both ExampleErrorOne
and ExampleErrorTwo
get red (can't be resolved) and when
hovering the cursor over them, an exception occurs:
java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiElement.getNode()" because the return value of "com.intellij.psi.PsiElement.getFirstChild()" is null
at dev.lonami.uniffidl.psi.impl.UdlPsiImplUtil.getNameIdentifier(UdlPsiImplUtil.java:128)
at dev.lonami.uniffidl.psi.impl.UdlRegularOperationImpl.getNameIdentifier(UdlRegularOperationImpl.java:44)
at com.intellij.model.psi.impl.PsiElement2Declaration.getIdentifyingElement(PsiElement2Declaration.java:120)
at com.intellij.model.psi.impl.PsiElement2Declaration.getIdentifyingElement(PsiElement2Declaration.java:113)
at com.intellij.model.psi.impl.PsiElement2Declaration.getDeclarationRangeFromPsi(PsiElement2Declaration.java:73)
at com.intellij.model.psi.impl.PsiElement2Declaration.createFromDeclaredPsiElement(PsiElement2Declaration.java:68)
at com.intellij.model.psi.impl.TargetsKt.declarationsOrReferences(targets.kt:124)
at com.intellij.model.psi.impl.TargetsKt.declaredReferencedData(targets.kt:41)
at com.intellij.model.psi.impl.TargetsKt.targetSymbols(targets.kt:23)
at com.intellij.lang.documentation.symbol.impl.DefaultTargetSymbolDocumentationTargetProviderKt.symbolDocumentationTargets(DefaultTargetSymbolDocumentationTargetProvider.kt:24)
at com.intellij.lang.documentation.symbol.impl.DefaultTargetSymbolDocumentationTargetProviderKt.access$symbolDocumentationTargets(DefaultTargetSymbolDocumentationTargetProvider.kt:1)
at com.intellij.lang.documentation.symbol.impl.DefaultTargetSymbolDocumentationTargetProvider.documentationTargets(DefaultTargetSymbolDocumentationTargetProvider.kt:19)
at com.intellij.lang.documentation.impl.ImplKt.documentationTargets(impl.kt:27)
at com.intellij.lang.documentation.ide.impl.IdeDocumentationTargetProviderImpl.documentationTargets(IdeDocumentationTargetProviderImpl.kt:35)
at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$request$1$targets$1.invoke(DocumentationTargetHoverInfo.kt:39)
at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$request$1$targets$1.invoke(DocumentationTargetHoverInfo.kt:39)
at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt.injectedThenHost(DocumentationTargetHoverInfo.kt:76)
at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$request$1.invoke(DocumentationTargetHoverInfo.kt:37)
at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$request$1.invoke(DocumentationTargetHoverInfo.kt:36)
at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:90)
at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:15)
at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$1.invoke(InternalReadAction.kt:74)
at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$1.invoke(InternalReadAction.kt:73)
at com.intellij.openapi.progress.CancellationKt.withCurrentJob$lambda$0(cancellation.kt:17)
at com.intellij.openapi.progress.Cancellation.withCurrentJob(Cancellation.java:60)
at com.intellij.openapi.progress.CancellationKt.withCurrentJob(cancellation.kt:17)
at com.intellij.openapi.progress.CancellationKt.executeWithJobAndCompleteIt(cancellation.kt:125)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$1$lambda$0(cancellableReadAction.kt:49)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1111)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$1(cancellableReadAction.kt:47)
at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:63)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:45)
at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:73)
at com.intellij.openapi.application.rw.InternalReadAction.access$tryReadCancellable(InternalReadAction.kt:15)
at com.intellij.openapi.application.rw.InternalReadAction$tryReadAction$2.invoke(InternalReadAction.kt:59)
at com.intellij.openapi.application.rw.InternalReadAction$tryReadAction$2.invoke(InternalReadAction.kt:54)
at com.intellij.openapi.progress.CancellationKt.withCurrentJob$lambda$0(cancellation.kt:17)
at com.intellij.openapi.progress.Cancellation.withCurrentJob(Cancellation.java:60)
at com.intellij.openapi.progress.CancellationKt.withCurrentJob(cancellation.kt:17)
at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:142)
at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:54)
at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:46)
at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$2.invokeSuspend(InternalReadAction.kt:27)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
I recently upgraded to IntelliJ IDEA version 2023.1 (Build #IU-231.8109.175) and my plugins pane is reporting that the uniffi-dl plugin requires version 223.* or earlier.
Not sure what needs to be done to support the new version of IntelliJ. I'm happy to contribute this just trying to figure out how all this works atm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.