@@ -10,18 +10,13 @@ import com.github.continuedev.continueintellijextension.services.ContinuePluginS
10
10
import com.google.gson.Gson
11
11
import com.google.gson.GsonBuilder
12
12
import com.google.gson.reflect.TypeToken
13
- import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
14
- import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
15
- import com.intellij.codeInsight.daemon.impl.HighlightInfo
16
13
import com.intellij.execution.configurations.GeneralCommandLine
17
14
import com.intellij.execution.util.ExecUtil
18
15
import com.intellij.ide.plugins.PluginManager
19
16
import com.intellij.ide.plugins.PluginManagerCore
20
- import com.intellij.lang.annotation.HighlightSeverity
21
17
import com.intellij.openapi.Disposable
22
18
import com.intellij.openapi.application.ApplicationInfo
23
19
import com.intellij.openapi.application.ApplicationManager
24
- import com.intellij.openapi.application.ReadAction
25
20
import com.intellij.openapi.command.WriteCommandAction
26
21
import com.intellij.openapi.components.ServiceManager
27
22
import com.intellij.openapi.components.service
@@ -32,7 +27,6 @@ import com.intellij.openapi.extensions.PluginId
32
27
import com.intellij.openapi.fileEditor.FileDocumentManager
33
28
import com.intellij.openapi.fileEditor.FileEditorManager
34
29
import com.intellij.openapi.fileEditor.TextEditor
35
- import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl
36
30
import com.intellij.openapi.project.DumbAware
37
31
import com.intellij.openapi.project.Project
38
32
import com.intellij.openapi.ui.MessageType
@@ -42,7 +36,6 @@ import com.intellij.openapi.vfs.*
42
36
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
43
37
import com.intellij.openapi.wm.WindowManager
44
38
import com.intellij.psi.PsiDocumentManager
45
- import com.intellij.terminal.TerminalUtils
46
39
import com.intellij.testFramework.LightVirtualFile
47
40
import com.intellij.ui.awt.RelativePoint
48
41
import com.intellij.util.concurrency.annotations.RequiresEdt
@@ -543,35 +536,38 @@ class IdeProtocolClient (
543
536
val document: Document = editor!! .document
544
537
val psiFile = PsiDocumentManager .getInstance(project).getPsiFile(document) ? : return @launch
545
538
546
- val analyzer = DaemonCodeAnalyzer .getInstance(project) as DaemonCodeAnalyzerImpl
547
- val highlightInfos = ReadAction .compute<MutableList <HighlightInfo >, Throwable > {
548
- analyzer.getFileLevelHighlights(project, psiFile)
549
- }
550
-
551
539
val problems = ArrayList <Map <String , Any ?>>()
552
- for (highlightInfo in highlightInfos) {
553
- if (highlightInfo.severity == = HighlightSeverity .ERROR ||
554
- highlightInfo.severity == = HighlightSeverity .WARNING ) {
555
- val startOffset = highlightInfo.getStartOffset()
556
- val endOffset = highlightInfo.getEndOffset()
557
- val description = highlightInfo.description
558
- problems.add(mapOf (
559
- " filepath" to psiFile.virtualFile?.path,
560
- " range" to mapOf (
561
- " start" to mapOf (
562
- " line" to document.getLineNumber(startOffset),
563
- " character" to startOffset - document.getLineStartOffset(document.getLineNumber(startOffset))
564
- ),
565
- " end" to mapOf (
566
- " line" to document.getLineNumber(endOffset),
567
- " character" to endOffset - document.getLineStartOffset(document.getLineNumber(endOffset))
568
- )
569
- ),
570
- " message" to description
571
- ))
572
- }
573
- }
574
540
respond(problems)
541
+
542
+ // DaemonCodeAnalyzerImpl has been made internal, which means we cannot access this
543
+ // val analyzer = DaemonCodeAnalyzer.getInstance(project) as DaemonCodeAnalyzerImpl
544
+ // val highlightInfos = ReadAction.compute<MutableList<HighlightInfo>, Throwable> {
545
+ // analyzer.getFileLevelHighlights(project, psiFile)
546
+ // }
547
+ //
548
+ // for (highlightInfo in highlightInfos) {
549
+ // if (highlightInfo.severity === HighlightSeverity.ERROR ||
550
+ // highlightInfo.severity === HighlightSeverity.WARNING) {
551
+ // val startOffset = highlightInfo.getStartOffset()
552
+ // val endOffset = highlightInfo.getEndOffset()
553
+ // val description = highlightInfo.description
554
+ // problems.add(mapOf(
555
+ // "filepath" to psiFile.virtualFile?.path,
556
+ // "range" to mapOf(
557
+ // "start" to mapOf(
558
+ // "line" to document.getLineNumber(startOffset),
559
+ // "character" to startOffset - document.getLineStartOffset(document.getLineNumber(startOffset))
560
+ // ),
561
+ // "end" to mapOf(
562
+ // "line" to document.getLineNumber(endOffset),
563
+ // "character" to endOffset - document.getLineStartOffset(document.getLineNumber(endOffset))
564
+ // )
565
+ // ),
566
+ // "message" to description
567
+ // ))
568
+ // }
569
+ // }
570
+ // respond(problems)
575
571
}
576
572
" getConfigJsUrl" -> {
577
573
// Calculate a data URL for the config.js file
@@ -975,10 +971,12 @@ class IdeProtocolClient (
975
971
976
972
@RequiresEdt
977
973
private fun pinnedFiles (): List <String > {
978
- val fileEditorManager = FileEditorManager .getInstance(project) as ? FileEditorManagerImpl ? : return listOf ()
979
- val openFiles = fileEditorManager.openFiles.map { it.path }.toList()
980
- val pinnedFiles = fileEditorManager.windows.flatMap { window -> window.files.filter { window.isFilePinned(it) } }.map { it.path }.toSet()
981
- return openFiles.intersect(pinnedFiles).toList()
974
+ // Caused incompatibility issue with JetBrains new release
975
+ return visibleFiles()
976
+ // val fileEditorManager = FileEditorManager.getInstance(project) as? FileEditorManagerImpl ?: return listOf() // FileEditorManagerImpl should be the type, but this was marked as internal
977
+ // val openFiles = fileEditorManager.openFiles.map { it.path }.toList()
978
+ // val pinnedFiles = fileEditorManager.windows.flatMap { window -> window.files.filter { window.isFilePinned(it) } }.map { it.path }.toSet()
979
+ // return openFiles.intersect(pinnedFiles).toList()
982
980
}
983
981
984
982
private fun currentFile (): String? {
0 commit comments