This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Nullish Coalescing Operator (??) #680
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Replacing all
??
with||
does not suffice, and causes errors
- Replacing all
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
- Close, but does weird highlighting on large files: https://atom.io/packages/language-javascript-jsx
Description
Atom does not take ??
(Nullish Coalescing Operator) into account when highlighting/folding
Steps to Reproduce
- Use the JavaScript syntax highlighter
Copy/Paste
// ...
// Notifications
NOTIFICATIONS = $('[data-test-selector="onsite-notifications-toast-manager"i] [data-test-selector^="onsite-notification-toast"i]', true).map(
element => {
let streamer = {
live: true,
href: $('a', false, element)?.href,
icon: $('figure img', false, element)?.src,
name: $('figure img', false, element)?.alt,
};
if(!defined(streamer.name))
return;
element.setAttribute('draggable', true);
element.setAttribute('twitch-tools-streamer-data', JSON.stringify(streamer));
element.ondragstart ??= event => {
let { currentTarget } = event;
event.dataTransfer.setData('application/twitch-tools-streamer', currentTarget.getAttribute('twitch-tools-streamer-data'));
event.dataTransfer.dropEffect = 'move';
};
}
);
// ...
- Attempt to fold line 17 (it should be matched with line 22 but isn't)
Expected Behavior
- The JavaScript syntax highlighter should distinguish between
??
and? ...: ...
- The highlighter should also allow the correct code-folding for
??
Actual Behavior
- The syntax highlighter ignores
??
and treats it as? ...: ...
- Code-folding currently mismatches
{}
[]
and()
due to it thinking??
⇒? ...: ...
Reproduces how often:
100%
Versions
- Electron Version:
5.0.13
- Chrome Version:
73.0.3683.121
- Node Version:
v12.0.0
- Operating System:
Windows 10
- Last known working version: N/A
Additional Information
Screenshots
Incorrect pair being matched (line 17 → line 23)
Correct pair being matched (line 17 ← line 22)
Metadata
Metadata
Assignees
Labels
No labels