I recently updated intelliJ from a version from 2018 to the current version and now, the inspection syntax highlighting is wonky.
As I start to type something, for instance an assignment, I will get an inspection warning at the beginning.
field.value =
results in Expression statement is not an assignment or call
which is obvious, because I haven't finished typing the assignment.
When I finish typing the assignment, however, inspection doesn't recognize that this is now a valid assignment and the syntax highlighting doesn't go away.
If I simply highlight the inspected part (field.value
) and then cut it away and immediately paste it back, IntelliJ recognizes it as correctly written and the syntax highlighting goes away.
The above example is with javascript, but this happens with everything. Everywhere. There is constantly incorrect, outdated syntax highlighting throughout my entire project that needs to be cut and pasted back in order to appear correctly.
Here is another example of the inspecting triggering on a "misspelled" word inside a string as I type it:
The word was finished and syntax highlight still shows an error on the beginning of the word.
This was not the case with the older version of IntelliJ that I was previously using.
I have tried "Invalidate Caches / restart" which will get rid of the current errors in syntax highlighting but doesn't prevent new ones from appearing.
What could be the problem here? How can I force IntelliJ to automatically reevaluate its syntax highlighting? How can I fix this?
Update
Based on request in comments with logs from 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
That leads me to believe there's a problem with the SaveActionManager
... Investigating further.
Update 2:
Removed the SaveActionManager
plugin and restarted which did not fix things, however, it lead to a more direct error that is specifically in the file that I'm currently editing and directly dealing with syntax highlighting:
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.
Update 3:
Based on suggestion from comments, opened bug ticket: https://youtrack.jetbrains.com/issue/IDEA-253270
This is an IntelliJ bug.
The advice from Bas Leijdekkers guided me toward creating a bug ticket which was marked as a duplicate of a bug that is being fixed in the next release. Thanks for the assistance Bas.