think-info opened a new issue, #4246:
URL: https://github.com/apache/netbeans/issues/4246
### Apache NetBeans version
Apache NetBeans 14
### What happened
Working with Promise in JS, correct syntax is highlighted as errors and/or
warnings.
This occurs with `Promise.all()` and `Promise.then()`. I know it affects
extensions of `Promise`, such as `fetch().then()`.
Of special note: a single instance of the syntax being erroneously
highlighted will result in all other instance of `Promise` (and `fetch`) within
the same file being marked as errors even though they are correct and not
highlighted without the triggering error being present.
In the most basic version of the error, per first example below, every
`Promise` is highlighted with the warning _Global variable "Promise" is not
declared_. If the `Promise.resolve()` and `Promise.all()` are removed, the
remaining `new Promise` is no longer highlighted.
In the second example, the same error is shown on the `fetch()`, but if the
`.then()` statements are removed, the supposed error goes away.
### How to reproduce
Use sample `Promise.all()` code from MDN:
```
const p1 = Promise.resolve(3);
const p2 = 1337;
const p3 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("foo");
}, 100);
});
Promise.all([p1, p2, p3]).then(values => {
console.log(values); // [3, 1337, "foo"]
});
```
Use sample `fetch()` code from MDN:
```
fetch('http://example.com/movies.json')
.then(response => response.json())
.then(data => console.log(data));
```
### Did this work correctly in an earlier version?
No
### Operating System
Windows 11
### JDK
18.0.1.1 Windows 64 bit
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
I say this didn't work in previous versions, but I don't know whether that
is the case. New machine, new install, and first time I ever make a `Promise()`.
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists