expo / expo/snack

Editor incorrectly identifies comments in JSX

Open
#53 1 comment 3 reactions 0 assignees View on GitHub
website
Dominant language
TypeScript
Stars
510
Forks
178
Avg merge
5h 7m
Merged PRs (30d)
5

Description

If you comment a line of JSX using `//` or a block using `/* ... */` it renders as a comment (greyed out) in the editor, but it is not treated as a comment by the framework. Moreover, if you use a keyboard shortcut (ex: `Command+/` on macOS) to comment out a selection or current line, the editor will insert `//` which again does not make a valid comment.

See screenshot where a line 16 appears commented out but isn't actually.

Expected: Apparently comments in JSX need to be delineated with `{/* ... */}` and anything else should not be rendered greyed out.

![image](https://user-images.githubusercontent.com/611807/78703429-fbb0aa80-78be-11ea-897a-35d17a8c455b.png)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the editor with JSX lines using //, /* ... */, and the Command+/ shortcut. Inspect the editor behavior for comment highlighting and shortcut insertion; done means only {/* ... */} is treated as a JSX comment and the shortcut produces valid JSX comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.