Skip to content

Use ".ts" suffixed code action kinds - #63951

Merged
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:fix-63823
Aug 26, 2026
Merged

Use ".ts" suffixed code action kinds#63951
Jake Bailey (jakebailey) merged 3 commits into
microsoft:mainfrom
jakebailey:fix-63823

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Aug 21, 2026

Copy link
Copy Markdown
Member

Fixes #63823

Advertise source.fixAll.ts etc instead of just source.fixAll. This matches typescript-language-server allowing scoped fixing.

We don't need to actually keep and declare source.fixAll etc (without .ts suffix), because the fix naming system is hierarchical; we in fact copied a helper from VS Code that does this matching, which I've moved into the method.

For consistency, I've changed all of the testing to just use the defined one, which works.

(A previous PR for this was more complicated, but it turns out we don't need much. Most changes are test churn.)

Copilot AI balanced review requested due to automatic review settings August 21, 2026 20:07
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 21, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Scopes TypeScript source actions with .ts while preserving hierarchical parent-kind requests.

Changes:

  • Adds scoped action-kind constants and hierarchical matching.
  • Advertises and returns scoped action kinds.
  • Migrates fourslash helpers and organize-import tests.

Reviewed changes

Copilot reviewed 67 out of 67 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsc/internal/lsp/server.go Advertises scoped action kinds.
tsc/internal/lsp/lsproto/lsp.go Adds scoped constants and hierarchy matching.
tsc/internal/ls/organizeimports.go Handles scoped organize-import kinds.
tsc/internal/ls/codeactions.go Returns scoped actions for parent filters.
tsc/internal/fourslash/fourslash.go Updates action verification helpers.
tsc/internal/fourslash/tests/organizeImportsWithTraceResolution1_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsUnicode4_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsUnicode3_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsUnicode2_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsUnicode1_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType9_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType8_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType7_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType6_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType5_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType4_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType3_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType2_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType11_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType10_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsType1_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsShebang_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsReactJsxDev_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsReactJsx_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsPathsUnicode4_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsPathsUnicode3_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsPathsUnicode2_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsPathsUnicode1_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsGroup_Newline_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsGroup_MultiNewlines_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsGroup_MultilineCommentInNewline_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsGroup_CommentInNewline_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsAttributes4_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsAttributes3_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsAttributes2_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImportsAttributes_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports9_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports8_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports7_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports6_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports5_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports4_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports3_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports23_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports22_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports21_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports20_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports2_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports19_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports18_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports17_test.go Uses scoped sort-imports kind.
tsc/internal/fourslash/tests/organizeImports16_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports15_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports14_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports13_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports12_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports11_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports10_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports1_test.go Tests parent request and scoped result.
tsc/internal/fourslash/tests/organizeImports_typeOrderSameModule_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports_sortModuleSpecifiers_test.go Uses scoped sort-imports kind.
tsc/internal/fourslash/tests/organizeImports_removeUnused_preservesMultiline_test.go Uses scoped remove-unused kind.
tsc/internal/fourslash/tests/organizeImports_removeOnly_test.go Uses scoped remove-unused kind.
tsc/internal/fourslash/tests/organizeImports_exportLeadingComment_test.go Uses scoped sort-imports kind.
tsc/internal/fourslash/tests/organizeImports_dtsUnusedImportWithAugmentation_test.go Uses scoped organize-import kind.
tsc/internal/fourslash/tests/organizeImports_coalesceImports_test.go Uses scoped sort-imports kind.
tsc/internal/fourslash/tests/organizeImports_coalesceExports_test.go Uses scoped sort-imports kind.

Comment thread tsc/internal/lsp/server.go
@jakebailey

Copy link
Copy Markdown
Member Author

Though, now with content mappers exposing other languages, maybe this is cursed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 69 out of 69 changed files in this pull request and generated no new comments.

@jakebailey

Copy link
Copy Markdown
Member Author

Andrew Branch (@andrewbranch) Do you have any thoughts about this in the context of content mappers?

@andrewbranch

Copy link
Copy Markdown
Member

Is this just an opaque identifier that is now less likely to collide with other providers, or does the name get parsed out and used by clients in some way?

@jakebailey

Copy link
Copy Markdown
Member Author

It's not opaque per se, it's just that the user can ask an editor "apply fixes from this category" and then the .ts suffix means they can select just ours, while if they want all from all providers, then they can remove it. Basically it's because people run eslint and TypeScript together and then want to not auto apply all ESLint fixes

@jakebailey

Copy link
Copy Markdown
Member Author

By that reasoning, perhaps this means that it's fine with content mappers, since we are "the provider" and the mapping is just a detail of what we are offering to the user, and it's not like linters are coming into play here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, that's what I was getting at—I think we should be considered the provider for the code fixes we provide in other file extensions through content mappers. I don't see a reason to scope them differently.

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Aug 25, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Aug 26, 2026
Merged via the queue into microsoft:main with commit e95d8e5 Aug 26, 2026
23 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the fix-63823 branch August 26, 2026 23:49
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Aug 26, 2026
@TorinAsakura

Copy link
Copy Markdown
Contributor

Well, I took a proper look at the merged diff, and... yeah, I think we got a bit carried away here.

The .ts suffix is part of the LSP-facing action kind, but now it goes all the way down into organize imports as the actual operation mode. That’s basically why this ended up touching 69 files and rewriting almost the entire organize-imports test suite.

Wouldn’t it be cleaner to keep the existing generic modes internally, normalize the requested kind at the code-action boundary, and only return the .ts kind to the client? Then the old behavior tests stay as they are, while a small table can cover generic and .ts requests for all four actions.

The funny part is that after changing 64 test files, we still don’t explicitly test generic source.removeUnusedImports and source.sortImports, even though keeping those requests working is the backward-compat part the issue actually calls out.

The current implementation works, so I’m not suggesting we roll it back. I just think the protocol detail leaked much further into the language service than it needed to.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[lsp] make source action kinds more specific

4 participants