microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.62k forks source link

IW tab shows dirty and indicates error for invalid syntax in a cell input #199244

Closed amunger closed 6 months ago

amunger commented 9 months ago

Steps to Reproduce:

  1. Create a python file with an if statement
  2. select only the line with the if statement and press ctrl+enter to execute it in the interactive window 🐛 tab is marked dirty and indicates an error

image

amunger commented 9 months ago

no errors are shown in the cell input, likely because the editor is read-only image

amunger commented 9 months ago

I can't repro in OSS, so maybe it's fixed in the latest

amunger commented 9 months ago

@rchiodo - This only repro's with Pylance pre-release, but I still can't get it to repro in OSS to track down where the decoration is being set.

Do you know if there were any changes to Pylance in regards to checking read-only editors? The tooltip for the tab is "Contains emphasized items" if that's any help. Also, any idea why the behavior would change in OSS?

cc @bpasero in case you have any ideas for where to look.

rchiodo commented 9 months ago

I'm confused as to why this is a bug? Seems like a syntax error to me?

What is the wanted behavior?

rchiodo commented 9 months ago

Oh and pylance shouldn't know if the editor is read only or not. We do have some special case code for the interactive window though:

https://github.com/microsoft/pyrx/blob/d60773cdf3a6ba92b0537f2693817313fa9ec8e5/packages/vscode-pylance/src/host/node/interactiveWindowAddon.ts#L22

The code here hasn't changed in a long time, but perhaps some event or functionality in VS code we rely on has changed.

rchiodo commented 9 months ago

Oh I think I figured out what the wanted behavior is. You want an error in the cell, not in the output.

Kinda like this: image

amunger commented 9 months ago

An error within the cell would probably be a nice improvement, but I was more concerned with marking the whole tab as in an error state for an editor that the user cannot change (except for just deleting the cell).