-
Notifications
You must be signed in to change notification settings - Fork 281
[WIP] Adding slowparse for HTML validation #876
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
Conversation
|
This is amazing. I love the playfulness, combined with how useful it is at the same time. |
|
How much work would it be to flag the "error" bit in red and the rest in dull greys? Having the |
|
@Pomax - I agree, the error is really within that We know that info is in there somwhere, since the expanded error message lets us hover to highlight |
… Also added a random "good" emoji when you fix your problem.
…tion when it opens.
|
I think at that point Slowparse should just delete your project. Can we do that? |
|
yes. yes we can. |
humphd
left a 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.
Doing a first pass over the code--I realize you're not done. Left a few things to do. Looking good.
| ] | ||
| } | ||
| }, | ||
| { |
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.
A few things you need to do here:
- Move this to
src/extensions/defaultinstead of../extra. Extensions in../extradon't get statically cached. - Copy the images over:
"copy": [
"extensions/default/HTMLHinter/images/*.*"
],- Build the CSS from your LESS:
"less": {
"dist/extensions/default/HTMLHinter/main.css": [
"dist/extensions/default/HTMLHinter/main.less"
]
}And then try and do npm run build and loading Brackets from dist/ vs. src/, and make sure everything loads properly.
| // for future use you fucken idiots. | ||
|
|
||
| var goodEmojis = [ | ||
| "biceps","halo","heart","peace","sunglasses","wink","horns","thumbs" |
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.
Spaces after , please
| return function() { | ||
| el.classList.add(randomEmoji); | ||
| }; | ||
| }(errorToggle), 400); |
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.
Can you pull these numbers 400, 1300 out and define them above as ALL_CAPS variables that are better documented?
| errorToggle.classList.add("nerd"); | ||
|
|
||
| var description = document.createElement("div"); | ||
| description.className = "errorPanel"; |
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.
Why not move this divinto the template instead of defining here in code?
| <!-- | ||
| <div class="regex-prop-summary"> | ||
| <h4><u>HTML Error</u></h4> | ||
| <h4>We found a problem</h4> |
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.
l10n this string.
|
|
||
| }, errorDisplayTimeoutMS); | ||
| } else { | ||
| clearAllErrors(); |
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.
Invert this logic so you don't have to indent:
if(!error) {
clearAllErrors();
return;
}
// Do all that other code here...| "INVALID_TAG_NAME": "<p>The <code><</code> character <em data-highlight='[[openTag.start]],[[openTag.end]]'>here</em> appears to be the beginning of a tag, but is not followed by a valid tag name.</p> <p>If you just want a <code><</code> to appear on your Web page, try using <code>&lt;</code> instead.</p> <p>Or, see a <a href='https://developer.mozilla.org/en/docs/Web/Guide/HTML/HTML5/HTML5_element_list'>list of HTML5 tags</a>.</p>", | ||
| "JAVASCRIPT_URL_NOT_ALLOWED": "<p>Sorry, but security restrictions on this site prevent you from using the <code>javascript:</code> URL <em data-highlight='[[value.start]],[[value.end]]'>here</em>. If you really need to use JavaScript, consider using <a href='http://jsbin.com/'>jsbin</a> or <a href='http://jsfiddle.net/'>jsfiddle</a>.</p>", | ||
| "MISMATCHED_CLOSE_TAG": "<p>The closing <code></[[closeTag.name]]></code> tag <em data-highlight='[[closeTag.start]],[[closeTag.end]]'>here</em> doesn't pair with the opening <code><[[openTag.name]]></code> tag <em data-highlight='[[openTag.start]],[[openTag.end]]'>here</em>. This is likely due to a missing <code></[[openTag.name]]></code> tag.", | ||
| "MISMATCHED_CLOSE_TAG": "<p>The closing <code data-highlight='[[closeTag.start]],[[closeTag.end]]'></[[closeTag.name]]></code> tag doesn't pair with the opening <code data-highlight='[[openTag.start]],[[openTag.end]]'><[[openTag.name]]></code> tag. This is likely due to a missing <code></[[openTag.name]]></code> tag.", |
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.
We should figure out the right way to do these strings. It isn't to have them in here. cc @gideonthomas
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.
All of this needs to be in the thimble repo in the /locales/en-US/editor.properties file. The tricky thing here is that there's a lot of code in the strings and I'm not sure how to handle that (it might be ok). Let's open up a PR for these strings in Thimble and get Theo to weigh in
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.
out of curiosity, I thought all these strings would be in slowparse? Are we managing them in brackets instead?
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.
slowparse has its own template messages, but those are pretty much "tailored for nothing", so we decided to only tap into Slowparse for the actual error + parse information, and have the "messages" that present that information in brackets, since that's the product that needs human language presentation, rather than slowparse itself.
|
OK—I'm going to pick this up again and see if i can get it running. I don't want to let this die, so maybe we'll try to roll it out one rule at a time or something like that instead of all-at-once. |
…three rules for now.
|
@Pomax how much more work is left on this? I haven't followed it closely enough to understand the cost of continuing. What I saw of the live demo stuff looked really good. I'll do work to finish it if it's close. |
|
@Pomax, @gideonthomas I'd like to see this get landed. I'll try to finish it with my students this term. |
|
@humphd I'm going through my mentioned list to see if I can close anything out, this feels like it's probably a passed station by now? (Especially given Thimble's retirement) |
|
Yes, we can close. |


Currently in Progress
highlightobject into the error messages instead of relying on thetokenwhich not all the errors have access to.Tracking issue: https://github.com/mozilla/thimble.mozilla.org/issues/2456
Related PR in Slowparse
Priority Todo
Sometimes the error highlight isn't cleared after an error is resolvedSecondary Todo
Links
Currently looks like this...
Latest updates
cm-errorclass basicallylive-syncerror line-highlight in the gutter