-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruby: support for fully qualified constants #248
Conversation
dumb-jump.el
Outdated
@@ -1751,7 +1751,7 @@ to keep looking for another root." | |||
(cond | |||
((and (string= lang "clojure") (s-contains? "/" look-for)) | |||
(nth 1 (s-split "/" look-for))) | |||
((and (or (string= lang "ruby") (string= lang "crystal")) (s-starts-with? ":" look-for)) | |||
((and (or (string= lang "ruby") (string= lang "crystal")) (and (s-starts-with? ":" look-for) (and (not (s-starts-with? "::" look-for))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second and
here is unnecessary. That said, now that I understand the issue you're fixing I am pretty sure we don't need to actually add anything and we can simply swap the conditional blocks so it looks like this:
((and (string= lang "ruby") (s-contains? "::" look-for))
(-last-item (s-split "::" look-for)))
((and (or (string= lang "ruby") (string= lang "crystal")) (s-starts-with? ":" look-for))
(s-chop-prefix ":" look-for))
Does that seem right to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup @jacktasia that works. I've reverted my changes and re-ordered the code and have left the test case in. Thanks!
Thanks for the PR and report! I made one small comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
Adds support for fully qualified constants like "::Foo". Currently dumb-jump peeks at the first character of the symbol to see if it starts with a colon and thus is a ruby symbol, then strips the colon. This patch checks to see if the symbol starts with two colons and, if so, doesn't strip the colon.