Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4677

Nullish coalescing operator (??) in JavaScript reported as an error in NetBeans.

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 12.0.1
    • None
    • javascript - Editor

    Description

      The following code is showing as an error in the IDE when it has a valid syntax in JavaScript:

       

      let myVariable = null ?? 'hello world';

       

       
       

      Attachments

        Activity

          Sidereal_Engine Rumi Mohammad added a comment -

          The same goes for nullish assignments `??=`.

          I'd flag this as more than minor because it messes with the Format Code functionality, making everything align oddly and sometimes locking up the CPUs in a lengthy formatting process. It just crashed now, and I lost quite a bit of code. Stupid of me not to save before trying to format when I know this is broken...

          My current workaround is to include blank comments above the first line with a nullish assignment in each code block. For example:

           

           

          {
            let x = x || 'this is ok';
            //
            let y ??= 'please fix this',
              z ??= 'so formatting can work again';
          }
          

           

          Sidereal_Engine Rumi Mohammad added a comment - The same goes for nullish assignments `??=`. I'd flag this as more than minor because it messes with the Format Code functionality, making everything align oddly and sometimes locking up the CPUs in a lengthy formatting process. It just crashed now, and I lost quite a bit of code. Stupid of me not to save before trying to format when I know this is broken... My current workaround is to include blank comments above the first line with a nullish assignment in each code block. For example:     { let x = x || ' this is ok' ; // let y ??= 'please fix this ' , z ??= 'so formatting can work again' ; }  
          chrizzly Christian Lenz added a comment -

          It is just about the missing update of the JavaScript lexer/parser. As you can see it was just updated to ES 7 (experimental). So I guess `?.` will aoso throw an error.

          chrizzly Christian Lenz added a comment - It is just about the missing update of the JavaScript lexer/parser. As you can see it was just updated to ES 7 (experimental). So I guess `?.` will aoso throw an error.

          People

            Unassigned Unassigned
            Goliath Nghia Nguyen
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: