Skip to content

Commit 57e7c8c

Browse files
committed
correct using get_model with data_only=False in semantic tokens and formatting
1 parent d9d953b commit 57e7c8c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

robotcode/language_server/robotframework/parts/formatting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async def format_robot_tidy(
8787
from robotidy.api import RobotidyAPI
8888

8989
try:
90-
model = await self.parent.documents_cache.get_model(document)
90+
model = await self.parent.documents_cache.get_model(document, False)
9191

9292
robot_tidy = RobotidyAPI(document.uri.to_path(), None)
9393

@@ -144,7 +144,7 @@ async def format_internal(
144144
SeparatorNormalizer,
145145
)
146146

147-
model = cast(File, await self.parent.documents_cache.get_model(document))
147+
model = cast(File, await self.parent.documents_cache.get_model(document, False))
148148

149149
Cleaner().visit(model)
150150
NewlineNormalizer(self.line_separator, self.short_test_name_length).visit(model)

robotcode/language_server/robotframework/parts/semantic_tokens.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,11 @@ async def get_tokens() -> AsyncGenerator[Tuple[Token, ast.AST], None]:
726726
lambda t: range is None or token_in_range(t[0], range),
727727
async_dropwhile(
728728
lambda t: range is not None and not token_in_range(t[0], range),
729-
((t, n) async for t, n in get_tokens()),
729+
(
730+
(t, n)
731+
async for t, n in get_tokens()
732+
if t.type not in [RobotToken.SEPARATOR, RobotToken.EOL, RobotToken.EOS]
733+
),
730734
),
731735
):
732736
async for token in self.generate_sem_tokens(
@@ -766,7 +770,7 @@ async def collect_threading(
766770
self, document: TextDocument, range: Optional[Range]
767771
) -> Union[SemanticTokens, SemanticTokensPartialResult, None]:
768772

769-
model = await self.parent.documents_cache.get_model(document, True)
773+
model = await self.parent.documents_cache.get_model(document, False)
770774
namespace = await self.parent.documents_cache.get_namespace(document)
771775

772776
builtin_library_doc = next(

0 commit comments

Comments
 (0)