fix(type): t/c 模块前缀报错补全文件、行列与替代写法
SymbolExtractor 在提取符号前记录 CurrentFile;类型注解拒绝 t./c. 时输出 文件:行:列、完整写法与改写建议。
This commit is contained in:
1 parent
c91edd5629
commit
a8718aa751
2 files changed
+8
-2
No files matched your search
@@ -23,6 +23,7 @@ class ASTSymbolExtractor:
|
||||
|
||||
def extract(self, file_path: str) -> ModuleSymbols:
|
||||
"""提取文件中的所有符号信息"""
|
||||
setattr(self._symtab, 'CurrentFile', file_path)
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
code: str = f.read()
|
||||
tree: ast.Module = ast.parse(code, file_path)
|
||||
|
||||
Reference in new issue
Block a user