Skip to content
New issue

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

Use Symbol Tables for Completions #874

Merged
merged 17 commits into from Sep 13, 2023

Conversation

markwpearce
Copy link
Collaborator

@markwpearce markwpearce commented Aug 28, 2023

Changes all completion logic to use symbol tables.

Other changes:
- Hack to get a parser from an AST Body - this is used to get the documentations tokens. I don't like how this is done (AST Node should not know about the Parser! -> It would be really useful to have a way to map functions to comments!

  • Moved more completions tests to CompletionsProcessor.spec
  • Updates Symbols in SymbolTables to have a data field to store:
    • the node/expression that defines this symbol
    • a string description (from a comment if it is available)
    • completion priority (built in interfaces have lower priority than explicitly defined members)
  • Able to easily get documentation for an ASTNode (through leadingTrivia)
  • HoverProcessor takes advantage of comments as well
  • fixes possibility that the same namespaceAggregate symbol table is add as sibling more than once
  • Other small fixes to hovers
  • Adds more incomplete expressions to the AST, so they can be used for completions.
  • Fixes:

NOTE:

There has been a significant performance loss in Validate benchmark.. I think it happened in commit: 81e6391

src/parser/Statement.ts Outdated Show resolved Hide resolved
src/parser/Parser.ts Outdated Show resolved Hide resolved
@markwpearce markwpearce marked this pull request as ready for review September 6, 2023 13:53
@markwpearce markwpearce changed the title [WIP] Use Symbol Tables for Completions Use Symbol Tables for Completions Sep 6, 2023
Comment on lines +697 to +700
// make sure validation is complete
await this.validateAllThrottled();
//wait for the validation cycle to settle
await this.onValidateSettled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might have something to do with the issues with validations getting stuck. Just taking note...

Comment on lines +975 to +977
if (await this.handleFileChange(project, change)) {
await this.validateAllThrottled();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might have something to do with the stuck validation cycle too. Just taking another note...

@@ -834,21 +834,25 @@ export class Scope {
: new NamespaceType(nameSoFar);
if (previousNSType) {
// adding as a member of existing NS
previousNSType.addMember(nsNamePart, namespace.range, currentNSType, getTypeOptions.flags);
previousNSType.addMember(nsNamePart, { definingNode: namespace }, currentNSType, getTypeOptions.flags);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the need for the definingNode property? I'm not a huge fan of linking AST to types, would be nice to find a way to avoid this if possible.

Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic! Thank you.

@TwitchBronBron TwitchBronBron merged commit 69d3037 into release-0.66.0 Sep 13, 2023
5 checks passed
@TwitchBronBron TwitchBronBron deleted the use_symbol_tables_for_completions branch September 13, 2023 14:40
@TwitchBronBron TwitchBronBron added this to the v1.0.0 milestone Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants