From 04c2c9f0596753ff5d975edee2a72dc9b7c87fce Mon Sep 17 00:00:00 2001 From: Katarzyna Marek Date: Thu, 9 May 2024 12:24:37 +0200 Subject: [PATCH] filter if empty locations --- .../scala/scala/meta/internal/metals/ReferenceProvider.scala | 4 ++-- .../main/scala/scala/meta/internal/pc/ReferencesRequest.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala b/metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala index de18f17a5b3..ef789c2a3d2 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/ReferenceProvider.scala @@ -219,7 +219,7 @@ final class ReferenceProvider( .map( _.flatten .groupBy(_.symbol) - .map { case (symbol, refs) => + .collect { case (symbol, refs) => ReferencesResult(symbol, refs.flatMap(_.locations)) } .toList @@ -228,7 +228,7 @@ final class ReferenceProvider( scribe.debug(s"No semanticdb for $source") pcReferences(source, params).map( _.groupBy(_.symbol) - .map { case (symbol, refs) => + .collect { case (symbol, refs) => ReferencesResult(symbol, refs.flatMap(_.locations)) } .toList diff --git a/mtags-shared/src/main/scala/scala/meta/internal/pc/ReferencesRequest.scala b/mtags-shared/src/main/scala/scala/meta/internal/pc/ReferencesRequest.scala index c4ec21c16a8..d721dd21a21 100644 --- a/mtags-shared/src/main/scala/scala/meta/internal/pc/ReferencesRequest.scala +++ b/mtags-shared/src/main/scala/scala/meta/internal/pc/ReferencesRequest.scala @@ -12,7 +12,7 @@ import org.eclipse.lsp4j.jsonrpc.messages.{Either => JEither} case class PcReferencesRequest( file: VirtualFileParams, includeDefinition: Boolean, - offsetOrSymbol: JEither[Integer, String], + offsetOrSymbol: JEither[Integer, String] ) extends ReferencesRequest case class PcReferencesResult(