I had the same issue and couldn't figure out what was going on. I tried all the settings mentioned here and on other posts. But it made no difference. In the end I disabled and re-enabled Pylance and that fixed it. Just in case that's of use to anyone else struggling with this.