Python-language-server: Language server hangs up and stops providing suggestions after typing in a certain module from the discord.py library

Created on 18 Nov 2019  路  6Comments  路  Source: microsoft/python-language-server

Environment data

  • Language Server version: 0.4.114.0
  • OS and version: Arch Linux, kernel version 5.3.8-zen1-1-zen
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4

Expected behaviour

The suggestions continue to work regardless of what is typed into the editor.

Actual behaviour

The suggestions work up until the moment the @commands annotation is typed, and they stop working when the dot is entered.

Logs

Posted to pastebin as they're quite long.

Code Snippet / Additional lnformation

Video demonstrating the issue.

As you can see here, the suggestions work up until the moment the @commands annotation is typed, and they stop working when the dot is entered.

  • python file:
from discord.ext import commands

@commands.command
async def test(ctx):
    pass
  • Pipfile:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
discord-py = "*"

[requires]
python_version = "3.7"
  • settings.json:
{
    "python.jediEnabled": false,
    "python.analysis.logLevel": "Trace"
}
bug

Most helpful comment

I can repro this. Looks like null reference exception

>   Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.FunctionEvaluator.TryDetermineReturnValue() Line 105   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.FunctionEvaluator.Evaluate() Line 55   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.ModuleSymbolTable.Evaluate(Microsoft.Python.Analysis.Analyzer.Symbols.MemberEvaluator e) Line 99   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.ModuleSymbolTable.Evaluate(Microsoft.Python.Parsing.Ast.ScopeStatement target) Line 87 C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.ModuleWalker.Walk(Microsoft.Python.Parsing.Ast.FunctionDefinition node) Line 197   C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.FunctionDefinition.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 197    C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.SuiteStatement.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 40 C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.PythonAst.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 83  C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Modules.PythonModule.Analyze(Microsoft.Python.Parsing.Ast.PythonAst ast) Line 413   C#

All 6 comments

I can repro this. Looks like null reference exception

>   Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.FunctionEvaluator.TryDetermineReturnValue() Line 105   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.FunctionEvaluator.Evaluate() Line 55   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.ModuleSymbolTable.Evaluate(Microsoft.Python.Analysis.Analyzer.Symbols.MemberEvaluator e) Line 99   C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.Symbols.ModuleSymbolTable.Evaluate(Microsoft.Python.Parsing.Ast.ScopeStatement target) Line 87 C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Analyzer.ModuleWalker.Walk(Microsoft.Python.Parsing.Ast.FunctionDefinition node) Line 197   C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.FunctionDefinition.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 197    C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.SuiteStatement.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 40 C#
    Microsoft.Python.Parsing.dll!Microsoft.Python.Parsing.Ast.PythonAst.Walk(Microsoft.Python.Parsing.Ast.PythonWalker walker) Line 83  C#
    Microsoft.Python.Analysis.dll!Microsoft.Python.Analysis.Modules.PythonModule.Analyze(Microsoft.Python.Parsing.Ast.PythonAst ast) Line 413   C#

OK, so far I figured that LS does return proper completions on @commands. However, one of the items documentation causes VS Code markdown parser to choke and that brings down the editor...

parent: Optional[Command] is the problem b/c of unescaped [ which makes link without an URL.

Should this be filed on VS Code, given bad markdown can come from anywhere? Pretty strange that we could return a string that'd break the client.

0.5.8+, currently in beta channel

Was this page helpful?
0 / 5 - 0 ratings

Related issues

doron-cohen picture doron-cohen  路  5Comments

ghost picture ghost  路  6Comments

luanft picture luanft  路  3Comments

mostafaeweda picture mostafaeweda  路  6Comments

jakebailey picture jakebailey  路  4Comments