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

Feature: Code fixes #2888

Merged
merged 32 commits into from
Mar 5, 2024
Merged

Conversation

timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Feb 5, 2024

closes #615

Code fixes added

Suppress

Kapture 2024-02-05 at 15 16 22

number -> float64 typo fix

Kapture 2024-02-06 at 09 50 28

Enum to extensible enum in typespec-azure

Azure/typespec-azure#258

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 5, 2024

All changed packages have been documented.

@azure-sdk
Copy link
Collaborator

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

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

.vscode/launch.json Outdated Show resolved Hide resolved
@timotheeguerin timotheeguerin marked this pull request as ready for review February 14, 2024 19:49
@timotheeguerin timotheeguerin changed the title [WIP] Feature: Code fixes Feature: Code fixes Feb 14, 2024
docs/extending-typespec/codefixes.md Outdated Show resolved Hide resolved
docs/extending-typespec/codefixes.md Outdated Show resolved Hide resolved
docs/extending-typespec/linters.md Outdated Show resolved Hide resolved

async function toEqual(expectedCode: string) {
const diagnostics = await diagnose(code);
const codefix = diagnostics[0].codefixes?.find((x) => x.id === fixId);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is expected to be used only when there is a single diagnostic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah the expectation is you emit a single linter warning and apply the code fix on it

Copy link
Member Author

Choose a reason for hiding this comment

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

If we endup having cases where there is multiple diagnostic always emitted, I think then we can add a extra option to choose which one

@timotheeguerin timotheeguerin merged commit 6a9c62a into microsoft:main Mar 5, 2024
14 checks passed
@timotheeguerin timotheeguerin deleted the feature/code-fixes branch March 5, 2024 19:51
markcowl added a commit to markcowl/cadl that referenced this pull request Mar 8, 2024
closes microsoft#615

## Code fixes added

### Suppress
![Kapture 2024-02-05 at 15 16
22](https://github.com/microsoft/typespec/assets/1031227/644014a3-9352-4bd4-b1b8-0d314c627405)

### `number` -> `float64` typo fix

![Kapture 2024-02-06 at 09 50
28](https://github.com/microsoft/typespec/assets/1031227/65b2e9aa-c510-440f-a1c6-7851611b65a2)

### Enum to extensible enum in typespec-azure

Azure/typespec-azure#258

---------

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation: Suggested Code fixes
3 participants