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

issue diagnostic for a templated model with a template parameter that is not used. #5494

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

chunyu3
Copy link
Contributor

@chunyu3 chunyu3 commented Jan 6, 2025

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.

@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Jan 6, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 6, 2025

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Support diagnostics for unused template parameter

@chunyu3 chunyu3 added ide Issues for VS, VSCode, Monaco, etc. and removed compiler:core Issues for @typespec/compiler labels Jan 6, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 6, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@markcowl markcowl self-assigned this Jan 9, 2025
Copy link
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

Not sure that we want to do this

import { createTestHost } from "../../src/testing/test-host.js";
import { TestHost } from "../../src/testing/types.js";

describe("compiler: unused template parameter in model template", () => {
Copy link
Member

Choose a reason for hiding this comment

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

remove top level describe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hello @timotheeguerin I add more tests to test template parameters in model template, operation template and interface template. Each type of template I create a describe for it to sub-group.

@chunyu3 chunyu3 force-pushed the fix181 branch 2 times, most recently from 66e16cd to 55b8f4f Compare February 25, 2025 06:39
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
4 participants