A line like `function y = foo(a, b, c)` should yield a tag of `foo`, not
`foo(a, b, c)`.
That way, Ctrl-clicking `foo` somewhere in the code will take me there.
The function name is `foo` after all, not `foo(a, b c)`.
Also, fixed issue where a line like `function foo() % this = bug` would yield a
tag of `bug` instead of `foo` because the `=` in the comment was not ignored.
Finally, added a check to ensure that the line starts with the keyword
`function`, and not any word starting with `function...` which could be a
variable name (e.g. `functionality`).
Here I am considering that function names contain only alphanumeric characters
(and underscore) as Matlab's documentation states. I'm not aware of
the possibility of declaring functions with `.` or other special characters
directly using `function`.
Example Matlab file demonstrating the issue:
```matlab
function y = foo(a, b, c) % the function name should be `foo`, not `foo(a, b,
c)`
y = a+b+c;
end
function baz() % this = bug
disp('The function name is `baz`, not `bug`');
end
functionality = struct('a', 1, 'b', 2);
```
This used to yield tags `foo(a, b, c)` and `bug`, as well as
`struct('a', 1, 'b', 2);` as a function; now it yields tags
`foo` and `baz` as expected, and omits the `functionality` thing.
_(If it's any consolation, notice that GitHub also messes up the
highlighting of `baz()` because of the `=` in the comment.)_
____
PS: Similarly, it might be good to figure out a way to also exclude occurrences
of the substring `"struct"` that aren't the keyword `struct`
itself, such as in strings, or as part of words, e.g.:
```matlab
restructure = true;
disp('You are on the way to destruction.');
```
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3358
-- Commit Summary --
* ctags: Matlab: function name only, without args
-- File Changes --
M ctags/parsers/geany_matlab.c (17)
-- Patch Links --
https://github.com/geany/geany/pull/3358.patch
https://github.com/geany/geany/pull/3358.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3358
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/pull/[email protected]>