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

Open
pulsar-edit/pulsar
#79
@Ephellon

Description

@Ephellon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions