Skip to content

Commit 96ba516

Browse files
committed
refactor(langserver): remove unused methods to simplify code
1 parent b37be1c commit 96ba516

File tree

1 file changed

+0
-76
lines changed
  • packages/language_server/src/robotcode/language_server/robotframework/parts

1 file changed

+0
-76
lines changed

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

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -484,38 +484,6 @@ def find_separator_index(self, separator_values: FrozenSet[str]) -> Optional[int
484484
except StopIteration:
485485
return None
486486

487-
def consume_until_separator(self, separator_values: List[str]) -> List[Token]:
488-
"""Consume tokens until separator is found.
489-
490-
Args:
491-
separator_values: List of separator values to stop at
492-
493-
Returns:
494-
List of consumed tokens (excluding separator)
495-
"""
496-
consumed = []
497-
while self.has_next():
498-
next_token = self.peek()
499-
if next_token and next_token.value in separator_values:
500-
break
501-
consumed_token = self.consume()
502-
if consumed_token:
503-
consumed.append(consumed_token)
504-
return consumed
505-
506-
def consume_all_remaining(self) -> List[Token]:
507-
"""Consume all remaining tokens efficiently.
508-
509-
Returns:
510-
List of all remaining tokens
511-
"""
512-
consumed = []
513-
while self.has_next():
514-
consumed_token = self.consume()
515-
if consumed_token:
516-
consumed.append(consumed_token)
517-
return consumed
518-
519487
def iter_until_separator(self, separator_values: List[str]) -> Iterator[Token]:
520488
"""Iterate tokens until separator is found without creating a list.
521489
@@ -544,50 +512,6 @@ def iter_all_remaining(self) -> Iterator[Token]:
544512
if token:
545513
yield token
546514

547-
def count_until_separator(self, separator_values: List[str]) -> int:
548-
"""Count tokens until separator without consuming them.
549-
550-
Args:
551-
separator_values: List of separator values to stop at
552-
553-
Returns:
554-
Number of tokens until separator (excluding separator)
555-
"""
556-
count = 0
557-
saved_index = self.index
558-
while self.has_next():
559-
next_token = self.peek()
560-
if next_token and next_token.value in separator_values:
561-
break
562-
self.consume()
563-
count += 1
564-
self.index = saved_index
565-
return count
566-
567-
def process_until_separator_direct(
568-
self, separator_values: List[str], processor_func: Any, *args: Any, **kwargs: Any
569-
) -> Any:
570-
"""Process tokens until separator directly without creating intermediate lists.
571-
572-
Args:
573-
separator_values: List of separator values to stop at
574-
processor_func: Function to call for each token
575-
*args, **kwargs: Additional arguments for processor_func
576-
577-
Returns:
578-
Result from processor_func
579-
"""
580-
start_index = self.index
581-
count = self.count_until_separator(separator_values)
582-
583-
if count == 0:
584-
return processor_func([], *args, **kwargs)
585-
586-
tokens_slice = self.arguments[start_index : start_index + count]
587-
self.index = start_index + count
588-
589-
return processor_func(tokens_slice, *args, **kwargs)
590-
591515

592516
class NamedArgumentProcessor:
593517
"""Handles named argument processing consistently across different contexts."""

0 commit comments

Comments
 (0)