@rescript/language-server 1.42.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis_binaries/darwin/rescript-editor-analysis.exe +0 -0
- package/analysis_binaries/darwinarm64/rescript-editor-analysis.exe +0 -0
- package/analysis_binaries/linux/rescript-editor-analysis.exe +0 -0
- package/analysis_binaries/win32/rescript-editor-analysis.exe +0 -0
- package/out/cli.js +93 -32
- package/out/cli.js.map +7 -1
- package/package.json +1 -1
- package/out/buildSchema.js +0 -21
- package/out/buildSchema.js.map +0 -1
- package/out/codeActions.js +0 -573
- package/out/codeActions.js.map +0 -1
- package/out/constants.js +0 -58
- package/out/constants.js.map +0 -1
- package/out/errorReporter.js +0 -22
- package/out/errorReporter.js.map +0 -1
- package/out/lookup.js +0 -147
- package/out/lookup.js.map +0 -1
- package/out/server.js +0 -1108
- package/out/server.js.map +0 -1
- package/out/utils.js +0 -582
- package/out/utils.js.map +0 -1
package/package.json
CHANGED
package/out/buildSchema.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file has been generated from https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json
|
|
3
|
-
// with https://app.quicktype.io/ and stripped down to what we actually need for the extension.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.SuffixSpec = exports.ModuleFormat = void 0;
|
|
6
|
-
var ModuleFormat;
|
|
7
|
-
(function (ModuleFormat) {
|
|
8
|
-
ModuleFormat["Commonjs"] = "commonjs";
|
|
9
|
-
ModuleFormat["Es6"] = "es6";
|
|
10
|
-
ModuleFormat["Es6Global"] = "es6-global";
|
|
11
|
-
})(ModuleFormat = exports.ModuleFormat || (exports.ModuleFormat = {}));
|
|
12
|
-
var SuffixSpec;
|
|
13
|
-
(function (SuffixSpec) {
|
|
14
|
-
SuffixSpec["BsCjs"] = ".bs.cjs";
|
|
15
|
-
SuffixSpec["BsJS"] = ".bs.js";
|
|
16
|
-
SuffixSpec["BsMjs"] = ".bs.mjs";
|
|
17
|
-
SuffixSpec["Cjs"] = ".cjs";
|
|
18
|
-
SuffixSpec["JS"] = ".js";
|
|
19
|
-
SuffixSpec["Mjs"] = ".mjs";
|
|
20
|
-
})(SuffixSpec = exports.SuffixSpec || (exports.SuffixSpec = {}));
|
|
21
|
-
//# sourceMappingURL=buildSchema.js.map
|
package/out/buildSchema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildSchema.js","sourceRoot":"","sources":["../src/buildSchema.ts"],"names":[],"mappings":";AAAA,2IAA2I;AAC3I,+FAA+F;;;AAY/F,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,2BAAW,CAAA;IACX,wCAAwB,CAAA;AAC1B,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAQD,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,0BAAY,CAAA;IACZ,wBAAU,CAAA;IACV,0BAAY,CAAA;AACd,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB"}
|
package/out/codeActions.js
DELETED
|
@@ -1,573 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.findCodeActionsInDiagnosticsMessage = void 0;
|
|
27
|
-
// This file holds code actions derived from diagnostics. There are more code
|
|
28
|
-
// actions available in the extension, but they are derived via the analysis
|
|
29
|
-
// OCaml binary.
|
|
30
|
-
const p = __importStar(require("vscode-languageserver-protocol"));
|
|
31
|
-
const utils = __importStar(require("./utils"));
|
|
32
|
-
const url_1 = require("url");
|
|
33
|
-
let wrapRangeInText = (range, wrapStart, wrapEnd) => {
|
|
34
|
-
// We need to adjust the start of where we replace if this is a single
|
|
35
|
-
// character on a single line.
|
|
36
|
-
let offset = range.start.line === range.end.line &&
|
|
37
|
-
range.start.character === range.end.character
|
|
38
|
-
? 1
|
|
39
|
-
: 0;
|
|
40
|
-
let startRange = {
|
|
41
|
-
start: {
|
|
42
|
-
line: range.start.line,
|
|
43
|
-
character: range.start.character - offset,
|
|
44
|
-
},
|
|
45
|
-
end: {
|
|
46
|
-
line: range.start.line,
|
|
47
|
-
character: range.start.character - offset,
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
let endRange = {
|
|
51
|
-
start: {
|
|
52
|
-
line: range.end.line,
|
|
53
|
-
character: range.end.character,
|
|
54
|
-
},
|
|
55
|
-
end: {
|
|
56
|
-
line: range.end.line,
|
|
57
|
-
character: range.end.character,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
return [
|
|
61
|
-
{
|
|
62
|
-
range: startRange,
|
|
63
|
-
newText: wrapStart,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
range: endRange,
|
|
67
|
-
newText: wrapEnd,
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
};
|
|
71
|
-
let insertBeforeEndingChar = (range, newText) => {
|
|
72
|
-
let beforeEndingChar = {
|
|
73
|
-
line: range.end.line,
|
|
74
|
-
character: range.end.character - 1,
|
|
75
|
-
};
|
|
76
|
-
return [
|
|
77
|
-
{
|
|
78
|
-
range: {
|
|
79
|
-
start: beforeEndingChar,
|
|
80
|
-
end: beforeEndingChar,
|
|
81
|
-
},
|
|
82
|
-
newText,
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
};
|
|
86
|
-
let replaceText = (range, newText) => {
|
|
87
|
-
return [
|
|
88
|
-
{
|
|
89
|
-
range,
|
|
90
|
-
newText,
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
};
|
|
94
|
-
let removeTrailingComma = (text) => {
|
|
95
|
-
let str = text.trim();
|
|
96
|
-
if (str.endsWith(",")) {
|
|
97
|
-
return str.slice(0, str.length - 1);
|
|
98
|
-
}
|
|
99
|
-
return str;
|
|
100
|
-
};
|
|
101
|
-
let extractTypename = (lines) => {
|
|
102
|
-
let arrFiltered = [];
|
|
103
|
-
for (let i = 0; i <= lines.length - 1; i += 1) {
|
|
104
|
-
let line = lines[i];
|
|
105
|
-
if (line.includes("(defined as")) {
|
|
106
|
-
let [typeStr, _] = line.split("(defined as");
|
|
107
|
-
arrFiltered.push(removeTrailingComma(typeStr));
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
arrFiltered.push(removeTrailingComma(line));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return arrFiltered.join("").trim();
|
|
115
|
-
};
|
|
116
|
-
let takeUntil = (array, startsWith) => {
|
|
117
|
-
let res = [];
|
|
118
|
-
let arr = array.slice();
|
|
119
|
-
let matched = false;
|
|
120
|
-
arr.forEach((line) => {
|
|
121
|
-
if (matched) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (line.startsWith(startsWith)) {
|
|
125
|
-
matched = true;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
res.push(line);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return res;
|
|
132
|
-
};
|
|
133
|
-
let findCodeActionsInDiagnosticsMessage = ({ diagnostic, diagnosticMessage, file, range, addFoundActionsHere: codeActions, }) => {
|
|
134
|
-
diagnosticMessage.forEach((line, index, array) => {
|
|
135
|
-
// Because of how actions work, there can only be one per diagnostic. So,
|
|
136
|
-
// halt whenever a code action has been found.
|
|
137
|
-
let codeActionEtractors = [
|
|
138
|
-
simpleTypeMismatches,
|
|
139
|
-
didYouMeanAction,
|
|
140
|
-
addUndefinedRecordFieldsV10,
|
|
141
|
-
addUndefinedRecordFieldsV11,
|
|
142
|
-
simpleConversion,
|
|
143
|
-
applyUncurried,
|
|
144
|
-
simpleAddMissingCases,
|
|
145
|
-
wrapInSome,
|
|
146
|
-
];
|
|
147
|
-
for (let extractCodeAction of codeActionEtractors) {
|
|
148
|
-
let didFindAction = false;
|
|
149
|
-
try {
|
|
150
|
-
didFindAction = extractCodeAction({
|
|
151
|
-
array,
|
|
152
|
-
codeActions,
|
|
153
|
-
diagnostic,
|
|
154
|
-
file,
|
|
155
|
-
index,
|
|
156
|
-
line,
|
|
157
|
-
range,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
console.error(e);
|
|
162
|
-
}
|
|
163
|
-
if (didFindAction) {
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
exports.findCodeActionsInDiagnosticsMessage = findCodeActionsInDiagnosticsMessage;
|
|
170
|
-
// This action extracts hints the compiler emits for misspelled identifiers, and
|
|
171
|
-
// offers to replace the misspelled name with the correct name suggested by the
|
|
172
|
-
// compiler.
|
|
173
|
-
let didYouMeanAction = ({ codeActions, diagnostic, file, line, range, }) => {
|
|
174
|
-
if (line.startsWith("Hint: Did you mean")) {
|
|
175
|
-
let regex = /Did you mean ([A-Za-z0-9_]*)?/;
|
|
176
|
-
let match = line.match(regex);
|
|
177
|
-
if (match === null) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
let [_, suggestion] = match;
|
|
181
|
-
if (suggestion != null) {
|
|
182
|
-
codeActions[file] = codeActions[file] || [];
|
|
183
|
-
let codeAction = {
|
|
184
|
-
title: `Replace with '${suggestion}'`,
|
|
185
|
-
edit: {
|
|
186
|
-
changes: {
|
|
187
|
-
[file]: [{ range, newText: suggestion }],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
diagnostics: [diagnostic],
|
|
191
|
-
kind: p.CodeActionKind.QuickFix,
|
|
192
|
-
isPreferred: true,
|
|
193
|
-
};
|
|
194
|
-
codeActions[file].push({
|
|
195
|
-
range,
|
|
196
|
-
codeAction,
|
|
197
|
-
});
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return false;
|
|
202
|
-
};
|
|
203
|
-
// This action offers to wrap patterns that aren't option in Some.
|
|
204
|
-
let wrapInSome = ({ codeActions, diagnostic, file, line, range, array, index, }) => {
|
|
205
|
-
var _a;
|
|
206
|
-
if (line.startsWith("This pattern matches values of type")) {
|
|
207
|
-
let regex = /This pattern matches values of type (.*)$/;
|
|
208
|
-
let match = line.match(regex);
|
|
209
|
-
if (match === null) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
let [_, type] = match;
|
|
213
|
-
if (!type.startsWith("option<")) {
|
|
214
|
-
// Look for the expected type
|
|
215
|
-
let restOfMessage = array.slice(index + 1);
|
|
216
|
-
let lineIndexWithType = restOfMessage.findIndex((l) => l
|
|
217
|
-
.trim()
|
|
218
|
-
.startsWith("but a pattern was expected which matches values of type"));
|
|
219
|
-
if (lineIndexWithType === -1)
|
|
220
|
-
return false;
|
|
221
|
-
// The type is either on this line or the next
|
|
222
|
-
let [_, typ = ""] = restOfMessage[lineIndexWithType].split("but a pattern was expected which matches values of type");
|
|
223
|
-
if (typ.trim() === "") {
|
|
224
|
-
// Type is on the next line
|
|
225
|
-
typ = ((_a = restOfMessage[lineIndexWithType + 1]) !== null && _a !== void 0 ? _a : "").trim();
|
|
226
|
-
}
|
|
227
|
-
if (typ.trim().startsWith("option<")) {
|
|
228
|
-
codeActions[file] = codeActions[file] || [];
|
|
229
|
-
let codeAction = {
|
|
230
|
-
title: `Wrap in option Some`,
|
|
231
|
-
edit: {
|
|
232
|
-
changes: {
|
|
233
|
-
[file]: wrapRangeInText(range, `Some(`, `)`),
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
diagnostics: [diagnostic],
|
|
237
|
-
kind: p.CodeActionKind.QuickFix,
|
|
238
|
-
isPreferred: true,
|
|
239
|
-
};
|
|
240
|
-
codeActions[file].push({
|
|
241
|
-
range,
|
|
242
|
-
codeAction,
|
|
243
|
-
});
|
|
244
|
-
return true;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return false;
|
|
249
|
-
};
|
|
250
|
-
let handleUndefinedRecordFieldsAction = ({ recordFieldNames, codeActions, file, range, diagnostic, }) => {
|
|
251
|
-
if (recordFieldNames != null) {
|
|
252
|
-
codeActions[file] = codeActions[file] || [];
|
|
253
|
-
// The formatter outputs trailing commas automatically if the record
|
|
254
|
-
// definition is on multiple lines, and no trailing comma if it's on a
|
|
255
|
-
// single line. We need to adapt to this so we don't accidentally
|
|
256
|
-
// insert an invalid comma.
|
|
257
|
-
let multilineRecordDefinitionBody = range.start.line !== range.end.line;
|
|
258
|
-
// Let's build up the text we're going to insert.
|
|
259
|
-
let newText = "";
|
|
260
|
-
if (multilineRecordDefinitionBody) {
|
|
261
|
-
// If it's a multiline body, we know it looks like this:
|
|
262
|
-
// ```
|
|
263
|
-
// let someRecord = {
|
|
264
|
-
// atLeastOneExistingField: string,
|
|
265
|
-
// }
|
|
266
|
-
// ```
|
|
267
|
-
// We can figure out the formatting from the range the code action
|
|
268
|
-
// gives us. We'll insert to the direct left of the ending brace.
|
|
269
|
-
// The end char is the closing brace, and it's always going to be 2
|
|
270
|
-
// characters back from the record fields.
|
|
271
|
-
let paddingCharacters = multilineRecordDefinitionBody
|
|
272
|
-
? range.end.character + 2
|
|
273
|
-
: 0;
|
|
274
|
-
let paddingContentRecordField = Array.from({
|
|
275
|
-
length: paddingCharacters,
|
|
276
|
-
}).join(" ");
|
|
277
|
-
let paddingContentEndBrace = Array.from({
|
|
278
|
-
length: range.end.character,
|
|
279
|
-
}).join(" ");
|
|
280
|
-
recordFieldNames.forEach((fieldName, index) => {
|
|
281
|
-
if (index === 0) {
|
|
282
|
-
// This adds spacing from the ending brace up to the equivalent
|
|
283
|
-
// of the last record field name, needed for the first inserted
|
|
284
|
-
// record field name.
|
|
285
|
-
newText += " ";
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
// The rest of the new record field names will start from a new
|
|
289
|
-
// line, so they need left padding all the way to the same level
|
|
290
|
-
// as the rest of the record fields.
|
|
291
|
-
newText += paddingContentRecordField;
|
|
292
|
-
}
|
|
293
|
-
newText += `${fieldName}: failwith("TODO"),\n`;
|
|
294
|
-
});
|
|
295
|
-
// Let's put the end brace back where it was (we still have it to the direct right of us).
|
|
296
|
-
newText += `${paddingContentEndBrace}`;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
// A single line record definition body is a bit easier - we'll just add the new fields on the same line.
|
|
300
|
-
newText += ", ";
|
|
301
|
-
newText += recordFieldNames
|
|
302
|
-
.map((fieldName) => `${fieldName}: failwith("TODO")`)
|
|
303
|
-
.join(", ");
|
|
304
|
-
}
|
|
305
|
-
let codeAction = {
|
|
306
|
-
title: `Add missing record fields`,
|
|
307
|
-
edit: {
|
|
308
|
-
changes: {
|
|
309
|
-
[file]: insertBeforeEndingChar(range, newText),
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
diagnostics: [diagnostic],
|
|
313
|
-
kind: p.CodeActionKind.QuickFix,
|
|
314
|
-
isPreferred: true,
|
|
315
|
-
};
|
|
316
|
-
codeActions[file].push({
|
|
317
|
-
range,
|
|
318
|
-
codeAction,
|
|
319
|
-
});
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
return false;
|
|
323
|
-
};
|
|
324
|
-
// This action handles when the compiler errors on certain fields of a record
|
|
325
|
-
// being undefined. We then offers an action that inserts all of the record
|
|
326
|
-
// fields, with an `assert false` dummy value. `assert false` is so applying the
|
|
327
|
-
// code action actually compiles.
|
|
328
|
-
let addUndefinedRecordFieldsV10 = ({ array, codeActions, diagnostic, file, index, line, range, }) => {
|
|
329
|
-
var _a;
|
|
330
|
-
if (line.startsWith("Some record fields are undefined:")) {
|
|
331
|
-
let recordFieldNames = (_a = line
|
|
332
|
-
.trim()
|
|
333
|
-
.split("Some record fields are undefined: ")[1]) === null || _a === void 0 ? void 0 : _a.split(" ");
|
|
334
|
-
// This collects the rest of the fields if fields are printed on
|
|
335
|
-
// multiple lines.
|
|
336
|
-
array.slice(index + 1).forEach((line) => {
|
|
337
|
-
recordFieldNames.push(...line.trim().split(" "));
|
|
338
|
-
});
|
|
339
|
-
return handleUndefinedRecordFieldsAction({
|
|
340
|
-
recordFieldNames,
|
|
341
|
-
codeActions,
|
|
342
|
-
diagnostic,
|
|
343
|
-
file,
|
|
344
|
-
range,
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
return false;
|
|
348
|
-
};
|
|
349
|
-
let addUndefinedRecordFieldsV11 = ({ array, codeActions, diagnostic, file, index, line, range, }) => {
|
|
350
|
-
var _a;
|
|
351
|
-
if (line.startsWith("Some required record fields are missing:")) {
|
|
352
|
-
let recordFieldNames = (_a = line
|
|
353
|
-
.trim()
|
|
354
|
-
.split("Some required record fields are missing: ")[1]) === null || _a === void 0 ? void 0 : _a.split(" ");
|
|
355
|
-
// This collects the rest of the fields if fields are printed on
|
|
356
|
-
// multiple lines.
|
|
357
|
-
let stop = false;
|
|
358
|
-
array.slice(index + 1).forEach((line) => {
|
|
359
|
-
if (stop)
|
|
360
|
-
return;
|
|
361
|
-
recordFieldNames.push(...line.trim().split(".")[0].split(" "));
|
|
362
|
-
if (line.includes(".")) {
|
|
363
|
-
stop = true;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
return handleUndefinedRecordFieldsAction({
|
|
367
|
-
recordFieldNames,
|
|
368
|
-
codeActions,
|
|
369
|
-
diagnostic,
|
|
370
|
-
file,
|
|
371
|
-
range,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
return false;
|
|
375
|
-
};
|
|
376
|
-
// This action detects suggestions of converting between mismatches in types
|
|
377
|
-
// that the compiler tells us about.
|
|
378
|
-
let simpleConversion = ({ line, codeActions, file, range, diagnostic, }) => {
|
|
379
|
-
if (line.startsWith("You can convert ")) {
|
|
380
|
-
let regex = /You can convert (\w*) to (\w*) with ([\w.]*).$/;
|
|
381
|
-
let match = line.match(regex);
|
|
382
|
-
if (match === null) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
let [_, from, to, fn] = match;
|
|
386
|
-
if (from != null && to != null && fn != null) {
|
|
387
|
-
codeActions[file] = codeActions[file] || [];
|
|
388
|
-
let codeAction = {
|
|
389
|
-
title: `Convert ${from} to ${to} with ${fn}`,
|
|
390
|
-
edit: {
|
|
391
|
-
changes: {
|
|
392
|
-
[file]: wrapRangeInText(range, `${fn}(`, `)`),
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
diagnostics: [diagnostic],
|
|
396
|
-
kind: p.CodeActionKind.QuickFix,
|
|
397
|
-
isPreferred: true,
|
|
398
|
-
};
|
|
399
|
-
codeActions[file].push({
|
|
400
|
-
range,
|
|
401
|
-
codeAction,
|
|
402
|
-
});
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return false;
|
|
407
|
-
};
|
|
408
|
-
// This action will apply a curried function (essentially inserting a dot in the
|
|
409
|
-
// correct place).
|
|
410
|
-
let applyUncurried = ({ line, codeActions, file, range, diagnostic, }) => {
|
|
411
|
-
if (line.startsWith("This is an uncurried ReScript function. It must be applied with a dot.")) {
|
|
412
|
-
const locOfOpenFnParens = {
|
|
413
|
-
line: range.end.line,
|
|
414
|
-
character: range.end.character + 1,
|
|
415
|
-
};
|
|
416
|
-
codeActions[file] = codeActions[file] || [];
|
|
417
|
-
let codeAction = {
|
|
418
|
-
title: `Apply uncurried function call with dot`,
|
|
419
|
-
edit: {
|
|
420
|
-
changes: {
|
|
421
|
-
[file]: [
|
|
422
|
-
{
|
|
423
|
-
range: {
|
|
424
|
-
start: locOfOpenFnParens,
|
|
425
|
-
end: locOfOpenFnParens,
|
|
426
|
-
},
|
|
427
|
-
/*
|
|
428
|
-
* Turns `fn(123)` into `fn(. 123)`.
|
|
429
|
-
*/
|
|
430
|
-
newText: `. `,
|
|
431
|
-
},
|
|
432
|
-
],
|
|
433
|
-
},
|
|
434
|
-
},
|
|
435
|
-
diagnostics: [diagnostic],
|
|
436
|
-
kind: p.CodeActionKind.QuickFix,
|
|
437
|
-
isPreferred: true,
|
|
438
|
-
};
|
|
439
|
-
codeActions[file].push({
|
|
440
|
-
range,
|
|
441
|
-
codeAction,
|
|
442
|
-
});
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
return false;
|
|
446
|
-
};
|
|
447
|
-
// This action detects missing cases for exhaustive pattern matches, and offers
|
|
448
|
-
// to insert dummy branches (using `failwith("TODO")`) for those branches.
|
|
449
|
-
let simpleAddMissingCases = ({ line, codeActions, file, range, diagnostic, array, index, }) => {
|
|
450
|
-
if (line.startsWith("You forgot to handle a possible case here, for example:")) {
|
|
451
|
-
// This collects the rest of the fields if fields are printed on
|
|
452
|
-
// multiple lines.
|
|
453
|
-
let allCasesAsOneLine = array
|
|
454
|
-
.slice(index + 1)
|
|
455
|
-
.join("")
|
|
456
|
-
.trim();
|
|
457
|
-
let filePath = (0, url_1.fileURLToPath)(file);
|
|
458
|
-
let newSwitchCode = utils.runAnalysisAfterSanityCheck(filePath, [
|
|
459
|
-
"codemod",
|
|
460
|
-
filePath,
|
|
461
|
-
range.start.line,
|
|
462
|
-
range.start.character,
|
|
463
|
-
"add-missing-cases",
|
|
464
|
-
allCasesAsOneLine,
|
|
465
|
-
]);
|
|
466
|
-
codeActions[file] = codeActions[file] || [];
|
|
467
|
-
let codeAction = {
|
|
468
|
-
title: `Insert missing cases`,
|
|
469
|
-
edit: {
|
|
470
|
-
changes: {
|
|
471
|
-
[file]: replaceText(range, newSwitchCode),
|
|
472
|
-
},
|
|
473
|
-
},
|
|
474
|
-
diagnostics: [diagnostic],
|
|
475
|
-
kind: p.CodeActionKind.QuickFix,
|
|
476
|
-
isPreferred: true,
|
|
477
|
-
};
|
|
478
|
-
codeActions[file].push({
|
|
479
|
-
range,
|
|
480
|
-
codeAction,
|
|
481
|
-
});
|
|
482
|
-
return true;
|
|
483
|
-
}
|
|
484
|
-
return false;
|
|
485
|
-
};
|
|
486
|
-
// This detects concrete variables or values put in a position which expects an
|
|
487
|
-
// optional of that same type, and offers to wrap the value/variable in
|
|
488
|
-
// `Some()`.
|
|
489
|
-
let simpleTypeMismatches = ({ line, codeActions, file, range, diagnostic, array, index, }) => {
|
|
490
|
-
// Examples:
|
|
491
|
-
//
|
|
492
|
-
// 46 │ let as_ = {
|
|
493
|
-
// 47 │ someProp: "123",
|
|
494
|
-
// 48 │ another: "123",
|
|
495
|
-
// 49 │ }
|
|
496
|
-
// 50 │
|
|
497
|
-
// This has type: string
|
|
498
|
-
// Somewhere wanted: option<string>
|
|
499
|
-
//
|
|
500
|
-
// ...but types etc can also be on multilines, so we need a good
|
|
501
|
-
// amount of cleanup.
|
|
502
|
-
let lookFor = "This has type:";
|
|
503
|
-
if (line.startsWith(lookFor)) {
|
|
504
|
-
let thisHasTypeArr = takeUntil([line.slice(lookFor.length), ...array.slice(index + 1)], "Somewhere wanted:");
|
|
505
|
-
let somewhereWantedArr = array
|
|
506
|
-
.slice(index + thisHasTypeArr.length)
|
|
507
|
-
.map((line) => line.replace("Somewhere wanted:", ""));
|
|
508
|
-
let thisHasType = extractTypename(thisHasTypeArr);
|
|
509
|
-
let somewhereWanted = extractTypename(somewhereWantedArr);
|
|
510
|
-
// Switching over an option
|
|
511
|
-
if (thisHasType === `option<${somewhereWanted}>`) {
|
|
512
|
-
codeActions[file] = codeActions[file] || [];
|
|
513
|
-
// We can figure out default values for primitives etc.
|
|
514
|
-
let defaultValue = "assert false";
|
|
515
|
-
switch (somewhereWanted) {
|
|
516
|
-
case "string": {
|
|
517
|
-
defaultValue = `"-"`;
|
|
518
|
-
break;
|
|
519
|
-
}
|
|
520
|
-
case "bool": {
|
|
521
|
-
defaultValue = `false`;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
case "int": {
|
|
525
|
-
defaultValue = `-1`;
|
|
526
|
-
break;
|
|
527
|
-
}
|
|
528
|
-
case "float": {
|
|
529
|
-
defaultValue = `-1.`;
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
let codeAction = {
|
|
534
|
-
title: `Unwrap optional value`,
|
|
535
|
-
edit: {
|
|
536
|
-
changes: {
|
|
537
|
-
[file]: wrapRangeInText(range, "switch ", ` { | None => ${defaultValue} | Some(v) => v }`),
|
|
538
|
-
},
|
|
539
|
-
},
|
|
540
|
-
diagnostics: [diagnostic],
|
|
541
|
-
kind: p.CodeActionKind.QuickFix,
|
|
542
|
-
isPreferred: true,
|
|
543
|
-
};
|
|
544
|
-
codeActions[file].push({
|
|
545
|
-
range,
|
|
546
|
-
codeAction,
|
|
547
|
-
});
|
|
548
|
-
return true;
|
|
549
|
-
}
|
|
550
|
-
// Wrapping a non-optional in Some
|
|
551
|
-
if (`option<${thisHasType}>` === somewhereWanted) {
|
|
552
|
-
codeActions[file] = codeActions[file] || [];
|
|
553
|
-
let codeAction = {
|
|
554
|
-
title: `Wrap value in Some`,
|
|
555
|
-
edit: {
|
|
556
|
-
changes: {
|
|
557
|
-
[file]: wrapRangeInText(range, "Some(", ")"),
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
diagnostics: [diagnostic],
|
|
561
|
-
kind: p.CodeActionKind.QuickFix,
|
|
562
|
-
isPreferred: true,
|
|
563
|
-
};
|
|
564
|
-
codeActions[file].push({
|
|
565
|
-
range,
|
|
566
|
-
codeAction,
|
|
567
|
-
});
|
|
568
|
-
return true;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
return false;
|
|
572
|
-
};
|
|
573
|
-
//# sourceMappingURL=codeActions.js.map
|
package/out/codeActions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codeActions.js","sourceRoot":"","sources":["../src/codeActions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAA6E;AAC7E,4EAA4E;AAC5E,gBAAgB;AAChB,kEAAoD;AACpD,+CAAiC;AACjC,6BAAoC;AAcpC,IAAI,eAAe,GAAG,CACpB,KAAc,EACd,SAAiB,EACjB,OAAe,EACD,EAAE;IAChB,sEAAsE;IACtE,8BAA8B;IAC9B,IAAI,MAAM,GACR,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI;QACnC,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,GAAG,CAAC,SAAS;QAC3C,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;IAER,IAAI,UAAU,GAAG;QACf,KAAK,EAAE;YACL,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;YACtB,SAAS,EAAE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