Skip to content

Commit c946ed8

Browse files
author
Barnabás Domozi
committed
Added file refs option.
1 parent 286ad16 commit c946ed8

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

plugins/python/parser/pyparser/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def parseProject(settings, n_proc):
2626
ast_import=settings["ast_import"],
2727
ast_annotations=settings["ast_annotations"],
2828
ast_inheritance=settings["ast_inheritance"],
29-
ast_function_signature=settings["ast_function_signature"]
29+
ast_function_signature=settings["ast_function_signature"],
30+
file_refs=settings["file_refs"]
3031
)
3132

3233
log(f"Parsing project: {config.root_path}")

plugins/python/parser/pyparser/parserconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ParserConfig:
1212
stack_trace: bool = False
1313
safe_env: bool = False
1414
type_hint: bool = False
15-
file_refs: bool = True
15+
file_refs: bool = False
1616
submodule_discovery: bool = True
1717
ast: bool = True
1818
ast_function_call: bool = True

plugins/python/parser/pyparser/parserlog.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def log_config(config: ParserConfig):
2525
else:
2626
log(f"{bcolors.OKBLUE}Type hint support disabled!")
2727

28+
if config.file_refs:
29+
log(f"{bcolors.OKGREEN}File refs lookup enabled!")
30+
else:
31+
log(f"{bcolors.OKBLUE}File refs lookup disabled!")
32+
2833
if config.stack_trace:
2934
log(f"{bcolors.WARNING}Stack trace enabled!")
3035

plugins/python/parser/src/pythonparser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void PythonParser::parseProject(const std::string& root_path)
6767
settings["ast_annotations"] = !(_ctx.options.count("disable-ast-annotations"));
6868
settings["ast_inheritance"] = !(_ctx.options.count("disable-ast-inheritance"));
6969
settings["ast_function_signature"] = !(_ctx.options.count("disable-ast-function-signature"));
70+
settings["file_refs"] = (bool)(_ctx.options.count("file-refs"));
7071

7172
python::object result_list = m_py_module.attr("parseProject")(settings, n_proc);
7273

@@ -215,6 +216,8 @@ extern "C"
215216
"Disable AST inheritance parsing.")
216217
("disable-ast-function-signature",
217218
"Disable AST function signature parsing.")
219+
("file-refs",
220+
"Enable search for references in a file context.")
218221
("debug",
219222
"Enable parsing in debug mode.");
220223

0 commit comments

Comments
 (0)