File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
packages/robot/src/robotcode/robot Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1212)
1313
1414from robot .parsing .lexer .tokens import Token
15+ from robot .variables .search import search_variable
1516from robotcode .core .lsp .types import Position , Range
17+ from robotcode .robot .utils .match import normalize
1618
1719from ..utils .ast import range_from_token
1820
@@ -131,9 +133,6 @@ class InvalidVariableError(Exception):
131133
132134class VariableMatcher :
133135 def __init__ (self , name : str ) -> None :
134- from robot .variables .search import search_variable
135- from robotcode .robot .utils .match import normalize
136-
137136 self .name = name
138137
139138 match = search_variable (name , "$@&%" , ignore_errors = True )
@@ -146,9 +145,6 @@ def __init__(self, name: str) -> None:
146145 self .normalized_name = str (normalize (self .base ))
147146
148147 def __eq__ (self , o : object ) -> bool :
149- from robot .utils .normalizing import normalize
150- from robot .variables .search import search_variable
151-
152148 if isinstance (o , VariableMatcher ):
153149 return o .normalized_name == self .normalized_name
154150
Original file line number Diff line number Diff line change 8686from robotcode .robot .utils .stubs import HasError , HasErrors
8787
8888if get_robot_version () < (7 , 0 ):
89- from robot .running .handlers import _PythonHandler , _PythonInitHandler
90- from robot .running .model import ResourceFile
91- from robot .running .usererrorhandler import UserErrorHandler
92- from robot .running .userkeyword import UserLibrary
89+ from robot .running .handlers import _PythonHandler , _PythonInitHandler # pyright: ignore[reportMissingImports]
90+ from robot .running .model import ResourceFile # pyright: ignore[reportMissingImports]
91+ from robot .running .usererrorhandler import UserErrorHandler # pyright: ignore[reportMissingImports]
92+ from robot .running .userkeyword import UserLibrary # pyright: ignore[reportMissingImports]
9393
9494 robot_notset = ArgInfo .NOTSET
9595
Original file line number Diff line number Diff line change 11from functools import lru_cache
22
3+ _transform_table = str .maketrans ("" , "" , "_ " )
4+
35
46@lru_cache (maxsize = 5000 )
57def normalize (text : str ) -> str :
6- return text .lower ().replace ("_" , "" ).replace (" " , "" )
8+ # return text.lower().replace("_", "").replace(" ", "")
9+ return text .casefold ().translate (_transform_table )
710
811
912@lru_cache (maxsize = 5000 )
You can’t perform that action at this time.
0 commit comments