Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Document symbols should include imported modules #2

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, some symbols are missing.

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"
}]

The symbol for the "unittest" module is missing.

Activity

  1. MikhailArkhipov commented on Aug 30, 2018

    @MikhailArkhipov

    unittest is not currently returned since it is not a variable. However, it is possible to return imported modules as well. What type would we assign to them? I assume Package?

  2. ericsnowcurrently commented on Aug 30, 2018

    @ericsnowcurrently
    Author

    The Jedi-related code includes the symbol, with a kind of Module.

  3. ericsnowcurrently commented on Aug 30, 2018

    @ericsnowcurrently
    Author

    FWIW, this issue isn't causing any problems. It simply something I noticed when comparing what Jedi returned.

  4. added
    enhancement
    and removed
    bug
    on Sep 26, 2018
  5. changed the title [-]Not all symbols returned by Language Server.[/-] on Sep 26, 2018
  6. MikhailArkhipov commented on Oct 5, 2018

    @MikhailArkhipov

    Unless it is a user request, won't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementfeature: symbolswontfix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions