Skip to content

Commit 4b6c358

Browse files
committed
fix: report error only on an empty definition
1 parent 8168b51 commit 4b6c358

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

metals/src/main/scala/scala/meta/internal/metals/DefinitionProvider.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ final class DefinitionProvider(
9898
if (path.isScalaFilename) {
9999
compilers()
100100
.definition(params, token)
101-
.map(reportBuilder.setCompilerResult)
102101
.map {
103-
case res if res.isEmpty => Some(res)
102+
case res if res.isEmpty =>
103+
reportBuilder.setCompilerResult(res)
104+
Some(res)
104105
case res =>
105106
val pathToDef = res.locations.asScala.head.getUri.toAbsolutePath
106107
Some(
@@ -582,7 +583,7 @@ class DefinitionProviderReportBuilder(
582583

583584
def build(): Option[Report] =
584585
compilerDefn match {
585-
case Some(compilerDefn) if !foundScalaDocDef =>
586+
case Some(compilerDefn) if !foundScalaDocDef && compilerDefn.isEmpty =>
586587
Some(
587588
Report(
588589
"empty-definition",

0 commit comments

Comments
 (0)