Skip to content

Commit b63a187

Browse files
zthcristianoc
authored andcommitted
remove top level unit type action, since the error location given by the compiler isn't always enough to add ignore (we'd have to look at the AST, and we'd like to avoid that for the diagnostics driven actions)
1 parent d9a761b commit b63a187

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

server/src/codeActions.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export let findCodeActionsInDiagnosticsMessage = ({
9696
didYouMeanAction,
9797
addUndefinedRecordFields,
9898
simpleConversion,
99-
topLevelUnitType,
10099
applyUncurried,
101100
simpleAddMissingCases,
102101
simpleWrapOptionalWithSome,
@@ -388,41 +387,6 @@ let applyUncurried: codeActionExtractor = ({
388387
return false;
389388
};
390389

391-
// This action detects the compiler erroring when it finds a top level value
392-
// that's not `unit`, and offers to wrap that value in `ignore`, which will make
393-
// it compile.
394-
let topLevelUnitType: codeActionExtractor = ({
395-
line,
396-
codeActions,
397-
file,
398-
range,
399-
diagnostic,
400-
}) => {
401-
if (line.startsWith("Toplevel expression is expected to have unit type.")) {
402-
codeActions[file] = codeActions[file] || [];
403-
let codeAction: p.CodeAction = {
404-
title: `Wrap expression in ignore`,
405-
edit: {
406-
changes: {
407-
[file]: wrapRangeInText(range, "ignore(", ")"),
408-
},
409-
},
410-
diagnostics: [diagnostic],
411-
kind: p.CodeActionKind.QuickFix,
412-
isPreferred: true,
413-
};
414-
415-
codeActions[file].push({
416-
range,
417-
codeAction,
418-
});
419-
420-
return true;
421-
}
422-
423-
return false;
424-
};
425-
426390
// This protects against the fact that the compiler currently returns most
427391
// text in OCaml. It also ensures that we only return simple constructors.
428392
let isValidVariantCase = (text: string): boolean => {

0 commit comments

Comments
 (0)