Skip to content

Conversation

@flukeout
Copy link

@flukeout flukeout commented Sep 14, 2017

Currently in Progress

  • Auditing the rules in strings.js one-by-one

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 resolved
  • Sometimes slowparse doesn't fire when the editor first loads, must be some kind of timing thing

Secondary Todo

  • Cannot right-click links in the error message copy.
  • Add a hover treatment to the emoji to make it clickable? Give it a little animation!? Something?
  • Adapt the emoji/icon styling to that it works with long lines of code
    • Not sure how to handle this. We'd have to estimate if the code on a line fills up enough space to make it difficult to show the icon.
  • Update the box title to show the error type and not just "We Found an Error"
    • I've just commented it out for now.
  • Update the color of the highlights when hovering over the message and make sure that if it strobes, it works with the strobing of the underline underneath the error.
  • Consider: do we need to make the emoji more clickable / discoverable?
  • Finalize error message presentation & formatting
    • Then, re-write all of the descriptions to match, dang it.
    • Probably ditching the "here" text for the hover effect is the main change.

Links

Currently looks like this...

image

Latest updates

  • Removed CodeMirror's native syntax highlighting for errors (all the pink highlights)
    • I just overwrite the cm-error class basically
    • Removed live-sync error line-highlight in the gutter
  • Testing out turning the document grey after the error
    • Not sold on this yet

@humphd
Copy link

humphd commented Sep 15, 2017

This is amazing. I love the playfulness, combined with how useful it is at the same time.

@Pomax
Copy link

Pomax commented Sep 19, 2017

How much work would it be to flag the "error" bit in red and the rest in dull greys? Having the </x> in grey makes it fall off the mental map a little.

@flukeout
Copy link
Author

@Pomax - I agree, the error is really within that </x> so we shouldn't be hiding it in the grey. Currently the parser gives us the cursor position of the error, which I'm using to make the grey highlight. In the parser's estimation, the error started right before </x>. We'd need to extract some additional data to know where to end the red highlight we want to add.

We know that info is in there somwhere, since the expanded error message lets us hover to highlight </.

@Pomax
Copy link

Pomax commented Sep 19, 2017

Looks like slowparse itself might be flagging a bad case, too:

image

Rather than the error "the closing tag </p is missing the final >", it seems to "see" a tag </p> despite that final > not existing, and somehow relates it to the <body> tag.

@Pomax
Copy link

Pomax commented Sep 21, 2017

super sweet ♫ although of course I did just find another quirk:

image

intuitively this should be "following background:green;"

@flukeout
Copy link
Author

I think at that point Slowparse should just delete your project. Can we do that?

@Pomax
Copy link

Pomax commented Sep 21, 2017

yes. yes we can.

Copy link

@humphd humphd left a 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.

]
}
},
{
Copy link

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:

  1. Move this to src/extensions/default instead of ../extra. Extensions in ../extra don't get statically cached.
  2. Copy the images over:
    "copy": [
        "extensions/default/HTMLHinter/images/*.*"
    ],
  1. 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"
Copy link

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);
Copy link

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";
Copy link

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>
Copy link

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();
Copy link

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>&lt;</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>&lt;</code> to appear on your Web page, try using <code>&amp;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>&lt;/[[closeTag.name]]&gt;</code> tag <em data-highlight='[[closeTag.start]],[[closeTag.end]]'>here</em> doesn't pair with the opening <code>&lt;[[openTag.name]]&gt;</code> tag <em data-highlight='[[openTag.start]],[[openTag.end]]'>here</em>. This is likely due to a missing <code>&lt;/[[openTag.name]]&gt;</code> tag.",
"MISMATCHED_CLOSE_TAG": "<p>The closing <code data-highlight='[[closeTag.start]],[[closeTag.end]]'>&lt;/[[closeTag.name]]&gt;</code> tag doesn't pair with the opening <code data-highlight='[[openTag.start]],[[openTag.end]]'>&lt;[[openTag.name]]&gt;</code> tag. This is likely due to a missing <code>&lt;/[[openTag.name]]&gt;</code> tag.",
Copy link

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

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

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?

Copy link

@Pomax Pomax Sep 26, 2017

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.

@flukeout
Copy link
Author

flukeout commented Dec 5, 2017

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.

@Pomax
Copy link

Pomax commented Jan 18, 2018

@flukeout @humphd do we want to keep this PR open, or land it to its own branch that others can perhaps pick up on to finish? I don't think that we'd be finishing this work on our own, unfortunately =(

@humphd
Copy link

humphd commented Jan 18, 2018

@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.

@humphd
Copy link

humphd commented Feb 2, 2018

@Pomax, @gideonthomas I'd like to see this get landed. I'll try to finish it with my students this term.

@Pomax
Copy link

Pomax commented Mar 21, 2019

@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)

@humphd
Copy link

humphd commented Mar 21, 2019

Yes, we can close.

@humphd humphd closed this Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants