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

Unused template parameter in model template #5488

Closed
chunyu3 opened this issue Jan 6, 2025 · 1 comment · Fixed by #5494
Closed

Unused template parameter in model template #5488

chunyu3 opened this issue Jan 6, 2025 · 1 comment · Fixed by #5494
Assignees
Labels
feature New feature or request ide Issues for VS, VSCode, Monaco, etc.
Milestone

Comments

@chunyu3
Copy link
Contributor

chunyu3 commented Jan 6, 2025

No diagnostic is issues for a templated model with a template parameter that is not used.

For example:

model Response<S, B> {
  @doc("The status code.")
  @statusCode
  _: S;
}

model Cat {
  meow: int32;
}

@route("/")
namespace root {
  op read(): Response<200, Cat>;
}
@chunyu3 chunyu3 changed the title Unused template parameter in model Unused template parameter in model template Jan 6, 2025
@RodgeFu RodgeFu added the ide Issues for VS, VSCode, Monaco, etc. label Jan 8, 2025
@markcowl markcowl added design:needed A design request has been raised that needs a proposal compiler:core Issues for @typespec/compiler and removed ide Issues for VS, VSCode, Monaco, etc. labels Jan 8, 2025
@markcowl markcowl added this to the Backlog milestone Jan 8, 2025
@chunyu3 chunyu3 added ide Issues for VS, VSCode, Monaco, etc. and removed design:needed A design request has been raised that needs a proposal triaged:core compiler:core Issues for @typespec/compiler labels Jan 8, 2025
@chunyu3
Copy link
Contributor Author

chunyu3 commented Jan 8, 2025

This issue is a sub-task of #181 which is a feature of typespec authoring in VSCode extension.

@markcowl markcowl added the feature New feature or request label Jan 13, 2025
@josefree josefree added 1_0_E2E and removed 1_0_E2E labels Feb 26, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 28, 2025
… is not used. (#5494)

Fix #181
Fix #5488
Fix #5489

- check all the usage of the template parameter, if a template parameter
is not used, issue diagnostic and dim the template parameter.
- implement codeFix for unused-template-parameter diagnostic: remove the
unused template parameter.

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request ide Issues for VS, VSCode, Monaco, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants