carlrobertoh / CodeGPT

The leading open-source AI copilot for JetBrains. Connect to any model in any environment, and customize your coding experience in any way you like.
https://codegpt.ee
Apache License 2.0
1.01k stars 213 forks source link

Wrong line separators fatal error on windows machines #599

Closed tachyean closed 3 months ago

tachyean commented 3 months ago

What happened?

The plugin works very well on mac os but under windows i am getting the a line separators error every time i am using the contextual menu on a piece of code. (Wrong line separators: '...\n\t\t\t)\n\t\t);\r\n' at offset 674 ...)

Relevant log output or stack trace

java.lang.AssertionError: Wrong line separators: '...\n\t\t\t)\n\t\t);\r\n' at offset 674
    at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2484)
    at com.intellij.openapi.editor.impl.DocumentImpl.assertValidSeparators(DocumentImpl.java:706)
    at com.intellij.openapi.editor.impl.DocumentImpl.insertString(DocumentImpl.java:534)
    at com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter$LightMapper.finish(LayeredLexerEditorHighlighter.java:94)
    at com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter$1.finish(LayeredLexerEditorHighlighter.java:150)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.doSetText(LexerEditorHighlighter.java:448)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:410)
    at com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter.setText(LayeredLexerEditorHighlighter.java:124)
    at com.intellij.openapi.editor.impl.EditorImpl.lambda$setHighlighter$25(EditorImpl.java:1356)
    at com.intellij.openapi.application.WriteIntentReadAction.lambda$run$0(WriteIntentReadAction.java:24)
    at com.intellij.openapi.application.impl.RwLockHolder.runWriteIntentReadAction(RwLockHolder.kt:17)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteIntentReadAction(ApplicationImpl.java:1007)
    at com.intellij.openapi.application.WriteIntentReadAction.compute(WriteIntentReadAction.java:55)
    at com.intellij.openapi.application.WriteIntentReadAction.run(WriteIntentReadAction.java:23)
    at com.intellij.openapi.editor.impl.EditorImpl.setHighlighter(EditorImpl.java:1348)
    at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:197)
    at ee.carlrobert.codegpt.util.EditorUtil.createEditor(EditorUtil.kt:37)
    at ee.carlrobert.codegpt.toolwindow.chat.editor.ResponseEditorPanel.<init>(ResponseEditorPanel.java:57)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.prepareProcessingCode(ChatMessageResponseBody.java:220)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.processCode(ChatMessageResponseBody.java:197)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.processResponse(ChatMessageResponseBody.java:183)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.ChatMessageResponseBody.withResponse(ChatMessageResponseBody.java:78)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.UserMessagePanel.createResponseBody(UserMessagePanel.java:62)
    at ee.carlrobert.codegpt.toolwindow.chat.ui.UserMessagePanel.<init>(UserMessagePanel.java:42)
    at ee.carlrobert.codegpt.toolwindow.chat.ChatToolWindowTabPanel.lambda$sendMessage$2(ChatToolWindowTabPanel.java:137)
    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:695)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
    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)

Steps to reproduce

Select a portion of the code, try to use the contextual menu to "Explain", "Refactor" or any other action.

CodeGPT version

2.8.1

Operating System

Windows