Pylance is Microsoft’s new and improved Python language server.

I have been using this in my Visual Studio Code remote editing sessions (editing Python codes on the machine learning Linux machine next to me, from my laptop), and I’m enjoying its new type-checking capabilities.

Today I discovered a little configuration change that improved my Pylance experience, so I thought I’d share in case it helps anyone else.

## Aside: ox-hugo exports with org-download screenshots

It was also an excuse to test how ox-hugo exports would work for a note straight from my daily journal if screenshots were involved.

I’ve been using org-download for quite a while now to get screenshots into my orgmode notes, in the attachment mode.

For ox-hugo to handle the attached screenshots correctly, it turns out you have to convert the [[attachment:...]] invocations to [[file:./rel/path/bloep.png][file:...]]

## Pylance type issue display

Back to the issue at hand:

Today as I was working, I noticed that VSCode shows a red squigly both for serious errors, like undefined variables or functions, and for type mismatches.

(I have the Pylance type checking mode set to basic.)

In this first example, you can see that it flags start_channel with a red squigly when there’s a type mismatch:

In this second example, notice how it uses the same squigly for an undefined variable.

I have to hover over the squigly to see the difference, whilst it would be far more convenient to see this at a glance.

## The solution

Fortunately, you can fix this by setting a severity override for the relevant diagnostic.

More specifically, if you add a severity override for reportGeneralTypeIssues to warning in the settings like this:

Type issues and other errors will now be more easily distinguishable, as you can see in the screenshot below: