GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Newer JS operators ("?.", "??") break indenting/coloring in code editor · Issue #3115 · greasemonkey/greasemonkey

Newer JS operators ("?.", "??") break indenting/coloring in code editor #3115

New issue
Copy link
New issue
Copy link
Closed
Closed
Newer JS operators ("?.", "??") break indenting/coloring in code editor#3115
Copy link
Milestone
4.12

Description

@istarogh
istarogh
opened on Apr 29, 2021
Issue body actions

In Greasemonkey's built-in code editor, using the optional chaining operator (?.) or the nullish coalescing operator (??) at any point in a script breaks indentation and syntax coloring for the rest of the script. The exact way in which it breaks depends on the specifics of the surrounding expression; I've seen this cause the rest of the script to be treated as a comment, a string, or a template literal.

Reacted by Sebastian Simon, vzjrz, Felix Bernhard, Felix S. and FreeFull

Activity

  1. istarogh commented on May 15, 2021

    @istarogh
    istarogh
    on May 15, 2021
    Author
    More actions

    Updating /third-party/codemirror/mode/javascript/javascript.js to the latest version thereof over at github/codemirror/CodeMirror/blob/master/mode/javascript/javascript.js should fix this, but I'm afraid I'm way too new at this to know how to do so myself, or more importantly, know whether doing so might break something else.

  2. esperecyan
    added 2 commits that reference this issue on May 25, 2022

    Add feature syncing user scripts with local files via WebDAV server

    a8210da

    Add feature syncing user scripts with local files via WebDAV server

    64a2398
  3. arantius commented on Nov 8, 2023

    @arantius
    arantius
    on Nov 8, 2023
    Collaborator
    More actions

    AFAICT 5912965 fixes this.

  4. arantius
    closed this as completedon Nov 8, 2023
  5. arantius
    added this to the 4.12 milestone on Nov 8, 2023
  6. arantius commented on Nov 29, 2023

    @arantius
    arantius
    on Nov 29, 2023
    Collaborator
    More actions

    This should be done. I could use your help testing this! Checkout or download Greasemonkey's source code, then follow the documentation for installing an extension during development. As far as I know this will break installed scripts, so you should use about:profiles to create and launch a new blank Firefox profile to do so, rather than overwriting your existing Greasemonkey install. (Maybe take a Greasemonkey backup first to be safe.)

    Any testing results, positive or negative, would be great.

  7. istarogh commented on Nov 29, 2023

    @istarogh
    istarogh
    on Nov 29, 2023
    Author
    More actions

    Looks good to me. I installed the current code as a temporary add-on per that documentation, and as a minimal initial test, made a new userscript containing just

    const x = 1 || 2;
    const y;

    and the y variable name remained blue upon replacing the || with a ??, whereas in the live version, making the same script and then replacing the || with a ?? turns the y black.

    As a more realistic test I then added a strategic ?. to an existing script of mine and it worked fine, whereas doing so makes all subsequent coloring very wonky in live.

    BTW, I didn't want to bother making a new profile, so I did this on a laptop I rarely use, and FWIW it actually did not break installed scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      • 4.12

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.