我最近将 intelliJ 从 2018 年的版本更新到当前版本,现在,检查语法突出显示很不稳定。
当我开始输入某些内容(例如作业)时,我会在开始时收到检查警告。
field.value =
结果是
Expression statement is not an assignment or call
,这是显而易见的,因为我还没有完成作业的输入。
但是,当我完成输入作业时,检查无法识别出这是一个有效的作业,并且语法突出显示也不会消失。
如果我只是突出显示检查的部分 (
field.value
),然后将其剪掉并立即粘贴回去,IntelliJ 会将其识别为正确编写的内容,并且语法突出显示会消失。
上面的例子是使用 javascript 的,但是这种情况发生在所有的事情上。到处。我的整个项目中不断出现不正确、过时的语法突出显示,需要将其剪切并粘贴回来才能正确显示。
这是在我键入字符串时检查字符串中“拼写错误”单词的触发的另一个示例:
单词已完成,语法高亮仍然显示单词开头有错误。
我之前使用的旧版本 IntelliJ 并非如此。
我尝试过“使缓存无效/重新启动”,这将消除语法突出显示中的当前错误,但不会阻止新错误的出现。
这可能是什么问题?如何强制 IntelliJ 自动重新评估其语法突出显示?我该如何解决这个问题?
更新
基于评论中的请求以及来自
idea.log
的日志:
2020-10-19 12:39:15,589 [12546211] ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 2020.2.3 Build #IU-202.7660.26
2020-10-19 12:39:15,589 [12546211] ERROR - aemon.impl.PassExecutorService - JDK: 11.0.8; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2020-10-19 12:39:15,590 [12546212] ERROR - aemon.impl.PassExecutorService - OS: Windows 10
2020-10-19 12:39:15,591 [12546213] ERROR - aemon.impl.PassExecutorService - Last Action: EditorUp
2020-10-19 12:39:15,591 [12546213] ERROR - aemon.impl.PassExecutorService - Invalid range specified: (5, 1);
java.lang.IllegalArgumentException: Invalid range specified: (5, 1);
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:221)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:216)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:212)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:40)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:29)
at com.intellij.psi.util.PartiallyKnownString$mapRangeToHostRange$1.invoke(PartiallyKnownString.kt:189)
at com.intellij.psi.util.PartiallyKnownString.mapRangeToHostRange(PartiallyKnownString.kt:213)
at com.intellij.psi.util.PartiallyKnownString$split$2$2.invoke(PartiallyKnownString.kt:130)
at com.intellij.psi.util.PartiallyKnownString$split$2.invoke(PartiallyKnownString.kt:156)
at com.intellij.psi.util.PartiallyKnownString.split(PartiallyKnownString.kt:166)
at com.intellij.microservices.url.references.UrlPksParser.splitUrlPath(UrlPksParser.kt:129)
at com.intellij.microservices.url.references.UrlPksParser.parseFullUrl(UrlPksParser.kt:62)
at com.intellij.microservices.url.references.UrlPathReferenceInjector.buildFullUrlReference(UrlPathReferenceInjector.kt:67)
at com.intellij.javascript.microservices.JSUrlPathReferenceProvider.getReferencesByElement(JSUrlPathReferenceProvider.kt:17)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:202)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:165)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:145)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.lambda$getReferencesFromProviders$0(ReferenceProvidersRegistry.java:40)
at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:153)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:112)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:76)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:150)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:120)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:39)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:32)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.createRefs(JSLiteralExpressionImpl.java:103)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.lambda$static$0(JSLiteralExpressionImpl.java:78)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:46)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:112)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:35)
at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:81)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.getReferences(JSLiteralExpressionImpl.java:88)
at com.jetbrains.nodejs.codeInsight.NodeCoreCodingAssistanceInspection.handleFileReferenceHolder(NodeCoreCodingAssistanceInspection.java:50)
at com.jetbrains.nodejs.codeInsight.NodeCoreCodingAssistanceInspection.access$000(NodeCoreCodingAssistanceInspection.java:24)
at com.jetbrains.nodejs.codeInsight.NodeCoreCodingAssistanceInspection$1.visitJSLiteralExpression(NodeCoreCodingAssistanceInspection.java:39)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.accept(JSLiteralExpressionImpl.java:128)
at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:65)
at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:56)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.runToolOnElements(LocalInspectionsPass.java:296)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$3(LocalInspectionsPass.java:265)
at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:155)
at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:147)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$4(LocalInspectionsPass.java:264)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:126)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:115)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitPriorityElementsAndInit$5(LocalInspectionsPass.java:264)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:162)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:117)
at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2020-10-19 12:39:15,592 [12546214] ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 2020.2.3 Build #IU-202.7660.26
2020-10-19 12:39:15,592 [12546214] ERROR - aemon.impl.PassExecutorService - JDK: 11.0.8; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2020-10-19 12:39:15,592 [12546214] ERROR - aemon.impl.PassExecutorService - OS: Windows 10
2020-10-19 12:39:15,592 [12546214] ERROR - aemon.impl.PassExecutorService - Last Action: EditorUp
2020-10-19 12:39:19,268 [12549890] INFO - re.component.SaveActionManager - [+] Start SaveActionManager#beforeAllDocumentsSaving
2020-10-19 12:39:19,268 [12549890] INFO - re.component.SaveActionManager - Locating psi files for 0 documents: []
2020-10-19 12:39:19,268 [12549890] INFO - re.component.SaveActionManager - End SaveActionManager#beforeAllDocumentsSaving
2020-10-19 12:39:19,809 [12550431] INFO - rationStore.ComponentStoreImpl - Saving Project(name=parent, containerState=ACTIVE, componentStore=C:\Projects\xxxxxxx)RunManager took 15 ms
2020-10-19 12:39:22,061 [12552683] INFO - .clearcut.ClearcutLogScheduler - Flushing logs.
2020-10-19 12:39:22,061 [12552683] INFO - .clearcut.ClearcutLogScheduler - Scheduling next log flush in 60000 ms.
2020-10-19 12:40:00,335 [12590957] INFO - j.ide.actions.RevealFileAction - Exit code 1
2020-10-19 12:40:00,608 [12591230] INFO - re.component.SaveActionManager - [+] Start SaveActionManager#beforeAllDocumentsSaving
2020-10-19 12:40:00,608 [12591230] INFO - re.component.SaveActionManager - Locating psi files for 0 documents: []
2020-10-19 12:40:00,608 [12591230] INFO - re.component.SaveActionManager - End SaveActionManager#beforeAllDocumentsSaving
2020-10-19 12:40:01,085 [12591707] INFO - rationStore.ComponentStoreImpl - Saving Project(name=parent, containerState=ACTIVE, componentStore=C:\Projects\xxxxxxx)ArquillianContainersManager took 29 ms, RunManager took 12 ms
这让我相信
SaveActionManager
有问题......进一步调查。
更新2:
删除了
SaveActionManager
插件并重新启动,这并没有解决问题,但是,它导致了一个更直接的错误,特别是在我当前正在编辑并直接处理语法突出显示的文件中:
2020-10-19 12:50:45,329 [ 122921] INFO - ramework.JobViewEditorProvider - start JobViewEditorProvider
2020-10-19 12:50:49,237 [ 126829] ERROR - n.impl.GeneralHighlightingPass - In file: file://C:/Projects/xxxxxx/automation-test/cypress/integration/050-environments/140-xxxxxx.spec.js
java.lang.IllegalArgumentException: Invalid range specified: (5, 1);
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:221)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:216)
at com.intellij.openapi.util.TextRange.assertProperRange(TextRange.java:212)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:40)
at com.intellij.openapi.util.TextRange.<init>(TextRange.java:29)
at com.intellij.psi.util.PartiallyKnownString$mapRangeToHostRange$1.invoke(PartiallyKnownString.kt:189)
at com.intellij.psi.util.PartiallyKnownString.mapRangeToHostRange(PartiallyKnownString.kt:213)
at com.intellij.psi.util.PartiallyKnownString$split$2$2.invoke(PartiallyKnownString.kt:130)
at com.intellij.psi.util.PartiallyKnownString$split$2.invoke(PartiallyKnownString.kt:156)
at com.intellij.psi.util.PartiallyKnownString.split(PartiallyKnownString.kt:166)
at com.intellij.microservices.url.references.UrlPksParser.splitUrlPath(UrlPksParser.kt:129)
at com.intellij.microservices.url.references.UrlPksParser.parseFullUrl(UrlPksParser.kt:62)
at com.intellij.microservices.url.references.UrlPathReferenceInjector.buildFullUrlReference(UrlPathReferenceInjector.kt:67)
at com.intellij.javascript.microservices.JSUrlPathReferenceProvider.getReferencesByElement(JSUrlPathReferenceProvider.kt:17)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:202)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:165)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:145)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.lambda$getReferencesFromProviders$0(ReferenceProvidersRegistry.java:40)
at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:153)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:112)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:76)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:150)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:120)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:39)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:32)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.createRefs(JSLiteralExpressionImpl.java:103)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.lambda$static$0(JSLiteralExpressionImpl.java:78)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:46)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:235)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:112)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:236)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:35)
at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:81)
at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.getReferences(JSLiteralExpressionImpl.java:88)
at com.intellij.codeInsight.highlighting.HyperlinkAnnotator.annotate(HyperlinkAnnotator.java:44)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:136)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:116)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:338)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:277)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:297)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:300)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:598)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:300)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:300)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:96)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:300)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:268)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:214)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:80)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:54)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:399)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1110)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:392)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:391)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:367)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:170)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:365)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2020-10-19 12:50:49,242 [ 126834] ERROR - n.impl.GeneralHighlightingPass - IntelliJ IDEA 2020.2.3 Build #IU-202.7660.26
2020-10-19 12:50:49,242 [ 126834] ERROR - n.impl.GeneralHighlightingPass - JDK: 11.0.8; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2020-10-19 12:50:49,243 [ 126835] ERROR - n.impl.GeneralHighlightingPass - OS: Windows 10
2020-10-19 12:50:49,252 [ 126844] ERROR - n.impl.GeneralHighlightingPass - Last Action: EditorEnter
2020-10-19 12:50:51,908 [ 129500] INFO - dea.updater.SdkComponentSource - File C:\Users\xxxxx\.android\repositories.cfg could not be loaded.
更新3:
根据评论的建议,打开错误票:https://youtrack.jetbrains.com/issue/IDEA-253270
这是一个 IntelliJ 错误。
来自 Bas Leijdekkers 的建议指导我创建了 bug 票证,该票证被标记为在下一版本中修复的 bug 的重复项。感谢巴斯的帮助。
试试这个!转到文件>设置>项目:python-workspace(在“版本控制”下),
然后将项目解释器从 None 设置为当前的 Python 版本,
这可能会解决案子!