pythonvisual-studio-codepython-language-server

Locally disable warnings of Python Language Server in Visual Studio Code


I have recently installed Python Language Server in Visual Studio Code.

I sometimes have some warnings that I want to locally disabled

For example, let's assume I have the following code:

import org.sikuli.script.SikulixForJython
from sikuli.Sikuli import *
from guide import *

It is normally run from Sikulix, which uses Jython libraries. Since my favorite editor cannot load this module, it would raise a warning:
unresolved import 'org.sikuli.script.SikulixForJython' Python(unresolved-import)

With pylint, I can disable that warning for only these 3 lines with something like:

# pylint: disable=unresolved-import
import org.sikuli.script.SikulixForJython
from sikuli.Sikuli import *
from guide import *
# pylint: enable=unresolved-import

How to do something similar with Python Language Server?

Thanks


Solution

  • There's currently no support for per-line warning suppression. To request such a feature, please open an issue at https://github.com/microsoft/python-language-server.