carlrobertoh / CodeGPT

JetBrains extension providing access to state-of-the-art LLMs, such as GPT-4, Claude 3, Code Llama, and others, all for free
https://codegpt.ee
Apache License 2.0
885 stars 184 forks source link

Plugin error #573

Open Shva123 opened 1 month ago

Shva123 commented 1 month ago

What happened?

When select text in PHPStorm 2023.2.5 and use any CodeGTP content menu, like 'Explain' (with ChatGTP 4o), I have got plugin error.

Relevant log output or stack trace

java.lang.AssertionError: Wrong line separators: '...ted_at'); \r\n' at offset 46
    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:96)
    at com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter$1.finish(LayeredLexerEditorHighlighter.java:153)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.doSetText(LexerEditorHighlighter.java:456)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.setText(LexerEditorHighlighter.java:418)
    at com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter.setText(LayeredLexerEditorHighlighter.java:126)
    at com.intellij.openapi.editor.impl.EditorImpl.setHighlighter(EditorImpl.java:1373)
    at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:204)
    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:690)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:593)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:997)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:997)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
    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

  1. Run PHPStorm 2023.2.5
  2. Menu File | Settings | Tools | CodeGPT | Providers | OpenAI -> Set Model=GPT-4o
  3. In code editor select any text
  4. For selected text run context menu CodeGPT | Expain

CodeGPT version

2.7.1-223

Operating System

Windows