1
1
import * as process from 'node:process' ;
2
2
import * as path from 'node:path' ;
3
3
import {
4
+ type CodeAction ,
4
5
createConnection ,
5
6
ProposedFeatures ,
6
7
TextDocuments ,
@@ -17,7 +18,6 @@ import {
17
18
type TextDocumentIdentifier ,
18
19
type DidChangeConfigurationParams ,
19
20
type TextDocumentChangeEvent ,
20
- type CodeAction ,
21
21
type DocumentRangeFormattingParams
22
22
} from 'vscode-languageserver/node' ;
23
23
import { TextDocument } from 'vscode-languageserver-textdocument' ;
@@ -202,7 +202,11 @@ class LintServer {
202
202
documentFormattingProvider : true ,
203
203
documentRangeFormattingProvider : true ,
204
204
codeActionProvider : {
205
- codeActionKinds : [ CodeActionKind . QuickFix , CodeActionKind . SourceFixAll ]
205
+ codeActionKinds : [
206
+ CodeActionKind . QuickFix ,
207
+ CodeActionKind . SourceFixAll ,
208
+ `${ CodeActionKind . SourceFixAll } .xo`
209
+ ]
206
210
}
207
211
}
208
212
} ;
@@ -345,14 +349,15 @@ class LintServer {
345
349
}
346
350
347
351
const codeActions : CodeAction [ ] = [ ] ;
348
- if (
349
- context . only ?. includes ( CodeActionKind . SourceFixAll ) || // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
350
- context . only ?. includes ( `${ CodeActionKind . SourceFixAll } .xo` )
351
- ) {
352
+
353
+ const isFixAll = context . only ?. includes ( CodeActionKind . SourceFixAll ) ;
354
+ const isFixAllXo = context . only ?. includes ( `${ CodeActionKind . SourceFixAll } .xo` ) ;
355
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
356
+ if ( isFixAll || isFixAllXo ) {
352
357
const fixes = await this . getDocumentFormatting ( params . textDocument . uri ) ;
353
358
const codeAction : CodeAction = {
354
359
title : 'Fix all XO auto-fixable problems' ,
355
- kind : CodeActionKind . SourceFixAll ,
360
+ kind : isFixAllXo ? ` ${ CodeActionKind . SourceFixAll } .xo` : CodeActionKind . SourceFixAll ,
356
361
edit : {
357
362
changes : {
358
363
[ document . uri ] : fixes . edits
0 commit comments