We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following python code:
class A: def __init__(self): self.prop = "A property"
The response to a docSymbols request is:
{ "name": "A", "kind": 5, "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 2, "character": 32 } }, "selectionRange": { "start": { "line": 0, "character": 6 }, "end": { "line": 0, "character": 7 } }, "detail": "class A", "children": [ { "name": "__init__", "kind": 6, "range": { "start": { "line": 1, "character": 4 }, "end": { "line": 2, "character": 32 } }, "selectionRange": { "start": { "line": 1, "character": 8 }, "end": { "line": 1, "character": 16 } }, "detail": "def __init__", "children": [ { "name": "prop", "kind": 7, "range": { "start": { "line": 2, "character": 8 }, "end": { "line": 2, "character": 32 } }, "selectionRange": { "start": { "line": 2, "character": 13 }, "end": { "line": 2, "character": 17 } }, "detail": "self.prop = \"A property\"", "children": [] } ] } ] }
You can see that 'prop' is a child of __init__, but I think that it should be a child of the class A.
__init__
The problem is the following code in jedi_utils.py.lsp_document_symbols:
elif name.is_side_effect() and name.get_line_code().strip().startswith( "self." ): # handle attribute creation on __init__ method symbol.kind = SymbolKind.Property parent_symbol = _name_lookup[parent] assert parent_symbol.children is not None parent_symbol.children.append(symbol)
I think this should be replaced with:
elif ( name.is_side_effect() and parent.name == "__init__" and name.get_line_code().strip().startswith("self.") ): # handle attribute creation on __init__ method symbol.kind = SymbolKind.Property grandparent_symbol = _name_lookup.get(parent.parent()) if grandparent_symbol and (grandparent_symbol.kind == SymbolKind.Class): grandparent_symbol.children.append(symbol)```
The text was updated successfully, but these errors were encountered:
Thanks!
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Consider the following python code:
The response to a docSymbols request is:
You can see that 'prop' is a child of
__init__
, but I think that it should be a child of the class A.The problem is the following code in jedi_utils.py.lsp_document_symbols:
I think this should be replaced with:
The text was updated successfully, but these errors were encountered: