Runs the tool to find the definition of a symbol. Args: word (str): The symbol to find the definition of. line (int): The line number of the symbol in the code snippet. relative_path (str): The relative path of the code snippet. verbo
(self, word: str, relative_path: str, line: int = None, verbose: bool = True)
| 122 | self.lsptoolkit = LSPToolKit(path, language) |
| 123 | |
| 124 | def _run(self, word: str, relative_path: str, line: int = None, verbose: bool = True): |
| 125 | """ |
| 126 | Runs the tool to find the definition of a symbol. |
| 127 | |
| 128 | Args: |
| 129 | word (str): The symbol to find the definition of. |
| 130 | line (int): The line number of the symbol in the code snippet. |
| 131 | relative_path (str): The relative path of the code snippet. |
| 132 | verbose (bool, optional): Whether to display verbose output. Defaults to True. |
| 133 | |
| 134 | Returns: |
| 135 | str: The definition of the symbol. |
| 136 | |
| 137 | """ |
| 138 | if line is not None: |
| 139 | line = int(line) |
| 140 | try: |
| 141 | return self.lsptoolkit.get_definition(word, relative_path, line, verbose=verbose) |
| 142 | except: |
| 143 | return "File read failed, please check the path again" |
| 144 | |
| 145 | class FindAllReferencesArgs(BaseModel): |
| 146 | word: str = Field(..., description="The name of the symbol to find all references") |
no test coverage detected