Fixing completion suggestions for collections of anonymous records #14976
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The issue #14812 affected access to a collection of anonymous records, processed either via indexer or via a module function converting the collection to a single item.
The existing autocomplete logic in VS adds in keywords if the suggestion isn't for a long dotted-identifier, or if it isn't for a known type. In this case, anonymous records were not considered to be a type (isForType was false), but from a suggestion perspective, they are a type and should be treated here for the completion list just like regular records
Before:
![image](https://user-images.githubusercontent.com/46543583/227627905-5fdaf3d0-ba62-479b-a680-f6084cd4cdd4.png)
After:
![image](https://user-images.githubusercontent.com/46543583/227627722-105944cb-0247-436c-9302-ab775904a96e.png)
![image](https://user-images.githubusercontent.com/46543583/227627852-5ce271a6-4d9b-4960-a77a-50391f1d8279.png)