Skip to content

Commit 457f3ae

Browse files
committed
fix: hover over a tasks shows "task" in hint and not "test case"
1 parent e16f09c commit 457f3ae

File tree

1 file changed

+6
-2
lines changed
  • packages/language_server/src/robotcode/language_server/robotframework/parts

1 file changed

+6
-2
lines changed

packages/language_server/src/robotcode/language_server/robotframework/parts/hover.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ async def hover_TestCase( # noqa: N802
548548
self, node: ast.AST, nodes: List[ast.AST], document: TextDocument, position: Position
549549
) -> Optional[Hover]:
550550
from robot.parsing.lexer.tokens import Token as RobotToken
551-
from robot.parsing.model.blocks import TestCase
551+
from robot.parsing.model.blocks import TestCase, TestCaseSection
552552
from robot.parsing.model.statements import Documentation, Tags
553553

554554
test_case = cast(TestCase, node)
@@ -563,7 +563,11 @@ async def hover_TestCase( # noqa: N802
563563
doc = next((e for e in test_case.body if isinstance(e, Documentation)), None)
564564
tags = next((e for e in test_case.body if isinstance(e, Tags)), None)
565565

566-
txt = f"= Test Case *{test_case.name}* =\n"
566+
section = next((e for e in nodes if isinstance(e, TestCaseSection)), None)
567+
if section is not None and section.tasks:
568+
txt = f"= Task *{test_case.name}* =\n"
569+
else:
570+
txt = f"= Test Case *{test_case.name}* =\n"
567571

568572
if doc is not None:
569573
txt += "\n== Documentation ==\n"

0 commit comments

Comments
 (0)