Skip to content

Commit 1525db2

Browse files
committed
fix(langserver): corrected document_symbols when matching keyword or test case declaration when no name is given
fixes #377
1 parent ce77f62 commit 1525db2

File tree

93 files changed

+1372
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1372
-171
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def visit_Section(self, node: Section) -> None: # noqa: N802
8787
self.generic_visit_current_symbol(node, symbol)
8888

8989
def visit_TestCase(self, node: TestCase) -> None: # noqa: N802
90-
if node.name is None:
90+
if not node.name:
9191
return
9292

9393
if self.current_symbol is not None and self.current_symbol.children is not None:
@@ -104,7 +104,7 @@ def visit_TestCase(self, node: TestCase) -> None: # noqa: N802
104104
self.generic_visit_current_symbol(node, symbol)
105105

106106
def visit_Keyword(self, node: Keyword) -> None: # noqa: N802
107-
if node.name is None:
107+
if not node.name:
108108
return
109109

110110
if self.current_symbol is not None and self.current_symbol.children is not None:

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-044-001-another_keywords_section].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: Keywords
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 44
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 44

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-044-008-another_keywords_section].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: Keywords
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 44
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 44

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-044-015-another_keywords_section].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: Keywords
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 44
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 44

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-046-001-another_keyword].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: another keyword
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 46
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 46

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-046-008-another_keyword].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: another keyword
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 46
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 46

tests/robotcode/language_server/robotframework/parts/_regtest_outputs/rf41/test_document_symbols.test[symbols.robot-046-014-another_keyword].out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ result: !DocumentSymbol
1010
name: another keyword
1111
range:
1212
end:
13-
character: 16
14-
line: 49
13+
character: 1
14+
line: 50
1515
start:
1616
character: 0
1717
line: 46
1818
selection_range:
1919
end:
20-
character: 16
21-
line: 49
20+
character: 1
21+
line: 50
2222
start:
2323
character: 0
2424
line: 46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
data: !GeneratedTestData
2+
character: 1
3+
line: 52
4+
name: unreachable test
5+
result: !DocumentSymbol
6+
children: []
7+
deprecated: null
8+
detail: null
9+
kind: 2
10+
name: Test Cases
11+
range:
12+
end:
13+
character: 1
14+
line: 55
15+
start:
16+
character: 0
17+
line: 51
18+
selection_range:
19+
end:
20+
character: 1
21+
line: 55
22+
start:
23+
character: 0
24+
line: 51
25+
tags: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
data: !GeneratedTestData
2+
character: 2
3+
line: 52
4+
name: unreachable test
5+
result: !DocumentSymbol
6+
children: []
7+
deprecated: null
8+
detail: null
9+
kind: 2
10+
name: Test Cases
11+
range:
12+
end:
13+
character: 1
14+
line: 55
15+
start:
16+
character: 0
17+
line: 51
18+
selection_range:
19+
end:
20+
character: 1
21+
line: 55
22+
start:
23+
character: 0
24+
line: 51
25+
tags: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
data: !GeneratedTestData
2+
character: 3
3+
line: 52
4+
name: unreachable test
5+
result: !DocumentSymbol
6+
children: []
7+
deprecated: null
8+
detail: null
9+
kind: 2
10+
name: Test Cases
11+
range:
12+
end:
13+
character: 1
14+
line: 55
15+
start:
16+
character: 0
17+
line: 51
18+
selection_range:
19+
end:
20+
character: 1
21+
line: 55
22+
start:
23+
character: 0
24+
line: 51
25+
tags: null

0 commit comments

Comments
 (0)