Skip to content

Commit eee4699

Browse files
committed
fix: now source action can be disabled either in code actions on save or via setting completely
fixes #150
1 parent 35de441 commit eee4699

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/codeActionProvider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ export default () => {
2626
return
2727
}
2828

29+
const sourceActionKind = vscode.CodeActionKind.SourceFixAll.append('ts-essentials')
2930
if (context.only?.contains(vscode.CodeActionKind.SourceFixAll)) {
31+
if (
32+
!context.only.contains(sourceActionKind) ||
33+
(getExtensionSetting('removeCodeFixes.enable') && getExtensionSetting('removeCodeFixes.codefixes').includes('fixAllInFileSourceAction'))
34+
) {
35+
return
36+
}
37+
3038
const fixAllEdits = await sendCommand<RequestResponseTypes['getFixAllEdits']>('getFixAllEdits', {
3139
document,
3240
})
@@ -35,8 +43,8 @@ export default () => {
3543
edit.set(document.uri, tsTextChangesToVscodeTextEdits(document, fixAllEdits))
3644
return [
3745
{
38-
title: '[essentials] Fix all TypeScript',
39-
kind: vscode.CodeActionKind.SourceFixAll,
46+
title: '[TS essentials] Fix all',
47+
kind: sourceActionKind,
4048
edit,
4149
},
4250
]

src/configurationType.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ export type Configuration = {
640640

641641
// scrapped using search editor. config: caseInsensitive, context lines: 0, regex: const fix\w+ = "[^ ]+"
642642
type FixId =
643+
| 'fixAllInFileSourceAction'
643644
| 'addConvertToUnknownForNonOverlappingTypes'
644645
| 'addMissingAsync'
645646
| 'addMissingAwait'

0 commit comments

Comments
 (0)