-
Notifications
You must be signed in to change notification settings - Fork 189
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
Multi line error message fixed #2407
Multi line error message fixed #2407
Conversation
bf9c37e
to
02db99b
Compare
Test Results 1 820 files - 1 1 820 suites - 1 1h 52m 37s ⏱️ + 4m 39s For more details on these failures, see this check. Results for commit 506587a. ± Comparison against base commit 4fbbe1b. ♻️ This comment has been updated with latest results. |
31f1538
to
822cb36
Compare
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.
I have some minor comments regarding the coding style.
I also tested it and sometimes the ^
is a bit off.
Regex: [df
--> ❌ (a bit to the right)
Maybe you can work with Hair spaces or Thin spaces?
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
I think it is important to mention here that this PR relies very heavily on the RegEx error message format. https://docs.oracle.com/javase/8/docs/api/java/util/regex/PatternSyntaxException.html#getIndex-- Java DOES have a method that helps with building your own error message - the catch: the FindReplaceTargetStatus object does not provide them. It should be rather easy to add those into the object and to modify the message generator if required. |
Modify in org.eclipse.ui.internal.findandreplace.status.InvalidRegExStatus public int getIndex() {
return regExException.getIndex();
}
public String getPattern() {
return regExException.getPattern();
} |
439ae05
to
c5dacd2
Compare
@@ -14,11 +14,13 @@ | |||
|
|||
package org.eclipse.ui.internal; | |||
|
|||
|
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.
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.
done
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.
done
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
@jannisCode please adapt the commit message to suit the recommendations |
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
c5dacd2
to
856d61d
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
856d61d
to
b2dbc4a
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
b2dbc4a
to
dbb5d95
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
dbb5d95
to
973a4b5
Compare
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.
As discussed in today's call, here are some tips:
- Don't pass the
ControlDecoration
as a parameter, only theControl
, - Return earlier in case
e.getIndex() == -1
and avoid creating aStringBuffer
, - Extract methods from the whole
catch
block to improve readability, - Use hair spaces (they are thinner than thin spaces)
- Try to compute the amount of hair spaces that you need to add before the
^
. In the end, the ideal result is when the tip of the "^
" is placed right in the middle of the offending character.
7f97527
to
776bc90
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
776bc90
to
1899287
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
1899287
to
3b94952
Compare
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 results are much better now. There are only a few comments about the coding but after they are addressed, this PR will be ready to go 👍
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.ui/src/org/eclipse/ui/internal/SearchDecoration.java
Outdated
Show resolved
Hide resolved
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
3b94952
to
7481f80
Compare
When showing the multi line error message, the arrow ^ now points on the right character. eclipse-platform#2407
7481f80
to
cd86714
Compare
cd86714
to
9362717
Compare
9362717
to
3c3d8cc
Compare
Failed check: see #2432 |
@jannisCode which changes did you introduce when you force-pushed 3c3d8cc? I can't see any difference in the code when I compare it to my previous commit (9362717), only that you removed me as co-author. |
@fedejeanne I am pretty sure that it was just an update with rebase. I definitely didn´t mean to remove you as co-author |
3c3d8cc
to
99a0785
Compare
bf93796
to
4baf0d1
Compare
When using a regular expression for a search, if there is enough information as to where the invalid character of the expression is then a multiline error message will be shown. The first line contains the regular expression and the second line contains an arrow (^) that points to the offending character.
4baf0d1
to
506587a
Compare
👍 After the checks are done, I will merge this. Please do not push any more changes. |
@jannisCode care to add a N&N entry? :-) |
What it does
This PR solves the issue from here: (vi-eclipse/Eclipse-Platform#130 (comment))
Before
The error message did not handle the different widths of characters well. Especially the ^ was on the wrong charachter, basically making it useless.
After
Now the ^ is on the right character, no matter what the user types in.