@@ -7,6 +7,7 @@ import java.util.Optional
77import java .util .concurrent .CompletableFuture
88import java .util .concurrent .ExecutorService
99import java .util .concurrent .ScheduledExecutorService
10+ import java .util .Collections
1011import java .util as ju
1112
1213import scala .concurrent .ExecutionContext
@@ -108,7 +109,9 @@ case class ScalaPresentationCompiler(
108109 params.token()
109110 ) { access =>
110111 val driver = access.compiler()
111- new PcSemanticTokensProvider (driver, params).provide().asJava
112+ new PcSemanticTokensProvider (driver, params)
113+ .provide()
114+ .asJava
112115 }
113116
114117 override def inlayHints (
@@ -175,7 +178,7 @@ case class ScalaPresentationCompiler(
175178 params : OffsetParams
176179 ): CompletableFuture [ju.List [DocumentHighlight ]] =
177180 compilerAccess.withInterruptableCompiler(Some (params))(
178- List .empty[ DocumentHighlight ].asJava ,
181+ Collections .emptyList() ,
179182 params.token()
180183 ) { access =>
181184 val driver = access.compiler()
@@ -186,7 +189,7 @@ case class ScalaPresentationCompiler(
186189 params : ReferencesRequest
187190 ): CompletableFuture [ju.List [ReferencesResult ]] =
188191 compilerAccess.withNonInterruptableCompiler(Some (params.file()))(
189- List .empty[ ReferencesResult ].asJava ,
192+ Collections .emptyList() ,
190193 params.file().token,
191194 ) { access =>
192195 val driver = access.compiler()
@@ -204,14 +207,11 @@ case class ScalaPresentationCompiler(
204207 new InferExpectedType (search, driver, params).infer().asJava
205208 }
206209
207- def shutdown (): Unit =
208- compilerAccess.shutdown()
210+ def shutdown (): Unit = compilerAccess.shutdown()
209211
210- def restart (): Unit =
211- compilerAccess.shutdownCurrentCompiler()
212+ def restart (): Unit = compilerAccess.shutdownCurrentCompiler()
212213
213- def diagnosticsForDebuggingPurposes (): ju.List [String ] =
214- List [String ]().asJava
214+ def diagnosticsForDebuggingPurposes (): ju.List [String ] = Collections .emptyList()
215215
216216 override def info (
217217 symbol : String
@@ -264,7 +264,7 @@ case class ScalaPresentationCompiler(
264264 ju.List [scala.meta.pc.AutoImportsResult ]
265265 ] =
266266 compilerAccess.withNonInterruptableCompiler(Some (params))(
267- List .empty[scala.meta.pc. AutoImportsResult ].asJava ,
267+ Collections .emptyList() ,
268268 params.token()
269269 ) { access =>
270270 val driver = access.compiler()
@@ -283,9 +283,8 @@ case class ScalaPresentationCompiler(
283283 def implementAbstractMembers (
284284 params : OffsetParams
285285 ): CompletableFuture [ju.List [l.TextEdit ]] =
286- val empty : ju.List [l.TextEdit ] = new ju.ArrayList [l.TextEdit ]()
287286 compilerAccess.withNonInterruptableCompiler(Some (params))(
288- empty ,
287+ Collections .emptyList() ,
289288 params.token()
290289 ) { pc =>
291290 val driver = pc.compiler()
@@ -301,9 +300,8 @@ case class ScalaPresentationCompiler(
301300 override def insertInferredType (
302301 params : OffsetParams
303302 ): CompletableFuture [ju.List [l.TextEdit ]] =
304- val empty : ju.List [l.TextEdit ] = new ju.ArrayList [l.TextEdit ]()
305303 compilerAccess.withNonInterruptableCompiler(Some (params))(
306- empty ,
304+ Collections .emptyList() ,
307305 params.token()
308306 ) { pc =>
309307 new InferredTypeProvider (params, pc.compiler(), config, search)
@@ -330,8 +328,10 @@ case class ScalaPresentationCompiler(
330328 range : RangeParams ,
331329 extractionPos : OffsetParams
332330 ): CompletableFuture [ju.List [l.TextEdit ]] =
333- val empty : ju.List [l.TextEdit ] = new ju.ArrayList [l.TextEdit ]()
334- compilerAccess.withInterruptableCompiler(Some (range))(empty, range.token()) {
331+ compilerAccess.withInterruptableCompiler(Some (range))(
332+ Collections .emptyList(),
333+ range.token()
334+ ) {
335335 pc =>
336336 new ExtractMethodProvider (
337337 range,
@@ -368,7 +368,7 @@ case class ScalaPresentationCompiler(
368368 ): CompletableFuture [ju.List [l.SelectionRange ]] =
369369 CompletableFuture .completedFuture {
370370 compilerAccess.withSharedCompiler(params.asScala.headOption)(
371- List .empty[l. SelectionRange ].asJava
371+ Collections .emptyList()
372372 ) { pc =>
373373 new SelectionRangeProvider (
374374 pc.compiler(),
@@ -438,7 +438,13 @@ case class ScalaPresentationCompiler(
438438 override def didChange (
439439 params : VirtualFileParams
440440 ): CompletableFuture [ju.List [l.Diagnostic ]] =
441- CompletableFuture .completedFuture(Nil .asJava)
441+ compilerAccess.withNonInterruptableCompiler(Some (params))(
442+ Collections .emptyList(),
443+ params.token()
444+ ) { access =>
445+ val driver = access.compiler()
446+ new DiagnosticProvider (driver, params).diagnostics().asJava
447+ }
442448
443449 override def didClose (uri : URI ): Unit =
444450 compilerAccess.withNonInterruptableCompiler(None )(
0 commit comments