Python LSP Parser Questions

I am trying to use the python lsp parser and have a couple of questions.
1 - The imports are tagged as errors. How do I tell it where to find the imports so this doesn't happen?
2 - Is there a way to disable certain warnings (for example, the line length warning)?
1. You can put your modules' .py files in the same folder as your edited files, then language server will not highlight them as errors. If this doesn't help you, could you please specify which modules are you using and where they are located?
2. You can disable the Python linter warnings like this:
- derive a class from PythonParser like so:
class MyPythonParser : Alternet.Syntax.Parsers.Lsp.Python.PythonParser
protected override string WorkspaceRoot => @"my_workspace_folder_path";
and use it in the Alternet editor control.
- in the my_workspace_folder_path folder, put the file named setup.cfg with the following contents:
ignore = E302,
You can read more about pycodestyle configuration here:
Also you can suppress any errors/warning directly in the editor like so:
class MyPythonParser : Alternet.Syntax.Parsers.Lsp.Python.PythonParser
// ...

protected override ISyntaxError DiagnosticToSyntaxError(OmniSharp.Extensions.LanguageServer.Protocol.Models.Diagnostic value)
// you can also filter out the errors by message if needed.
switch (value.Code.String)
case "E302":
return new SyntaxError();
return base.DiagnosticToSyntaxError(value);
I tried your suggestion for overriding PythonParser and suppressing the errors in the editor - it works really well and I can let my users decide which errors they want to suppress.
This is where I am at now with import problems:
For things that are part of my python package, the import statement never had a red squiggle and intellisense works as expected.
For built in packages (os, logging, argparse), the import statement is marked as an error with a red squiggle, but intellisense works if I tried to use it. For example,
import os = red squiggle
os.getcwd() = no error + intellisense worked
In the parser, I ignored errors where source = pylint and the red squiggles went away (Let me know if this is a bad idea).
For other packages that I installed (for example, networkx), no red squiggle on the import, but it also does not give me intellisense.
I think the problem with the imports is related to the fact we are using an embeddable Python distribution to run the language server. We deploy this distribution with all required packages installed to %TEMP%\Alternet.Lsp.Servers.Palantir.Pyls.Bundle, and run the server from there. Therefore the language server looks for the modules for autocompletion etc. in that embeddable python folder.
As I understood, you would like to use a different python distribution with your own installed module set. One solution I can suggest is to install the language server for your python installation like this:
pip install python-language-server[all]
and then use it in the parser like this:

class MyPythonParser : Alternet.Syntax.Parsers.Lsp.Python.PythonParser
protected override OmniSharp.Extensions.LanguageServer.Client.Processes.ServerProcess StartServer()
var pylsPath = Alternet.Common.CommandLinePathResolver.TryGetFullPathForCommand("pyls"); // you can replace this by a hard-coded path (e.g. c:\Python\Python37\Scripts\pyls.exe).

return new OmniSharp.Extensions.LanguageServer.Client.Processes.StdioServerProcess(
new ProcessStartInfo(pylsPath, ")
WorkingDirectory = Path.GetDirectoryName(pylsPath)
After that all the globally installed modules are not underlined as errors and are auto-completed properly (I installed networkx package and checked).
Regarding the "os.getcwd() = no error + intellisense worked" issue - I think this stems from the fact the embeddable python distribution doesn't have some system script files required by the language server. We will investigate the ways to fix this.
However, if in case with using a server installed on a non-embeddable distribution (like I described above), you should not have such problems.
That works, thanks for your help!