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

improve completion and onhover in VSCode for decorator and extended model #3280

Merged
merged 24 commits into from May 17, 2024

Conversation

RodgeFu
Copy link
Contributor

@RodgeFu RodgeFu commented May 6, 2024

add following feature

  1. support completion when user typing model expression as decorator argument value
  2. support completion for extended model
  3. support showing decorator model argument prop information when hovering on model expression as decorator argument value

closes #3130, closes #2228, closes #1956

@azure-sdk
Copy link
Collaborator

azure-sdk commented May 6, 2024

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Support completion for Model with extended properties,> ,> Example,> tsp,> model Device {,> name: string;,> description: string;,> },> ,> model Phone extends Device {,> ┆,> } | [name],> | [description],>

@typespec/compiler - feature ✏️

Support completion for object values and model expression properties.,> ,> Example,> tsp,> model User {,> name: string;,> age: int32;,> address: string;,> },> ,> const user: User = #{name: "Bob", ┆},> | [age],> | [address],>

@azure-sdk
Copy link
Collaborator

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/3280/

Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/prs/3280/

@RodgeFu RodgeFu added the ide Issues for VS, VSCode, Monaco, etc. label May 6, 2024
Copy link
Member

@timotheeguerin timotheeguerin left a comment

Choose a reason for hiding this comment

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

We have the value world PR that should be merged very soon hopefully. It had object value and array value. Those should be the ones that we autocomplete here instead. Because at this point autocompleting a model like this doesn't make that much sense

@timotheeguerin timotheeguerin mentioned this pull request May 6, 2024
3 tasks
@RodgeFu
Copy link
Contributor Author

RodgeFu commented May 7, 2024

We have the value world PR that should be merged very soon hopefully. It had object value and array value. Those should be the ones that we autocomplete here instead. Because at this point autocompleting a model like this doesn't make that much sense

by the "value world", do you mean we will have a new way to define/expose an object value instead of leveraging existing model expression?

@timotheeguerin
Copy link
Member

We have the value world PR that should be merged very soon hopefully. It had object value and array value. Those should be the ones that we autocomplete here instead. Because at this point autocompleting a model like this doesn't make that much sense

by the "value world", do you mean we will have a new way to define/expose an object value instead of leveraging existing model expression?

yes exactly, with #{}, this has been merged so you should be able to update that now

@RodgeFu
Copy link
Contributor Author

RodgeFu commented May 14, 2024

yes exactly, with #{}, this has been merged so you should be able to update that now

@timotheeguerin , I have updated the PR accordingly. please help to review again. thanks.

And is there any way that we can get notified in advance for this kind of big change in typespec? That will be helpful for us to collaborate and do planning better. thanks.

Copy link
Member

@timotheeguerin timotheeguerin left a comment

Choose a reason for hiding this comment

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

This looks great overall, such a nice addition, there is a few little things missing but thanks for this.

packages/compiler/src/core/types.ts Outdated Show resolved Hide resolved
packages/compiler/src/server/type-details.ts Outdated Show resolved Hide resolved
packages/compiler/src/server/completion.ts Outdated Show resolved Hide resolved
packages/compiler/src/core/checker.ts Outdated Show resolved Hide resolved
packages/compiler/src/core/checker.ts Outdated Show resolved Hide resolved
packages/compiler/src/core/checker.ts Outdated Show resolved Hide resolved
@RodgeFu RodgeFu added this pull request to the merge queue May 17, 2024
Merged via the queue into microsoft:main with commit b7f6948 May 17, 2024
21 checks passed
@RodgeFu RodgeFu deleted the add-completion-for-decorator-model-arg branch May 17, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ide Issues for VS, VSCode, Monaco, etc.
Projects
None yet
3 participants