Skip to content
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

[JSX] Comment not working in HTML content #2461

Closed
jfcherng opened this issue Aug 24, 2020 · 4 comments · Fixed by #2787
Closed

[JSX] Comment not working in HTML content #2461

jfcherng opened this issue Aug 24, 2020 · 4 comments · Fixed by #2787

Comments

@jfcherng
Copy link
Collaborator

jfcherng commented Aug 24, 2020

Disclaimer: I don't write JSX.
Disclaimer: I don't write JSX.
Disclaimer: I don't write JSX.

But there must be something wrong here.


  • Sublime Version: 4083
  • OS Version: Win7 x64
export default function Foo(props) {
  return (
    <div>
      <Foo>
      </Foo>
    </div>
  );
}

If you want to comment out the <Foo>...</Foo> part with ctrl+/ (or ctrl+shift+/), it gives
image

VSCode gives this
image

References

@michaelblyons
Copy link
Collaborator

michaelblyons commented Aug 24, 2020

Commenting should be fairly simple. You just make another tmPreferences for source.jsx meta.jsx. The interesting thing might be uncommenting: Can you make it remove the whole {/*...*/} if it's contiguous, but fall back to {foo} if it sees {foo /* here's a comment */}?

Edit: I also don't use JSX, so apologies if I made a silly assumption here.

@Thom1729
Copy link
Collaborator

I've added a PR to copy over JS Custom's JSX commenting. It's not completely satisfactory. See Thom1729/Sublime-JS-Custom#21 for another discussion.

Most likely, getting it perfect would require changing how the commenting command works, which is unlikely to happen.

@jfcherng
Copy link
Collaborator Author

Most likely, getting it perfect would require changing how the commenting command works, which is unlikely to happen.

Maybe need a dedicate built-in .py plugin to hijack the toggle_comment and perform (de-)commenting according to the cursor scope.

@FichteFoll
Copy link
Collaborator

There are some issues related to how toggle_comment currently works, particularly sublimehq/sublime_text#446.

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 a pull request may close this issue.

4 participants