@@ -33,11 +33,13 @@ import dotty.tools.pc.completions.CompletionProvider
33
33
import dotty .tools .pc .InferExpectedType
34
34
import dotty .tools .pc .completions .OverrideCompletions
35
35
import dotty .tools .pc .buildinfo .BuildInfo
36
+ import dotty .tools .pc .SymbolInformationProvider
37
+ import dotty .tools .dotc .interactive .InteractiveDriver
36
38
37
39
import org .eclipse .lsp4j .DocumentHighlight
38
40
import org .eclipse .lsp4j .TextEdit
39
41
import org .eclipse .lsp4j as l
40
- import dotty . tools . pc . SymbolInformationProvider
42
+
41
43
42
44
case class ScalaPresentationCompiler (
43
45
buildTargetIdentifier : String = " " ,
@@ -76,14 +78,20 @@ case class ScalaPresentationCompiler(
76
78
override def withReportsLoggerLevel (level : String ): PresentationCompiler =
77
79
copy(reportsLevel = ReportLevel .fromString(level))
78
80
79
- val compilerAccess : CompilerAccess [StoreReporter , MetalsDriver ] =
81
+ val compilerAccess : CompilerAccess [StoreReporter , InteractiveDriver ] =
80
82
Scala3CompilerAccess (
81
83
config,
82
84
sh,
83
- () => new Scala3CompilerWrapper (newDriver)
84
- )(using
85
- ec
86
- )
85
+ () => new Scala3CompilerWrapper (CachingDriver (driverSettings))
86
+ )(using ec)
87
+
88
+ val driverSettings =
89
+ val implicitSuggestionTimeout = List (" -Ximport-suggestion-timeout" , " 0" )
90
+ val defaultFlags = List (" -color:never" )
91
+ val filteredOptions = removeDoubleOptions(options.filterNot(forbiddenOptions))
92
+
93
+ filteredOptions ::: defaultFlags ::: implicitSuggestionTimeout ::: " -classpath" :: classpath
94
+ .mkString(File .pathSeparator) :: Nil
87
95
88
96
private def removeDoubleOptions (options : List [String ]): List [String ] =
89
97
options match
@@ -92,19 +100,6 @@ case class ScalaPresentationCompiler(
92
100
case head :: tail => head :: removeDoubleOptions(tail)
93
101
case Nil => options
94
102
95
- def newDriver : MetalsDriver =
96
- val implicitSuggestionTimeout = List (" -Ximport-suggestion-timeout" , " 0" )
97
- val defaultFlags = List (" -color:never" )
98
- val filteredOptions = removeDoubleOptions(
99
- options.filterNot(forbiddenOptions)
100
- )
101
- val settings =
102
- filteredOptions ::: defaultFlags ::: implicitSuggestionTimeout ::: " -classpath" :: classpath
103
- .mkString(
104
- File .pathSeparator
105
- ) :: Nil
106
- new MetalsDriver (settings)
107
-
108
103
override def semanticTokens (
109
104
params : VirtualFileParams
110
105
): CompletableFuture [ju.List [Node ]] =
@@ -146,6 +141,7 @@ case class ScalaPresentationCompiler(
146
141
new CompletionProvider (
147
142
search,
148
143
driver,
144
+ () => InteractiveDriver (driverSettings),
149
145
params,
150
146
config,
151
147
buildTargetIdentifier,
0 commit comments