Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Nullish Coalescing Operator (??) #680

Open
1 task done
Ephellon opened this issue Oct 7, 2020 · 2 comments · Fixed by pulsar-edit/pulsar#79 · May be fixed by #686
Open
1 task done

Nullish Coalescing Operator (??) #680

Ephellon opened this issue Oct 7, 2020 · 2 comments · Fixed by pulsar-edit/pulsar#79 · May be fixed by #686

Comments

@Ephellon
Copy link

Ephellon commented Oct 7, 2020

Prerequisites

Description

Atom does not take ?? (Nullish Coalescing Operator) into account when highlighting/folding

Steps to Reproduce

  1. Use the JavaScript syntax highlighter
  2. 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';
        };
    }
);
// ...
  1. Attempt to fold line 17 (it should be matched with line 22 but isn't)

Expected Behavior

  1. The JavaScript syntax highlighter should distinguish between ?? and ? ...: ...
  2. The highlighter should also allow the correct code-folding for ??

Actual Behavior

  1. The syntax highlighter ignores ?? and treats it as ? ...: ...
  2. 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 17line 23)

image

Correct pair being matched (line 17line 22)

image

@icecream17 icecream17 linked a pull request Nov 13, 2020 that will close this issue
@Emrio
Copy link

Emrio commented Aug 19, 2021

This also breaks syntax highlighting in Javascript and Typescript (although people may say true developers do not need syntax highlighting, seeing the wrong colors is disturbing xD)

Bildschirmfoto 2021-08-20 um 00 51 23

@djcaesar9114
Copy link

Will this be solved in a future release?
I'm considering using VisualStudio because the syntax highlighting in Atom becomes ugly when using xxx ?? yyy or xxx?.yyy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants