This repository was archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Symbols returned with wrong kind. #1
Copy link
Copy link
Closed
Description
In the VS Code Python extension we are sending a textDocument/documentSymbol request and using the result to position code lenses. The data we get back is mostly correct. However, the "kind" (i.e. VS Code's SymbolKind) is consistently off by one. For example, using the following Python code:
import unittest
class SpamTests(unittest.TestCase):
def test_all(self):
self.assertTrue(False)I got the following JSON response from the language server (formatted for clarity):
[{
"name":"SpamTests",
"detail":"SpamTests",
"kind":5,
"deprecated":false,
"range":{
"start":{"line":2,"character":6},
"end":{"line":2,"character":15}
},
"selectionRange":{
"start":{"line":2,"character":6},
"end":{"line":2,"character":15}
},
"children":[{
"name":"test_all",
"detail":"test_all",
"kind":12,
"deprecated":false,
"range":{
"start":{"line":3,"character":4},
"end":{"line":4,"character":30}
},
"selectionRange":{
"start":{"line":3,"character":4},
"end":{"line":4,"character":30}
},
"children":[{
"name":"self",
"detail":"self",
"kind":13,
"deprecated":false,
"range":{
"start":{"line":3,"character":17},
"end":{"line":3,"character":21}
},
"selectionRange":{
"start":{"line":3,"character":17},
"end":{"line":3,"character":21}
},
"children":[],
"_functionKind":""
}],
"_functionKind":"function"
},
{
"name":"assertTrue",
"detail":"assertTrue",
"kind":13,
"deprecated":false,
"range":{
"start":{"line":0,"character":0},
"end":{"line":0,"character":0}
},
"selectionRange":{
"start":{"line":0,"character":0},
"end":{"line":0,"character":0}
},
"children":[],
"_functionKind":""
}],
"_functionKind":"class"
}]Each of the "kind" fields is 1 more than it should be:
SpamTests -> 5; should be 4 (SymbolKind.Class)
test_all -> 12; should be 11 (SymbolKind.Function)
self -> 13; should be 12 (SymbolKind.Variable)
assertTrue -> 13; should be 12 (SymbolKind.Variable)
FWIW, the Jedi-related code in the Python extension gets it right.
Metadata
Metadata
Assignees
Labels
No labels