开发者社区 > 通义灵码 > AI编码助手 > 正文

通义灵码插件Android Studio开发Flutter报错无法加载模板

通义灵码插件Android Studio开发Flutter报错无法加载模板

系统信息

通义灵码插件:1.2.9
AS版本:Android Studio Iguana | 2023.2.1 Patch 1 Build #AI-232.10300.40.2321.11567975
Windows 11.0

报错提示

  Error in liveTemplateContext with ID 'DART_TOPLEVEL', base liveTemplateContext is not registered plugin.xml

  com.intellij.codeInsight.template.LiveTemplateContextNotFoundException: Unable to find LiveTemplateContext with class class com.jetbrains.lang.dart.ide.template.DartTemplateContextType$Generic
at com.intellij.codeInsight.template.LiveTemplateContextService.getTemplateContextType(LiveTemplateContextService.java:77)
at com.intellij.codeInsight.template.TemplateContextType.lambda$new$0(TemplateContextType.java:49)
at com.intellij.util.concurrency.SynchronizedClearableLazy._get_value_$lambda$1$lambda$0(SynchronizedClearableLazy.kt:41)
at java.base/java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:210)
at com.intellij.util.concurrency.SynchronizedClearableLazy.getValue(SynchronizedClearableLazy.kt:40)
at com.intellij.codeInsight.template.TemplateContextType.getBaseContextType(TemplateContextType.java:112)
at com.intellij.codeInsight.template.LiveTemplateContextBean.getBaseContextId(LiveTemplateContextBean.java:47)
at com.intellij.codeInsight.template.impl.TemplateContext.isEnabledNoSync(TemplateContext.java:75)
at com.intellij.codeInsight.template.impl.TemplateContext.isEnabled(TemplateContext.java:65)
at com.intellij.codeInsight.template.impl.TemplateContext.isDisabledByInheritance(TemplateContext.java:146)
at com.intellij.codeInsight.template.impl.TemplateContext.makeInheritanceExplicit(TemplateContext.java:137)
at com.intellij.codeInsight.template.impl.TemplateContext.readTemplateContext(TemplateContext.java:122)
at com.intellij.codeInsight.template.impl.TemplateSettings.readTemplateFromElement(TemplateSettings.java:736)
at com.intellij.codeInsight.template.impl.TemplateSettings.parseTemplateGroup(TemplateSettings.java:624)
at com.intellij.codeInsight.template.impl.TemplateSettings$1.readScheme(TemplateSettings.java:202)
at com.intellij.codeInsight.template.impl.TemplateSettings$1.readScheme(TemplateSettings.java:198)
at com.intellij.configurationStore.schemeManager.SchemeLoader.loadScheme(schemeLoader.kt:193)
at com.intellij.configurationStore.schemeManager.SchemeManagerImpl.loadSchemes(SchemeManagerImpl.kt:261)
at com.intellij.codeInsight.template.impl.TemplateSettings.<init>(TemplateSettings.java:283)
at com.intellij.codeInsight.template.impl.TemplateSettings.<init>(TemplateSettings.java:193)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:63)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:1011)
at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:47)
at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:43)
at com.intellij.serviceContainer.BaseComponentAdapter.doCreateInstance(BaseComponentAdapter.kt:158)
at com.intellij.serviceContainer.BaseComponentAdapter.createInstance(BaseComponentAdapter.kt:137)
at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:94)
at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:676)
at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:630)
at com.intellij.codeInsight.template.impl.TemplateSettings.getInstance(TemplateSettings.java:307)
at com.alibabacloud.intellij.cosy.completion.template.TemplateSettingLoader.run(TemplateSettingLoader.java:72)
at com.alibabacloud.intellij.cosy.listener.MultiLangCosyProjectManagerListener.projectOpened(MultiLangCosyProjectManagerListener.java:36)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:699)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:663)
at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:491)
at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:279)
at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:448)
at jdk.proxy1/jdk.proxy1.$Proxy97.projectOpened(Unknown Source)
at com.intellij.openapi.project.impl.ProjectManagerImplKt$runInitProjectActivities$2$invokeSuspend$$inlined$useWithScope2$1.invokeSuspend(trace.kt:121)
at com.intellij.openapi.project.impl.ProjectManagerImplKt$runInitProjectActivities$2$invokeSuspend$$inlined$useWithScope2$1.invoke(trace.kt)
at com.intellij.openapi.project.impl.ProjectManagerImplKt$runInitProjectActivities$2$invokeSuspend$$inlined$useWithScope2$1.invoke(trace.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at com.intellij.openapi.project.impl.ProjectManagerImplKt$runInitProjectActivities$2.invokeSuspend(ProjectManagerImpl.kt:1386)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:43)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:690)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:593)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:997)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:997)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

通义灵码解释

这个错误信息表明在Android Studio编辑器中,尝试加载或初始化一个与Dart相关的模板(Live Template)时遇到了问题。具体来说,插件试图获取DartTemplateContextType.Generic类型的LiveTemplateContext实例,但在注册的plugin.xml文件中没有找到相应的基础上下文。

LiveTemplateContext是在创建和应用代码模板时用于确定模板适用范围的上下文类型。在这个案例中,Dart插件可能缺少对某种特定顶级上下文的支持,导致无法正确解析或加载模板设置。

展开
收起
Maicarons-16379 2024-04-16 09:32:29 139 0
0 条回答
写回答
取消 提交回答

基于通义大模型的 AI 编码辅助工具,支持代码智能生成、单元测试生成、问题排查、研发智能问答等功能,为开发者带来高效、流畅的编码体验。

热门讨论

热门文章

相关电子书

更多
基于flutter的产品应用实践 立即下载
《Flutter in action》 立即下载
闲鱼《Flutter 技术解析与实战》 立即下载