Skip to content

Improve Completion #1 - #1558

Merged
dantleech merged 18 commits into
masterfrom
improvecompletion
May 8, 2022
Merged

dantleech merged 18 commits into
masterfrom
improvecompletion

Conversation

@dantleech

@dantleech dantleech commented May 8, 2022 •

Copy link
Copy Markdown
Collaborator

This PR aims to improve the context sensitivity of completion:

  • Expression completion (functions + classes)
  • Type completion (e.g. retun types, parameter declaration types) this includes scalar types.
  • Clause completion (implements => interfaces, use => traits, extends => classes
  • Use statement completion => classes

Note that whereas previously we "allowed" completion by default, we now restrict more by default, so its quite likely that completion may stop working in some contexts errornously.

@dantleech
dantleech force-pushed the improvecompletion branch from dbc8dbf to 480fe10 Compare May 8, 2022 10:41
@dantleech
dantleech merged commit 2336f49 into master May 8, 2022
@dantleech
dantleech deleted the improvecompletion branch May 8, 2022 11:56
@przepompownia

Copy link
Copy Markdown
Contributor

After this change quick manual tests suggest that I can complete only keywords.

@przepompownia

Copy link
Copy Markdown
Contributor

Maybe false alarm - not know why initially did not work (with index built from scratch).

@dantleech

dantleech commented May 8, 2022 •

Copy link
Copy Markdown
Collaborator Author

there is one migration issue which i thought i solved:

the search index now includes the class type so on an old index it would not find anything if searching for insterface or class. however i put in some B/C so that it should "just" continue to work (completing implements <> will show all class "types" on an old index).

but possible there are some gremlins. certainly needs a full index rebuild to take advantage of the new feature, but should also work similar to before without.

@przepompownia

Copy link
Copy Markdown
Contributor

It seems that completion does not work directly after building the index. After starting the server again with the same index created before, completion works.

@przepompownia

Copy link
Copy Markdown
Contributor

Reproductible for me: https://asciinema.org/a/dne4pV2RAImoc2EaplPdvmvXI on this example I cannot complete $this until restart phpactor.

@dantleech

Copy link
Copy Markdown
Collaborator Author

Looks like NULL was being passed https://github.com/phpactor/phpactor/pull/1561/files

@przepompownia

Copy link
Copy Markdown
Contributor

Now completion works just after creating index 👍

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.

2 participants