Hannah-Sten / TeXiFy-IDEA

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

Import from remote BibTex libraries cannot handle CR-LF #3656

Open maxanier opened 2 months ago

maxanier commented 2 months ago

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

PyCharm 2024.2.0.1 (build PC-242.20224.428)

Operating System

Windows 10.0 (amd64)

TeXiFy IDEA version

0.9.7

Description

Apparently, the automatic import from remote BibTex libraries to local library cannot handle BibTex files that use CR-LF line endings. It works fine for just LF line endings.

Stacktrace

java.lang.AssertionError: Wrong line separators: '...Datta2017,\r\n  author...' at offset 19
    at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2552)
    at com.intellij.openapi.editor.impl.DocumentImpl.assertValidSeparators(DocumentImpl.java:716)
    at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:607)
    at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:598)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.doCommitTransaction(PsiToDocumentSynchronizer.java:212)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.lambda$commitTransaction$1(PsiToDocumentSynchronizer.java:188)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.lambda$doSync$0(PsiToDocumentSynchronizer.java:106)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.performAtomically(PsiToDocumentSynchronizer.java:124)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.doSync(PsiToDocumentSynchronizer.java:106)
    at com.intellij.psi.impl.PsiToDocumentSynchronizer.commitTransaction(PsiToDocumentSynchronizer.java:188)
    at com.intellij.pom.core.impl.PomModelImpl.commitTransaction(PomModelImpl.java:195)
    at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:151)
    at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:535)
    at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:103)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:269)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:277)
    at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:62)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:277)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:268)
    at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:92)
    at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:141)
    at com.intellij.psi.impl.source.tree.CompositeElement.addChild(CompositeElement.java:586)
    at com.intellij.psi.impl.source.tree.CompositeElement.addChildren(CompositeElement.java:680)
    at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.addChildren(CodeEditUtil.java:53)
    at com.intellij.psi.impl.source.tree.CompositeElement.addInternal(CompositeElement.java:455)
    at com.intellij.psi.impl.source.PsiFileImpl.addAfter(PsiFileImpl.java:887)
    at nl.hannahsten.texifyidea.completion.handlers.LatexReferenceInsertHandler.handleInsert(LatexReferenceInsertHandler.kt:25)
    at com.intellij.codeInsight.lookup.LookupElementBuilder.handleInsert(LookupElementBuilder.java:343)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$insertItem$15(CodeCompletionHandlerBase.java:713)
    at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:225)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:645)
    at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:224)
    at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:41)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$insertItem$16(CodeCompletionHandlerBase.java:712)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteAction$lambda$4(AnyThreadWriteThreadingSupport.kt:318)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteAction(AnyThreadWriteThreadingSupport.kt:328)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteAction(AnyThreadWriteThreadingSupport.kt:318)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:890)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.insertItem(CodeCompletionHandlerBase.java:696)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.doInsertItemForSingleCaret(CodeCompletionHandlerBase.java:640)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$doInsertItem$13(CodeCompletionHandlerBase.java:612)
    at com.intellij.openapi.editor.impl.CaretModelImpl.lambda$runForEachCaret$3(CaretModelImpl.java:303)
    at com.intellij.openapi.editor.impl.CaretModelImpl.doWithCaretMerging(CaretModelImpl.java:412)
    at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:312)
    at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:289)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.doInsertItem(CodeCompletionHandlerBase.java:604)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.insertItemHonorBlockSelection(CodeCompletionHandlerBase.java:563)
    at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lookupItemSelected(CodeCompletionHandlerBase.java:509)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.itemSelected(CompletionProgressIndicator.java:211)
    at com.intellij.codeInsight.completion.BaseCompletionLookupArranger.itemSelected(BaseCompletionLookupArranger.java:229)
    at com.intellij.codeInsight.lookup.impl.LookupImpl.fireItemSelected(LookupImpl.java:1000)
    at com.intellij.codeInsight.lookup.impl.LookupImpl.finishLookupInWritableFile(LookupImpl.java:617)
    at com.intellij.codeInsight.lookup.impl.LookupImpl.lambda$finishLookup$8(LookupImpl.java:573)
    at