-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Can't jump to the nested module's class in enh-ruby-mode
, but ruby-mode works
#136
Comments
BTW, this never be a issue anyway, because i prefer write the full name in this cause, like this: module Types
module UserQuery
class UserQueryType < Types::BaseObject
field :user_info, resolver: Types::UserQuery::Resolvers::UserInfoResolver
field :current_user, resolver: Types::UserQuery::Resolvers::CurrentUserResolver
field :current_user_wallet, resolver: Types::UserQuery::Resolvers::CurrentUserWalletResolver
end
end And, i define class like this too. class Types::UserQuery::Resolvers::CurrentUserWalletResolver
end because even if no robe or TAGS, i can find out where this class defined and used very easy with grep full name. like this: But, my co-worker prefer less is better, it always prefer write code like this: module Types
module UserQuery
class UserQueryType < Types::BaseObject
field :user_info, resolver: Resolvers::UserInfoResolver
field :current_user, resolver: Resolvers::CurrentUserResolver
field :current_user_wallet, resolver: Resolvers::CurrentUserWalletResolver
end
end and define class like this: module Types
module UserQuery
module Resolvers
class CurrentUserWalletResolver
end
end If use like this, we can't use robe to skip the actually definition position, so, i just curious, if is was possible to support this. |
Hi! Please clarify: do you both use |
Not sure, actually, i only use enh-ruby-mode for a long time, current major-mode is |
Could you try the same scenario with |
Yes, it works. it can jump from field :user_info, resolver: Resolvers::UserInfoResolver to class Types::UserQuery::Resolvers::UserInfoResolver < Resolvers::Base
end In fact, i found |
enh-ruby-mode
.
Maybe i should switch back to builtin ruby-mode, anyway, some of advantage of enh-ruby-mode was exists on solargraph when use with lsp (though, i disable it), and @zenspider is busy, enh-ruby-mode not updated almost one year. Which mode you use for ruby programming? |
i can reproduce on a very simple config, following is log:
|
consider check this: zenspider/enhanced-ruby-mode#182 |
Only with I'm guessing it's rather because of this much older issue: zenspider/enhanced-ruby-mode#156, which I originally filed as zenspider/enhanced-ruby-mode#96. While admittedly
Is there some advantage when used together with LSP? I'm not aware of any. IIUC people have been using it because of some different indentation behavior in certain examples. And maybe some differences in syntax coloring, though I don't know which.
I use |
Yes.
the advantage is, lsp use static analyze, it not need start a REPL to make those feature available. i consider ruby will give better but, the shortcoming is same, when open ruby-lsp first time, it will spend 4~5 seconds to open a ruby buffer because static analyze, i guess. Anyway, in fact, i never use lsp-ruby for a long time use, not so useful, but, it very very awesome for use Strong type language, like dart, go, rust, it almost can not do anything no lsp if you ever use it. |
I will try to switch back to ruby-mode, BTW, where is the official repo of ruby-mode? i never saw it on https://github.com/ruby |
That's interesting. I should compare it sometime. As for the rest, I was asking for reasons to use
It lived inside https://github.com/ruby/ruby/tree/master/misc originally, but about a decade ago it was contributed to Emacs, and has been living it its official repo ever since. |
What you said official repo is https://git.savannah.gnu.org/git/emacs.git/, right? I know ruby-mode was builtin, and Richard Stallman give @matz a award for the contribute of emacs. i just curious how you maintain ruby-mode.el, and where i can create issue or discuss about it. |
Any particular examples?
Yup. And I have commit access.
Not for Emacs, just for Ruby (the award was for contributing to free software).
You do that with |
👍
It must have really been a while, because there have been no recent changes in that area. And as for better performance with opening/editing large files, reports with examples are also welcome. There are limits in what I can do obviously, but I'll be sure to take a look. |
We can test on this the biggest file which builtin on ruby 3.1.0 I use emacs daemon mode, and start a new frame before open it. When i use ruby-mode, it spent 7.89 seconds to show and render the buffer correct on my laptop. when i use enh-ruby-mode, it spent 7.08 seconds, though, because enh-ruby maybe show me buffer within 3 seconds, but no highlight, still need wait until 7 seconds to render correct, that give me a wrong intuition, enh-ruby more quickly. In fact, i consider ruby-mode is more better for now, because when editing on this big file, use enh-ruby-mode if very lag because i guess it have to load ripper to render it again, i remember, when i start to use enh-ruby, it give more better syntax error tips and indent on some cases, but, i can't give you a example for now, maybe all just a misunderstand. and, and some feature not so useful because we have I use emacs 28.0.91, i guess if some great improvement to xref, native json, native compile make ruby better?. And as saw on previous screenshot, ruby-mode even render more accurately because enh-ruby-mode highlight anyway, i come back to ruby-mode, no find any issue for now. |
BTW, if you are the ruby-mode committer, i have a feature request, in fact, i want to request this for a long time. In the ruby-mode source code, we can saw a comment like following: Yes, for now, there is a person ask for it, that is me, i hope we can have it. In fact, i always write { block like this:
So, every time, i use ruby mode, i have to hack my own function, the only changes is. |
That is odd: I have tried reproducing this, and it (the file you have attached) opens pretty much instantly. Scrolls to the bottom pretty much instantly as well, certainly doesn't take several seconds. You might want to benchmark that process with the native profiler.
It is likely possible to bring
Right.
I use Emacs 29, but it's not native-compiled. And And its version of ruby-mode is the same as in Emacs 28. |
That's a pretty odd convention IMHO. Does Rubocop have a corresponding rule setting? Anyway, it shouldn't be too hard to add such user option. Will you |
Hi, @dgutov , because we are talking about the difference about ruby-mode and enh-ruby-mode in this thread, let me report some of them here after use ruby-mode a while.
as you can see in following screenshot, enh-ruby-mode (right side) render correct, but left, no.
First, i have one more question, what is the means of Okay, continue describe my indent issue, i don't like deep indent, so, i have to try disable all related config like this: (setq ruby-use-smie nil)
(setq ruby-deep-arglist nil)
(setq ruby-deep-indent-paren nil)
(setq ruby-deep-indent-paren-style nil) But, as you can see, ruby-mode not indent correct (left window), and rubocop give some advice too, then enh-ruby-mode always indent correct. |
Sorry for missing this message, Yes, please check https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/SpaceInsideBlockBraces, i disable it when i use rubocop. BTW: i request this issue on report-emacs-bug seveal days ago. |
BTW: for #136 (comment) issue 2, if i remove the parenthesis mark, indent work well when use default indent config (that is, keep ruby-use-smie as default t). though, rubocop warn me to add a parenthesis to avoid misunderstood the block part belongs to which. Parenthesize the param |
Right. You can customize the specific option:
Thanks. Did you miss the reply on the bug tracker? I've added said option a week ago: https://debbugs.gnu.org/53321 |
These are also reports for the bug tracker. But if you insist on keeping them here in the comments, oh well. You have touched on a couple of old (and relatively difficult) issues, especially the first one, with recursive nesting of literals through interpolations. I'll see what I can do now. |
Sorry, miss it because my emacs email client still not working, 😄 i am now testing it with copy ruby-mode.el from master branch to emacs-28 branch, it works as expected for now after set |
Hi, @dgutov i don't know why, my emacs-report-bug seem like not work anymore, so i report a ruby-mode bug here. Following code will cause indentation issue, because the double splat e.g. def resolve(**args)
members = proc do |**args|
p(**args) # indentation error
end # indentation error
member.call(**args) # indentation error
end But rubocop can format above code correctly. In fact, when my cursor on the But, instead, it jump to following location (please see screenshot) if change double splat to single splat in block parameter, will get correct indentation. def resolve(**args)
members = proc do |*args|
p(**args)
end
member.call(**args)
end ruby version3.1.0 emacs versionI use emacs mode which built on Emacs 28.1 release branch code. GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) of 2022-04-05 |
@zw963 Hi! Thanks for the report. Should be fixed now in 39646c822b, on the master branch. Emacs 28.1 has been released already, but I'll add ruby-mode to GNU ELPA in some foreseeable future. Regarding your "emacs-report-bug seem like not work anymore", what does the problem look like? |
* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token) (ruby-smie--backward-token): Tokenize "**" separately from "|". Problem reported at dgutov/robe#136.
Or, i find the issue caused by not correct config of mu4e, sorry for confusing.
Cool, thank you. |
enh-ruby-mode
.enh-ruby-mode
, but ruby-mode works
Following is a example:
above
case 1
andcase 2
field have same effect.When cursor on the case 1
CurrentUserResolver
, robe jump feature is works!But.
When cursour on the case 2
CurrentUserResolver
, will tipCan't find the locatin
.but code case 2 actually is working code, totally same as case 1, because
Resolvers::CurrentUserResolver
is under namespaced module,
module Types => module => UserQuery => Resolvers::CurrentUserResolver
I can reproduce this on ruby 3.1.0 with inf-ruby newest master.
Thank you.
Added:
CurrentUserResolver defined like this,
though, i consider this should not the reason, because another class define like this, not work too.
And, i use rails 6, autoloading feature use zeitwerk.
The text was updated successfully, but these errors were encountered: