setNextRequest disables/changes highlight on following code?

Hi,

I’ve recently started using Postman and was messing about with postman.setNextRequest()

I noticed that after I use setNextRequest, the syntax highlighting on the following code changes:

With setNextRequest:
image

Without setNextRequest:
image

In another instance I need to comment out both setNextRequest and pm.variables.set to get the correct syntax highlight back:
image
Both the “red” lines must be commented out to get syntax highlight back. Just commenting the setNextRequest is not enough

I am fairly new to this, so I am not sure if this is intended and expected (to illustrate that the code is not executed? - although it seems to be)
Or if there is some setting somewhere that I can change so that setNextRequest does not cause this behavior.

Is this known and expected behavior?

Thanks :slight_smile:

Hi @ezs

Recreated this on my machine and it appears the the ??0 in the let i = pm.variables.get("i")??0 causes this.

After some reading, I assume that this is a “nullish coalescing operator”.

Unfortunately, I don’t know enough about JavaScript to really suggest a reason or fix. But I believe this is what causes the syntax issue you see.

1 Like

Ah, I did not consider that one. But I see there are others on the google having similar issues with that operator.

I have one of those further up in my code on the first example as well. And commenting that out brings the syntax highlight back.

Thanks!

1 Like