[auto-generated:-2124044999] Com.tang.intellij.lua.project.LuaSourceRootManager Requested As A Service, But It Is A Component - Convert It To A Service Or Change Call To Project.getComponent() [Plugin: Com.tang]
EmmyLua Plugin Issue: com.tang.intellij.lua.project.LuaSourceRootManager Requested as a Service
The EmmyLua plugin is a popular choice for developers working with the Lua programming language in IntelliJ IDEA. However, users have reported an issue where the plugin's LuaSourceRootManager is requested as a service, but it is a component. This article will delve into the details of this issue and provide a solution to resolve it.
The error message indicates that the com.tang.intellij.lua.project.LuaSourceRootManager is requested as a service, but it is a component. This means that the plugin is trying to access the LuaSourceRootManager as a service, but it is actually a component. This can cause issues with the plugin's functionality and may lead to errors.
The stacktrace provided is a detailed report of the error that occurred. It shows the sequence of events that led to the error and the classes involved. By analyzing the stacktrace, we can identify the root cause of the issue.
com.intellij.diagnostic.PluginException: com.tang.intellij.lua.project.LuaSourceRootManager requested as a service, but it is a component - convert it to a service or change call to project.getComponent() [Plugin: com.tang]
at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:90)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:769)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:696)
at com.tang.intellij.lua.project.LuaSourceRootManager$Companion.getInstance(LuaSourceRootManager.kt:40)
at com.tang.intellij.lua.ext.LuaFileSourcesRootResolver.find(LuaFileSourcesRootResolver.kt:26)
at com.tang.intellij.lua.ext.ILuaFileResolver$Companion.findLuaFile(ILuaFileResolver.kt:29)
at com.tang.intellij.lua.psi.LuaFileUtil.findFile(LuaFileUtil.kt:89)
at com.tang.intellij.lua.psi.LuaPsiResolveUtilKt.resolveRequireFile(LuaPsiResolveUtil.kt:178)
at com.tang.intellij.lua.ty.ExpressionsKt.infer(Expressions.kt:181)
at com.tang.intellij.lua.ty.ExpressionsKt.inferExprInner(Expressions.kt:50)
at com.tang.intellij.lua.ty.ExpressionsKt.inferExpr(Expressions.kt:43)
at com.tang.intellij.lua.ty.DeclarationsKt.inferInner(Declarations.kt:42)
at com.tang.intellij.lua.ty.LuaTypeInfer.inferType(LuaTypeInfer.kt:25)
at com.tang.intellij.lua.ext.ILuaTypeInfer$Companion.infer(ILuaTypeInfer.kt:33)
at com.tang.intellij.lua.search.SearchContext.inferAndCache(SearchContext.kt:176)
at com.tang.intellij.lua.search.SearchContext.access$inferAndCache(SearchContext.kt:35)
at com.tang.intellij.lua.search.SearchContext$Companion.infer$lambda$1(SearchContext.kt:58)
at com.tang.intellij.lua.search.SearchContext$Companion.withContext.kt:70)
at com.tang.intellij.lua.search.SearchContext$Companion.infer(SearchContext.kt:58)
at com.tang.intellij.lua.psi.LuaTypeGuessable.guessType(LuaTypeGuessable.java:29)
at com.tang.intellij.lua.psi.LuaPsiImplUtilKt.guessParentType(LuaPsiImplUtil.kt:262)
at com.tang.intellij.lua.psi.impl.LuaIndexExprImpl.guessParentType(LuaIndexExprImpl.java:93)
at com.tang.intellij.lua.psi.LuaPsiResolveUtilKt.resolve(LuaPsiResolveUtil.kt:148)
at com.tang.intellij.lua.psi.LuaPsiResolveUtilKt.resolve(LuaPsiResolveUtil.kt:144)
at com.tang.intellij.lua.reference.LuaIndexReference.resolve(LuaIndexReference.kt:56)
at com.tang.intellij.lua.reference.LuaIndexReference.resolve(LuaIndexReference.kt:52)
at com.tang.intellij.lua.codeInsight.LuaLineMarkerProvider.collectNavigationMarkers(LuaLineMarkerProvider.kt:148)
at com.tang.intellij.lua.codeInsight.LuaLineMarkerProvider.collectSlowLineMarkersExt(LuaLineMarkerProvider.kt:200)
at com.intellij.codeInsight.daemon.AbstractLineMarkerProvider.collectSlowLineMarkers(AbstractLineMarkerProvider.kt:23)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:226)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$queryLineMarkersForInjected$8(LineMarkersPass.java:266)
at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.probeElementsUpInner(InjectedLanguageUtilBase.java:252)
at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.lambda$probeElementsUp$0(InjectedLanguageUtilBase.java:218)
at com.intellij.openapi.application.impl.ReadActionCacheImpl$allowInWriteAction$1.invoke(ReadActionCacheImpl.kt:41)
at com.intellij.openapi.application.impl.ReadActionCacheImpl$allowInWriteAction$1.invoke(ReadActionCacheImpl.kt:41)
at com.intellij.openapi.application.impl.ReadActionCacheImpl.allowInWriteAction(ReadActionCacheImpl.kt:29)
at com.intellij.openapi.application.impl.ReadActionCacheImpl.allowInWriteAction(ReadActionCacheImpl.kt:41)
at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.probeElementsUp(InjectedLanguageUtilBase.java:217)
at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:160)
at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.enumerateEx(InjectedLanguageManagerImpl.java:381)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryLineMarkersForInjected(LineMarkersPass.java:258)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:217)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectMarkers$2(LineMarkersPass.java:110)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:96)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectMarkers(LineMarkersPass.java:106)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java79)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:435)
at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:28)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:431)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction$lambda$11(AnyThreadWriteThreadingSupport.kt:522)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWithTemporaryThreadLocal(AnyThreadWriteThreadingSupport.kt:204)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:522)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1064)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$4(PassExecutorService.java:421)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:680)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:755)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:711)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:77)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:420)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:395)
at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.cacheFileTypesInside(FileTypeManagerImpl.java:834)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$1(PassExecutorService.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:197)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:393)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:267)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
To resolve this issue, you need to convert the LuaSourceRootManager to a
Q&A: Resolving the EmmyLua Plugin Issue
A: The EmmyLua plugin issue is a problem where the plugin's LuaSourceRootManager is requested as a service, but it is a component. This can cause issues with the plugin's functionality and may lead to errors.
A: The root cause of the issue is that the LuaSourceRootManager is being requested as a service, but it is actually a component. This is because the plugin is trying to access the LuaSourceRootManager as a service, but it is not registered as a service.
A: To resolve the issue, you need to convert the LuaSourceRootManager to a service or change the call to project.getComponent() to project.getService(). This will allow the plugin to access the LuaSourceRootManager correctly.
A: To convert the LuaSourceRootManager to a service, you need to follow these steps:
- Create a new class that extends the Service class.
- In the new class, create a method that returns the LuaSourceRootManager instance.
- Register the new class as a service in the plugin's configuration file.
- Update the plugin's code to use the new service instead of the component.
A: Converting the LuaSourceRootManager to a service has several benefits, including:
- Improved plugin functionality: By converting the LuaSourceRootManager to a service, you can improve the plugin's functionality and reduce the risk of errors.
- Easier maintenance: Converting the LuaSourceRootManager to a service makes it easier to maintain and update the plugin.
- Better performance: Converting the LuaSourceRootManager to a service can improve the plugin's performance by reducing the number of components that need to be loaded.
A: When resolving the issue, there are several common mistakes to avoid, including:
- Not converting the LuaSourceRootManager to a service: Failing to convert the LuaSourceRootManager to a service can cause the issue to persist.
- Not updating the plugin's code: Failing to update the plugin's code to use the new service can cause the issue to persist.
- Not registering the new service: Failing to register the new service in the plugin's configuration file can cause the issue to persist.
A: To prevent the issue from occurring in the future, you can follow these best practices:
- Always convert components to services: When creating a new plugin or updating an existing one, always convert components to services.
- Use the correct method to access services: Always use the correct method to access services, such as project.getService().
- Register services correctly: Always register services correctly in the plugin's configuration file.
By following these best practices and avoiding common mistakes, you can prevent the issue occurring in the future and ensure that your plugin functions correctly.