Assigning blocks' return values to variables is a common idiom in Ruby. Fix the ctags parser to take this into account. Closes #1744. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1820
-- Commit Summary --
* Fix Ruby parsing for block assigns
-- File Changes --
M ctags/parsers/ruby.c (96)
-- Patch Links --
https://github.com/geany/geany/pull/1820.patch https://github.com/geany/geany/pull/1820.diff
@tambeta thanks, does this apply to upstream [universal ctags](https://github.com/universal-ctags/ctags) if so probably best to submit it there and then make a PR to pull the modified parser into Geany (unless Geany one has other fixes uctags doesn't).
@tambeta pushed 1 commit.
f921368 ctags Ruby parser: sync block assign to upstream
@elextr, I'm not entirely sure what's the protocol for syncing parser changes from upstream, but I submitted this fix to universal-ctags and it was accepted (universal-ctags/ctags#1734).
I've made another commit on this branch pulling in the relevant changes. The improvements can be reviewed using this [Ruby test file](https://raw.githubusercontent.com/masatake/ctags/68ea0f84f69fecaebb27ce11461...) - using various assignments with blocks no longer breaks the symbols tree.
LGBI. The commits should be squashed, though.
I'm hazy on what LGBI means. As to squashing commits, I'm happy to do that, but I'm not sure what the accepted best practice is on an open PR. Is a forced push overwriting the existing commits with a combined one OK, or should a new PR be opened based off a new branch, the existing PR modified to pull from a new branch, or something else? The Geany hacking document does not specify this.
Don't worry, the squash can be done at merge, but the reminder is always good. I take it that upstream ctags accepted the change.
Can you add a test for this? See `geany/tests/ctags` basically a short piece of ruby and the expected tags.
I'm hazy on what LGBI means.
As far as I can tell, it's Australian for "I looked at the code and it seems OK but I didn't test it, and won't be held responsible if it contains any problems". :smile:
@tambeta pushed 1 commit.
1ea6be0 ctags Ruby parser: block assignment test
@elextr, upstream did accept the change and the changeset also included a test; I've added it to the PR at hand.
@tambeta pushed 1 commit.
225c4ee ctags Ruby parser: handle assigns to sigiled vars
@tambeta is 225c4ee in upstream? Improvements are good, but if they are not upstreamed one day someone will pull in the upstream parser and they will all be lost.
True. I have [submitted this fix upstream as well](https://github.com/universal-ctags/ctags/pull/1766).
Closed #1820.
github-comments@lists.geany.org