Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Fri, 02 Sep 2022 22:08:51 UTC Commit: 06e8bdc1b3cd516a068c43bd68b76a498e1adeee https://github.com/geany/geany/commit/06e8bdc1b3cd516a068c43bd68b76a498e1ade...
Log Message: ----------- Enable local variable and parameter tag reporting for various languages
This patch enables local variable and function parameter reporting for Python, GDScript, PHP, and Typescript.
Because these are dynamic languages and Geany scope autocompletion relies on static type information, scope completion doesn't work for these languages. However, at least we get non-scope autocompletion for local variables and function parameters.
Local variables in GDScript were previously mapped to tm_tag_other_t and were displayed in the sidebar. We don't display these tags for C/C++ in the sidebar and they should also be mapped to tm_tag_local_var_t which is why there is a diff in unit tests removing these variables from the output.
The python parser generates a slightly different output when function parameter parsing is enabled (whitespace only change) which causes the change of the output of some python unit tests.
Modified Paths: -------------- src/tagmanager/tm_parser.c tests/ctags/cython_sample.pyx.tags tests/ctags/gdscript-inner-class.gd.tags tests/ctags/gdscript-modifiers.gd.tags tests/ctags/gdscript-no-implicit-class.gd.tags tests/ctags/simple.py.tags
Modified: src/tagmanager/tm_parser.c 23 lines changed, 11 insertions(+), 12 deletions(-) =================================================================== @@ -166,7 +166,7 @@ static TMParserMapEntry map_PHP[] = { {'d', tm_tag_macro_t}, // define {'f', tm_tag_function_t}, // function {'i', tm_tag_interface_t}, // interface - {'l', tm_tag_undef_t}, // local + {'l', tm_tag_local_var_t}, // local {'n', tm_tag_namespace_t}, // namespace {'t', tm_tag_struct_t}, // trait {'v', tm_tag_variable_t}, // variable @@ -178,7 +178,7 @@ static TMParserMapGroup group_PHP[] = { {_("Classes"), TM_ICON_CLASS, tm_tag_class_t}, {_("Functions"), TM_ICON_METHOD, tm_tag_function_t}, {_("Constants"), TM_ICON_MACRO, tm_tag_macro_t}, - {_("Variables"), TM_ICON_VAR, tm_tag_variable_t}, + {_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_local_var_t}, {_("Traits"), TM_ICON_STRUCT, tm_tag_struct_t}, };
@@ -192,14 +192,14 @@ static TMParserMapEntry map_PYTHON[] = { /* defined as externvar to get those excluded as forward type in symbols.c:goto_tag() * so we can jump to the real implementation (if known) instead of to the import statement */ {'x', tm_tag_externvar_t}, // unknown - {'z', tm_tag_undef_t}, // parameter - {'l', tm_tag_undef_t}, // local + {'z', tm_tag_local_var_t}, // parameter + {'l', tm_tag_local_var_t}, // local }; static TMParserMapGroup group_PYTHON[] = { {_("Classes"), TM_ICON_CLASS, tm_tag_class_t}, {_("Methods"), TM_ICON_MACRO, tm_tag_method_t}, {_("Functions"), TM_ICON_METHOD, tm_tag_function_t}, - {_("Variables"), TM_ICON_VAR, tm_tag_variable_t}, + {_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_local_var_t}, {_("Imports"), TM_ICON_NAMESPACE, tm_tag_externvar_t}, };
@@ -969,16 +969,15 @@ static TMParserMapEntry map_GDSCRIPT[] = { {'C', tm_tag_variable_t}, // const {'g', tm_tag_enum_t}, // enum {'e', tm_tag_variable_t}, // enumerator - {'z', tm_tag_other_t}, // parameter - {'l', tm_tag_other_t}, // local + {'z', tm_tag_local_var_t}, // parameter + {'l', tm_tag_local_var_t}, // local {'s', tm_tag_variable_t}, // signal }; static TMParserMapGroup group_GDSCRIPT[] = { {_("Classes"), TM_ICON_CLASS, tm_tag_class_t}, {_("Methods"), TM_ICON_MACRO, tm_tag_method_t}, - {_("Variables"), TM_ICON_VAR, tm_tag_variable_t}, + {_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_local_var_t}, {_("Enums"), TM_ICON_STRUCT, tm_tag_enum_t}, - {_("Other"), TM_ICON_OTHER, tm_tag_other_t}, };
static TMParserMapEntry map_CLOJURE[] = { @@ -1012,10 +1011,10 @@ static TMParserMapEntry map_TYPESCRIPT[] = { {'e', tm_tag_enumerator_t}, // enumerator {'m', tm_tag_method_t}, // method {'n', tm_tag_namespace_t}, // namespace - {'z', tm_tag_undef_t}, // parameter + {'z', tm_tag_local_var_t}, // parameter {'p', tm_tag_member_t}, // property {'v', tm_tag_variable_t}, // variable - {'l', tm_tag_undef_t}, // local + {'l', tm_tag_local_var_t}, // local {'C', tm_tag_macro_t}, // constant {'G', tm_tag_undef_t}, // generator {'a', tm_tag_undef_t}, // alias @@ -1026,7 +1025,7 @@ static TMParserMapGroup group_TYPESCRIPT[] = { {_("Interfaces"), TM_ICON_STRUCT, tm_tag_interface_t}, {_("Functions"), TM_ICON_METHOD, tm_tag_function_t | tm_tag_method_t}, {_("Enums"), TM_ICON_STRUCT, tm_tag_enum_t}, - {_("Variables"), TM_ICON_VAR, tm_tag_variable_t}, + {_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_local_var_t}, {_("Constants"), TM_ICON_MACRO, tm_tag_macro_t}, {_("Other"), TM_ICON_MEMBER, tm_tag_member_t | tm_tag_enumerator_t}, };
Modified: tests/ctags/cython_sample.pyx.tags 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -4,8 +4,8 @@ StdClass class: StdClass __init__�128�(self)�CDefClass�0 method: CDefClass :: __init__(self) -c_method�128�(self,int i)�CDefClass�0 -method: CDefClass :: c_method(self,int i) +c_method�128�(self, int i)�CDefClass�0 +method: CDefClass :: c_method(self, int i) identity�16�(x)�0 function: identity(x) int2string�16�(int i)�0
Modified: tests/ctags/gdscript-inner-class.gd.tags 20 lines changed, 0 insertions(+), 20 deletions(-) =================================================================== @@ -22,14 +22,10 @@ _init method: Peer :: _init(peer_id) center�16384�Circle2D�0 variable: Circle2D :: center -close�524288�Lobby.leave�0 -other: Lobby.leave :: close color�16384�Circle2D�0 variable: Circle2D :: color host�16384�Lobby�0�int variable: int Lobby :: host -host_id�524288�Lobby._init�0�int -other: int Lobby._init :: host_id id�16384�Peer�0 variable: Peer :: id join�128�(peer_id, server)�Lobby�0�bool @@ -40,16 +36,6 @@ lobbies variable: Dictionary lobbies lobby�16384�Peer�0 variable: Peer :: lobby -new_peer�524288�Lobby.join�0�WebSocketPeer -other: WebSocketPeer Lobby.join :: new_peer -peer_id�524288�Lobby.join�0 -other: Lobby.join :: peer_id -peer_id�524288�Lobby.leave�0 -other: Lobby.leave :: peer_id -peer_id�524288�Lobby.seal�0 -other: Lobby.seal :: peer_id -peer_id�524288�Peer._init�0 -other: Peer._init :: peer_id peers�16384�0�Dictionary variable: Dictionary peers peers�16384�Lobby�0�Array @@ -64,12 +50,6 @@ sealed variable: bool Lobby :: sealed server�16384�0�WebSocketServer variable: WebSocketServer server -server�524288�Lobby.join�0 -other: Lobby.join :: server -server�524288�Lobby.leave�0 -other: Lobby.leave :: server -server�524288�Lobby.seal�0 -other: Lobby.seal :: server time�16384�Lobby�0 variable: Lobby :: time time�16384�Peer�0
Modified: tests/ctags/gdscript-modifiers.gd.tags 16 lines changed, 0 insertions(+), 16 deletions(-) =================================================================== @@ -1,26 +1,10 @@ _create_block_collider�128�(block_sub_position)�0 method: _create_block_collider(block_sub_position) -a�524288�id�0 -other: id :: a -b�524288�r�0 -other: r :: b -block_id�524288�calculate_block_uvs�0 -other: calculate_block_uvs :: block_id -block_sub_position�524288�_create_block_collider�0 -other: _create_block_collider :: block_sub_position -c�524288�x�0 -other: x :: c calculate_block_uvs�128�(block_id)�0 method: calculate_block_uvs(block_id) -col�524288�calculate_block_uvs�0 -other: calculate_block_uvs :: col -collider�524288�_create_block_collider�0 -other: _create_block_collider :: collider id�128�(a)�0 method: id(a) r�128�(b)�0 method: r(b) -row�524288�calculate_block_uvs�0 -other: calculate_block_uvs :: row x�128�(c)�0 method: x(c)
Modified: tests/ctags/gdscript-no-implicit-class.gd.tags 14 lines changed, 0 insertions(+), 14 deletions(-) =================================================================== @@ -38,20 +38,6 @@ foooooooo method: String Something :: foooooooo() inferred_type�16384�0 variable: inferred_type -local_var�524288�some_function�0 -other: some_function :: local_var -local_var2�524288�some_function�0 -other: some_function :: local_var2 -lv�524288�_init�0 -other: _init :: lv -p1�524288�something�0 -other: something :: p1 -p2�524288�something�0 -other: something :: p2 -param1�524288�some_function�0�Vector3 -other: Vector3 some_function :: param1 -param2�524288�some_function�0�int -other: int some_function :: param2 s�16384�0 variable: s sig�16384�0
Modified: tests/ctags/simple.py.tags 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -26,8 +26,8 @@ deeply_nested class: _test.ignored_function.more_nesting :: deeply_nested even_more�128�()�_test.ignored_function.more_nesting.deeply_nested�0 method: _test.ignored_function.more_nesting.deeply_nested :: even_more() -foo�16�( x , y, z)�0 -function: foo( x , y, z) +foo�16�( x, y, z)�0 +function: foo( x, y, z) ignored_function�16�()�_test�0 function: _test :: ignored_function() more_nesting�16�()�_test.ignored_function�0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).