Hannah-Sten / TeXiFy-IDEA

LaTeX support for the IntelliJ platform by JetBrains.
https://hannah-sten.github.io/TeXiFy-IDEA
MIT License
892 stars 89 forks source link

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 #1337

Closed peter-lucia closed 4 years ago

peter-lucia commented 4 years ago

Description

Stacktrace

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
    at java.base/java.util.Objects.checkIndex(Objects.java:372)
    at java.base/java.util.ArrayList.get(ArrayList.java:458)
    at nl.hannahsten.texifyidea.completion.LatexBibliographyReferenceProvider.addCompletions(LatexBibliographyReferenceProvider.kt:36)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:26)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:147)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:63)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:148)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:141)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:77)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:26)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:147)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:63)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:119)
    at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.performCompletion(CompletionServiceImpl.java:55)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:827)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:812)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$null$5(CodeCompletionHandlerBase.java:326)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:997)
    at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:318)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:95)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
    at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
PHPirates commented 4 years ago

Thanks for the report! Which version of TeXiFy and Jetbrains IDE (IntelliJ,...) are you using?

peter-lucia commented 4 years ago

Sure, happy to help.

Texify: 0.6.8 Pycharm: PyCharm 2019.3 (Community Edition) Build #PC-193.5233.109, built on November 28, 2019 Runtime version: 11.0.4+10-b520.11 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.3 GC: ParNew, ConcurrentMarkSweep Memory: 990M Cores: 4 Registry: ide.balloon.shadow.size=0 Non-Bundled Plugins: IdeaVIM, com.andrewbrookins.wrap_to_column, com.markskelton.one-dark-theme, mobi.hsz.idea.latex, nl.rubensten.texifyidea

PHPirates commented 4 years ago

Thanks, I can reproduce the exception so we can solve it. I think you had a \bibitem command without the required parameter (perhaps while typing it).

peter-lucia commented 4 years ago

Wow, you’re probably right I remember fixing an error like that later on.