-
Notifications
You must be signed in to change notification settings - Fork 236
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
Friendly error messages with expanded content #771
base: main
Are you sure you want to change the base?
Conversation
Sync up to upstream main
Add line number for friendly error messages.
Friendly error messages first draft
Fast forward will to upstream main
Hey @WillRabalais04! You are doing a great job. I will leave some comments here for you to address before the end of GSoC. Thanks! |
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.
This is looking good @WillRabalais04. If needed, you can leave the language server for me after GSoC. However, if you can please address the others, that would be great. Thanks for all of your great work!
Thread thread; | ||
|
||
public class friendlyErrorPopup{ | ||
|
||
private String messageText = "It looks like either a class name or semicolon is missing near 'asdfsda' on line 2!<br><br><b>Hint:</b> <br>Either a [class](https://processing.org/reference/class.html) was not given a name or a [semicolon](https://processing.org/reference/semicolon.html) is missing.<br><br><b>Suggestion:</b> <br>If the name was forgotten, add it and ensure that it does not start with a number. Make sure it only includes letters, numbers, dollar signs ($) and underscores (_). Also check that the name is not a keyword that is part of the language like \"true\", \"class\" or \"setup\" . If you are missing a semicolon, check the ends of the [statements](https://processing.org/examples/statementscomments.html) near 'if (' and line '43234234'.<br><br><b>For more:</b> [Variable Examples](https://processing.org/examples/variables.html)"; |
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.
Assuming this will be changed out for the error message from the properties file.
private JFrame popupFrame; | ||
final int PROCESSING_SAYS_OFFSET = 5; | ||
|
||
String markdownToHtml(String target) { |
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 possible to make this private? private String markdownToHtml(String target) {
Thread thread; | ||
|
||
public class friendlyErrorPopup{ |
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.
Class name conventions - https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
Please use FriendlyErrorPopup
return html; | ||
} | ||
|
||
public friendlyErrorPopup(String messageText){ |
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.
See above. public FriendlyErrorPopup(String messageText) {
|
||
// allows for error messages with markdown links in the first line although there currently are none | ||
while (linkSkipperMatcher.find()){ | ||
|
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.
Please consider removing this empty line
if (message.contains("viable alternative")) { | ||
|
||
// ST messageTemplate = new ST(getLocalStr("$statement$")); |
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.
If no longer needed, please remove this commented code.
localizations.put("editor.status.missing.name", "Missing name near %s?"); | ||
localizations.put("editor.status.missing.type", "Missing name or type near %s?"); | ||
localizations.put("editor.status.missing.default", "Missing '%s'?"); | ||
localizations.put("editor.status.error.syntax", "Syntax Error - TEST$statement$"); |
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.
Checking the inclusion of TEST
was intentional.
@@ -20,19 +20,19 @@ public void setup() { | |||
|
|||
@Test | |||
public void testPresent() { | |||
Optional<PdeIssueEmitter.IssueMessageSimplification> msg = strategy.simplify(" int x ="); | |||
Optional<PdeIssueEmitter.IssueMessageSimplification> msg = strategy.simplify(" int x =", 123); |
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.
Be sure to update the other tests as well!
@@ -20,13 +20,13 @@ public void setup() { | |||
|
|||
@Test | |||
public void testPresent() { | |||
Optional<PdeIssueEmitter.IssueMessageSimplification> msg = strategy.simplify("test(a,01a"); | |||
Optional<PdeIssueEmitter.IssueMessageSimplification> msg = strategy.simplify("test(a,01a", 123); |
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.
Thank you for updating tests <3
editor.status.hiding_enclosing_type = The class “$statement$” cannot have the same name as your sketch or its enclosing class | ||
|
||
editor.status.bad.assignment = There seems to be some trouble with how a variable is being assigned near line $linenumber$!<br><br><b>Hint:</b> <br>There is an issue with how a variable is being set to a certain value. This is also known as variable [assignment](https://processing.org/reference/assign.html). We suspect that the problem is near ‘$statement$’.<br><br><b>Suggestion:</b> <br>It’s important to double check that the variable is named properly (see the variable example below) and that you have included all of the necessary parts of a variable assignment. You should also make sure that you chose an appropriate [datatype](https://processing.org/reference/#data) for your variable so that it can hold the value that you are assigning to it.<br><br><b>Example:</b>To assign variables you need the type, name, assignment operator (=), the value you want to assign the variable to and a semicolon. Here’s the basic format:<br>[data type] [name] = [value]; <br><b>Example:</b> <br>int num = 4;<br><br>For more: [Variable Example](https://processing.org/examples/variables.html) | ||
editor.status.bad.generic = It looks like something (a generic) was not given a type to hold near line $linenumber$ near $statement$.<br><br><b>Hint:</b><br>When we're working with things like lists or arrays in Processing, you need to tell it what type of data it will hold. It seems like you forgot to specify the type of data you're using somewhere near line$linenumber$.<br><br><b>Suggestion:</b><br>The syntax for informing Processing about the intended data type of a data structure involves the use of angle brackets ('<>') referred to as generics. Typically, these angle brackets are placed after the name of the data structure.<br><br><b>Example:</b><br>If you want to store integers in a list, you would declare it like this: List<Integer> myList = new ArrayList<Integer>();<br><br><b>For More:</b> [Example of Data Structure ArrayList that Uses Generics](https://processing.org/examples/arraylistclass.html) |
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.
This is great but please check the language server experience. If needed, can do this together. It's possible that the PdeAdapter
will need to go up until the first <br>
or newline.
Hey Will! Thanks for addressing those comments. This is exciting! |
Hey @WillRabalais04! This is great thanks. I can't believe today is your last day for GSoC! We really appreciate everything you did for us this summer. I know we still need to tackle message localization and potentially some related copy edits on our side before this can go in (that are outside the scope of your GSoC work) so I will leave this as draft until @SableRaf and I connect on that final piece. This is a fantastic contribution! Please let me know if there is anything else I can do as you finish up. |
Final Report GSoC'23Project: Improving Friendly Error Messages
|
Thanks @WillRabalais04! We can work with our various volunteer localizers to take care of localization and the language server after localization! |
I also added your debugger fix to your final report! That's happily already in production shipped to thousands of developers <3 |
Sorry @WillRabalais04 also added ant and swing to your library list. |
It was great working with you and @SableRaf! It's great to know that this is going to be maintained after the GSoC period is over and I'm happy to keep contributing. |
Awesome! |
hey, is the issue is still open? i want to contribute in it |
is the issue still open? |
Superceeds processing/processing4#747, processing/processing4#748, and processing/processing4#749. This is for Google Summer of Code project on friendly error messages (see processing/processing4#741). This is led by @WillRabalais04.