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

Query symbol index for document symbols if analysis on document is not complete #486

Closed
jakebailey opened this issue Dec 12, 2018 · 1 comment
Assignees

Comments

@jakebailey
Copy link
Member

For #433.

@jakebailey jakebailey added this to the Dec 2018.2 milestone Dec 12, 2018
@jakebailey jakebailey self-assigned this Dec 12, 2018
@jakebailey jakebailey removed this from the Dec 2018.2 milestone Dec 12, 2018
@jakebailey jakebailey added the GA label Dec 17, 2018
jakebailey added a commit that referenced this issue Jan 16, 2019
For #433.
Closes #483.
Closes #484.
Closes #485.

General overview:
- Indexing happens on each parse, so with the current LS, every file in the workspace gets indexed. This will need to be reworked.
- All symbol queries go to the index, I have not yet approached #486.
- I do some extra heuristics to highlight some of the more interesting symbols, namely:
  - `__init__` in a `class` will be marked as a constructor.
  - Functions annotated with a property decorator are given the kind `Property`.
  - Functions that fit the pattern `__.*__` are given the kind `Operator`.
  - Other functions in a class are given the kind `Method`.
  - Variables that look like `UPPERCASE_UNDERSCORE_123` at the top level or directly inside a class are given the kind `Constant`.
- Any parse updates the index. I don't do any version management other than to look up the AST on the parse complete event.
- VS-specific "functionKind" is preserved.

Things to do in future PRs:
- Fallback to analysis when it's present. I left all of the functions previously used there.
- Using the import system to answer the question "is this thing being imported a module or not", probably augmented/modified outside the indexer.
- Parse version management.
- Asynchronous behavior (switching the dictionary to be a map from `Uri` to `TaskCompletionSource<HierarchicalSymbol>`).
@jakebailey
Copy link
Member Author

This is obsolete; the indexer will always be queried for info regardless of the status of the analysis. I'll open an issue for allowing the analysis to augment the indexed data (better detection of imports, for example).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant