Skip to content

Commit df9e9f5

Browse files
committed
Use %todo instead of failwith on v11+
1 parent 314fe3b commit df9e9f5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/codeActions.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,14 @@ let handleUndefinedRecordFieldsAction = ({
319319
file,
320320
range,
321321
diagnostic,
322+
todoValue
322323
}: {
323324
recordFieldNames: string[];
324325
codeActions: filesCodeActions;
325326
file: string;
326327
range: p.Range;
327328
diagnostic: p.Diagnostic;
329+
todoValue: string
328330
}) => {
329331
if (recordFieldNames != null) {
330332
codeActions[file] = codeActions[file] || [];
@@ -373,7 +375,7 @@ let handleUndefinedRecordFieldsAction = ({
373375
newText += paddingContentRecordField;
374376
}
375377

376-
newText += `${fieldName}: failwith("TODO"),\n`;
378+
newText += `${fieldName}: ${todoValue},\n`;
377379
});
378380

379381
// Let's put the end brace back where it was (we still have it to the direct right of us).
@@ -392,7 +394,7 @@ let handleUndefinedRecordFieldsAction = ({
392394
}
393395

394396
newText += recordFieldNames
395-
.map((fieldName) => `${fieldName}: failwith("TODO")`)
397+
.map((fieldName) => `${fieldName}: ${todoValue}`)
396398
.join(", ");
397399
}
398400

@@ -450,6 +452,7 @@ let addUndefinedRecordFieldsV10: codeActionExtractor = ({
450452
diagnostic,
451453
file,
452454
range,
455+
todoValue: `failwith("TODO")`
453456
});
454457
}
455458

@@ -496,6 +499,7 @@ let addUndefinedRecordFieldsV11: codeActionExtractor = ({
496499
diagnostic,
497500
file,
498501
range,
502+
todoValue: `%todo`
499503
});
500504
}
501505

0 commit comments

Comments
 (0)