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

Support completion for table key specifier/constraint #32886

Closed
mohanvive opened this issue Sep 23, 2021 · 5 comments · Fixed by #32934
Closed

Support completion for table key specifier/constraint #32886

mohanvive opened this issue Sep 23, 2021 · 5 comments · Fixed by #32934
Assignees
Labels
Points/2 Equivalent to two days effort Priority/High Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement

Comments

@mohanvive
Copy link
Contributor

Description:
Key specifier and key constraints are two possible options which help to define the key/key type for the table. As of now, LS supports completions for key specifier at table type. However below completion suggestions are missing now.

  1. key constraint type completion suggestion when defining table type
  2. key specifier field suggestion when defining the table constructor
@mohanvive mohanvive added Team/LanguageServer Language Server Implementation related issues. #Compiler Priority/High labels Sep 23, 2021
@mohanvive mohanvive added the Points/2 Equivalent to two days effort label Sep 23, 2021
@malinthar
Copy link
Contributor

Hi @mohanvive, Had a look of the mentioned cases. Key specifier field suggestion has to be improved. However, Key type constraint seems to be suggested on beta4-snapshot.
Screenshot from 2021-09-24 17-19-03

Can you verify whether the above is still there?

@mohanvive
Copy link
Contributor Author

mohanvive commented Sep 24, 2021

Yes, it does suggest types for the table key constraint. However, it is not accurate because table key constraint type only can be a type of the fields which are defined as readonly.

For example, if firstName is the only readonly field of Employee, then only possible valid suggestion type is string.
@malinthar

@malinthar
Copy link
Contributor

Yes, it does suggest types for the table key constraint. However, it is not accurate because table key constraint type only can be a type of the fields which are defined as readonly.

For example, if firstName is the only readonly field of Employee, then only possible valid suggestion type is string.
@malinthar

I see. Thanks @mohanvive

@malinthar
Copy link
Contributor

malinthar commented Sep 27, 2021

Yes, it does suggest types for the table key constraint. However, it is not accurate because table key constraint type only can be a type of the fields which are defined as readonly.

For example, if firstName is the only readonly field of Employee, then only possible valid suggestion type is string.
@malinthar

suppose a user needs to use a particular type that he has not defined in the row type parameter. In that case we should suggest typedefs and modules.To accommodate both the scenarios we can sort the completions so that the already defined readonly params are on top. This is the practice that we follow in other contexts. WDYT @mohanvive ?

@mohanvive
Copy link
Contributor Author

Yes, it does suggest types for the table key constraint. However, it is not accurate because table key constraint type only can be a type of the fields which are defined as readonly.
For example, if firstName is the only readonly field of Employee, then only possible valid suggestion type is string.
@malinthar

suppose a user needs to use a particular type that he has not defined in the row type parameter. In that case we should suggest typedefs and modules.To accommodate both the scenarios we can sort the completions so that the already defined readonly params are on top. This is the practice that we follow in other contexts. WDYT @mohanvive ?

Yes, that makes sense. +1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Points/2 Equivalent to two days effort Priority/High Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants