Add single-word C# model name linter rule with AI-powered VS Code fixer#1
Draft
haiyuazhang wants to merge 1 commit into
Draft
Add single-word C# model name linter rule with AI-powered VS Code fixer#1haiyuazhang wants to merge 1 commit into
haiyuazhang wants to merge 1 commit into
Conversation
Adds a TypeSpec linter rule in @typespec/http-client-csharp that flags
single-word model names (e.g. `model Document`) which collide with BCL
or third-party types. The fix flow runs in the typespec-vscode extension:
- Linter: detects single-word model names; also flags `@@clientName`
overrides whose target string is a single word.
- VS Code extension: adds a code action provider that offers two AI fixes
via the lightbulb (Ctrl+.):
1. Rename model directly (uses the language server rename provider so
all references are updated).
2. Override via `@@clientName` in client.tsp (creates client.tsp if
missing, groups inserts after existing @@clientName lines, and
auto-adds `imports: - ./client.tsp` to tspconfig.yaml so the
compiler picks it up as a first-class source).
- AI suggestions are fetched on demand via vscode.lm (no external SDK).
- File watcher cleans up the tspconfig.yaml import and nudges open
editors to recompile when client.tsp is deleted.
- Adds a manual test workspace under packages/http-client-csharp/linter-test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a TypeSpec linter rule in @typespec/http-client-csharp that flags single-word model names (e.g.
model Document) which collide with BCL or third-party types. The fix flow runs in the typespec-vscode extension:@@clientNameoverrides whose target string is a single word.@@clientNamein client.tsp (creates client.tsp if missing, groups inserts after existing @@clientName lines, and auto-addsimports: - ./client.tspto tspconfig.yaml so the compiler picks it up as a first-class source).