-
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
Initial attempts to add more haskell rules #180
Conversation
Yes,
I put It fails through the
|
Alright, so as far as I've managed to figure out: ag doesn't support multiline when input is coming from stdin, so it has nothing to do with dumb-jump itself. IDK if it's possible to fix. Maybe we can change |
I actually did the same thing for |
Okay, if you do the following then it all works:
Except, of course, that The deal was that while running this test it cannot show the line numbers, like:
That's why it needs Edit: And it only starts showing line numbers when matching multiline input from stdin. |
Thank you, @netromdk. This is very helpful and I'll adopt it soon. I don't have a lot of time these days (was unsuccessfully testing my changes today) but I hope to finish this PR soon :) |
So I figured out I had a configuration mistake: my |
dumb-jump.el
Outdated
@@ -1168,21 +1166,31 @@ If `nil` always show list of more than 1 match." | |||
"Use TEST as the standard input for the CMD." | |||
(with-temp-buffer | |||
(insert test) | |||
(shell-command-on-region (point-min) (point-max) cmd nil t) | |||
(shell-command-on-region (point-min) (point-max) cmd (current-buffer) t) |
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.
Is it necessary to use (current-buffer)
? I can see in the doc on shell-command-on-region
that:
If the value is nil, use the buffer ‘Shell Command Output’.
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.
Ok, right!
Looks great! :) |
@netromdk is there any way i can match on something different from (i guess it's not possible, but asking anyway) |
Well, "JJJ" is just substituted the search term but it's up to the regexp to worry about case sensitivity.
I think most rules kind of assume case-insensitivity. But at least for Off the top of my head; If we wanted to support this then the rule itself would have to be annotated with a case-matching mode, "like starts with capital letter", which is matched against the value substituting in for "JJJ". This annotation could actually be a regexp in itself to weed out which search terms are even tried with the rule. Food for thought. What do you think about that, @jacktasia btw? |
I'm a little bit stuck. I have a set of rules. Pattern Any ideas what it can be? Maybe there's some magic about the way rules are matched? It seems that adding extra rule (which perfectly works on tests i provide) ruins everything. |
That sounds weird, @volhovm. Do you mean it doesn't work with the inline rules but it works when you "jump" inside Emacs? And could you give an example of what's not working in code/examples. |
Changes Unknown when pulling ccb69df on volhovm:master into ** on jacktasia:master**. |
Changes Unknown when pulling ccb69df on volhovm:master into ** on jacktasia:master**. |
I think I'm actually done with this PR. Rules cover 99% of things i want, they work fast. I don't see any obvious problems. |
Changes Unknown when pulling 66cead4 on volhovm:master into ** on jacktasia:master**. |
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.
Looks good. I'm looking forward to using your rules on my own Haskell programs!
dumb-jump.el
Outdated
@@ -699,7 +699,7 @@ or most optimal searcher." | |||
:tests ("newtype Test a = Something { b :: Kek }" | |||
"data Test a b = Somecase a | Othercase b" | |||
"type family Test (x :: *) (xs :: [*]) :: Nat where" | |||
"data family Test" | |||
"data family Test " |
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.
Is this space on purpose?
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.
Yes. I believe that every identifier should be followed by a space or eof. \b
doesn't work because in haskell we have a lot of things like Identifier
and Identifier'
, so matching first will match second also.
Oh, it's no problem. You're welcome :) |
Thanks again! |
Alright, so I want to extend haskell support a little bit at least. This PR is currently WIP, because there are things I'm stuck with and I'd like somebody to help me (maybe). The main one is: does
ag
support multiline matching? I see a proof (here ggreer/the_silver_searcher#682) that it does, but for some reasons my tests show otherwise.