@artel/artc 0.6.26026 → 0.6.26027
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/build/Cli.js +3 -3
- package/build/api/Api.js +10 -4
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +91 -362
- package/build/{chunk-35ZDOLQ3.js → chunk-4HXQNBLV.js} +2 -2
- package/build/{chunk-TWDMG7M3.js → chunk-HOPCXROF.js} +2 -2
- package/build/{chunk-UY7U6EAT.js → chunk-IJGHVDYP.js} +1160 -832
- package/build/types/api/Api.d.ts +5 -1
- package/build/types/api/ApiServices.d.ts +5 -0
- package/build/types/diagnostic/DiagnosticCode.d.ts +143 -142
- package/build/types/services/CustomRequests.d.ts +0 -55
- package/build/types/services/LanguageServer.d.ts +13 -7
- package/build/types/services/LanguageServerMessageHandler.d.ts +30 -0
- package/package.json +2 -2
- package/build/types/services/a/ScriptEditingService.d.ts +0 -13
package/build/Cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CommandLineCompiler
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-4HXQNBLV.js";
|
|
5
|
+
import "./chunk-HOPCXROF.js";
|
|
6
6
|
import {
|
|
7
7
|
__async
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IJGHVDYP.js";
|
|
9
9
|
|
|
10
10
|
// source/Cli.ts
|
|
11
11
|
function main() {
|
package/build/api/Api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Compiler
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-HOPCXROF.js";
|
|
4
4
|
import {
|
|
5
5
|
AccessKind,
|
|
6
6
|
AccessedFunction_entity,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
AliasedType,
|
|
13
13
|
Analyzer,
|
|
14
14
|
Analyzer2,
|
|
15
|
+
Analyzer3,
|
|
15
16
|
ArrayUtils,
|
|
16
17
|
ArtelSourceAndConfigurationFileExtensionSet,
|
|
17
18
|
ArtelSourceFileExtensionSet,
|
|
@@ -284,6 +285,7 @@ import {
|
|
|
284
285
|
keywordKindByOperatorKind,
|
|
285
286
|
localeToString,
|
|
286
287
|
locales,
|
|
288
|
+
m_exports,
|
|
287
289
|
modifierToModifierFlag,
|
|
288
290
|
operatorKindsBySyntacticalOperatorKind,
|
|
289
291
|
parseBinaryInteger,
|
|
@@ -299,6 +301,7 @@ import {
|
|
|
299
301
|
semantic_context_exports,
|
|
300
302
|
setUserLocale,
|
|
301
303
|
tokenTextByOperatorKind,
|
|
304
|
+
tree_exports,
|
|
302
305
|
tryParseLocale,
|
|
303
306
|
types_exports,
|
|
304
307
|
unescapeText,
|
|
@@ -307,7 +310,7 @@ import {
|
|
|
307
310
|
withoutQuotes,
|
|
308
311
|
withoutTemplateQuotes,
|
|
309
312
|
yieldTask
|
|
310
|
-
} from "../chunk-
|
|
313
|
+
} from "../chunk-IJGHVDYP.js";
|
|
311
314
|
export {
|
|
312
315
|
AccessKind,
|
|
313
316
|
AccessedFunction_entity,
|
|
@@ -318,7 +321,8 @@ export {
|
|
|
318
321
|
AccumulatingDiagnosticAcceptor,
|
|
319
322
|
AliasedType,
|
|
320
323
|
Analyzer,
|
|
321
|
-
|
|
324
|
+
Analyzer3 as AnalyzerA,
|
|
325
|
+
Analyzer2 as AnalyzerM,
|
|
322
326
|
ArrayUtils,
|
|
323
327
|
ArtelSourceAndConfigurationFileExtensionSet,
|
|
324
328
|
ArtelSourceFileExtensionSet,
|
|
@@ -606,7 +610,9 @@ export {
|
|
|
606
610
|
semantic_context_exports as semanticContext,
|
|
607
611
|
setUserLocale,
|
|
608
612
|
tokenTextByOperatorKind,
|
|
609
|
-
|
|
613
|
+
tree_exports as tree,
|
|
614
|
+
a_exports as treeA,
|
|
615
|
+
m_exports as treeM,
|
|
610
616
|
tryParseLocale,
|
|
611
617
|
types_exports as type,
|
|
612
618
|
unescapeText,
|
package/build/api/ApiNodeJS.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
PhysicalFileSystem,
|
|
7
7
|
PhysicalTypeScriptLibrariesProvider,
|
|
8
8
|
PrintingDiagnosticAcceptor
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-4HXQNBLV.js";
|
|
10
|
+
import "../chunk-HOPCXROF.js";
|
|
11
|
+
import "../chunk-IJGHVDYP.js";
|
|
12
12
|
export {
|
|
13
13
|
CommandLineCompiler,
|
|
14
14
|
FileSystemUri,
|
package/build/api/ApiServices.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AccessedFunction_entity,
|
|
3
3
|
AccessedFunction_typeMember,
|
|
4
4
|
AccessorEntity,
|
|
5
|
-
|
|
5
|
+
Analyzer3 as Analyzer,
|
|
6
6
|
Cached,
|
|
7
7
|
CancelledError,
|
|
8
8
|
CompilationLoader,
|
|
@@ -39,7 +39,6 @@ import {
|
|
|
39
39
|
NamedType_structured,
|
|
40
40
|
NamedType_variant,
|
|
41
41
|
NodeModulesDirectoryName,
|
|
42
|
-
NodePath,
|
|
43
42
|
Option,
|
|
44
43
|
PackageMemberLookup,
|
|
45
44
|
ParameterDeclaration_matchResultParameter,
|
|
@@ -64,6 +63,7 @@ import {
|
|
|
64
63
|
TypeMemberLookupA,
|
|
65
64
|
TypeWithMembersOrExtensionEntity,
|
|
66
65
|
Uri,
|
|
66
|
+
UrisRelativityKind,
|
|
67
67
|
VariableDeclaration_entity,
|
|
68
68
|
VariableDeclaration_typeMember,
|
|
69
69
|
WellKnownDeclarationsLoadError,
|
|
@@ -91,10 +91,8 @@ import {
|
|
|
91
91
|
isPackageStructuredTypeDeclaration,
|
|
92
92
|
isPackageTypeDeclaration,
|
|
93
93
|
isPackageTypeEntity,
|
|
94
|
-
isRegularOrBlockFunctionLiteral,
|
|
95
94
|
isSourceOrConfigurationFileName,
|
|
96
95
|
isStatement,
|
|
97
|
-
isSubprogramDeclarationOrLiteral,
|
|
98
96
|
isTypeEntity,
|
|
99
97
|
isTypeEntityWithMembers,
|
|
100
98
|
isTypeMemberDeclaration,
|
|
@@ -109,11 +107,41 @@ import {
|
|
|
109
107
|
sortModifiers,
|
|
110
108
|
traverseTreeAsync,
|
|
111
109
|
yieldTask
|
|
112
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-IJGHVDYP.js";
|
|
113
111
|
|
|
114
|
-
// source/services/
|
|
112
|
+
// source/services/common/Types.ts
|
|
115
113
|
import * as ls from "vscode-languageserver";
|
|
116
|
-
var
|
|
114
|
+
var SourceLocation = class {
|
|
115
|
+
constructor(sourceFile, range) {
|
|
116
|
+
this.sourceFile = sourceFile;
|
|
117
|
+
this.range = range;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function isCompletionItemData(value) {
|
|
121
|
+
Debug.cast(value);
|
|
122
|
+
return value instanceof Object && typeof value.cacheId === "number" && typeof value.indexInCache === "number";
|
|
123
|
+
}
|
|
124
|
+
function isCodeActionData(value) {
|
|
125
|
+
Debug.cast(value);
|
|
126
|
+
return value instanceof Object && typeof value.name === "string" && value.location instanceof Object && ls.DocumentUri.is(value.location.uri) && ls.Position.is(value.location.position) && "data" in value;
|
|
127
|
+
}
|
|
128
|
+
var SourceFileEdit = class {
|
|
129
|
+
constructor(sourceFile, range, text) {
|
|
130
|
+
this.sourceFile = sourceFile;
|
|
131
|
+
this.range = range;
|
|
132
|
+
this.text = text;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var NodeLocation = class {
|
|
136
|
+
constructor(sourceFile, path) {
|
|
137
|
+
this.sourceFile = sourceFile;
|
|
138
|
+
this.path = path;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// source/services/CustomRequests.ts
|
|
143
|
+
import * as ls2 from "vscode-languageserver";
|
|
144
|
+
var CustomRequestType = class extends ls2.RequestType {
|
|
117
145
|
};
|
|
118
146
|
var customRequests = {
|
|
119
147
|
getLocalesAvailableForTranslation: new CustomRequestType("artel/getLocalesAvailableForTranslation"),
|
|
@@ -123,12 +151,7 @@ var customRequests = {
|
|
|
123
151
|
emitCodeToString: new CustomRequestType("artel/emitCodeToString"),
|
|
124
152
|
displayFileSystemTree: new CustomRequestType("artel/displayFileSystemTree"),
|
|
125
153
|
createOrUpdateSourceFile: new CustomRequestType("artel/fs.createOrUpdateSourceFile"),
|
|
126
|
-
deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile")
|
|
127
|
-
getNodeRange: new CustomRequestType("artel/getNodeRange"),
|
|
128
|
-
assignField: new CustomRequestType("artel/assignField"),
|
|
129
|
-
addBlocksToScript: new CustomRequestType("artel/addBlocksToScript"),
|
|
130
|
-
canDeleteBlocksFromScript: new CustomRequestType("artel/canDeleteBlocksFromScript"),
|
|
131
|
-
deleteBlocksFromScript: new CustomRequestType("artel/deleteBlocksFromScript")
|
|
154
|
+
deleteSourceFile: new CustomRequestType("artel/fs.deleteSourceFile")
|
|
132
155
|
};
|
|
133
156
|
|
|
134
157
|
// source/services/LanguageServer.ts
|
|
@@ -158,36 +181,6 @@ function isGenerateMissingTranslationsCodeActionData(value) {
|
|
|
158
181
|
return value instanceof Object && typeof value.onlyTypeMembers === "boolean";
|
|
159
182
|
}
|
|
160
183
|
|
|
161
|
-
// source/services/common/Types.ts
|
|
162
|
-
import * as ls2 from "vscode-languageserver";
|
|
163
|
-
var SourceLocation = class {
|
|
164
|
-
constructor(sourceFile, range) {
|
|
165
|
-
this.sourceFile = sourceFile;
|
|
166
|
-
this.range = range;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
function isCompletionItemData(value) {
|
|
170
|
-
Debug.cast(value);
|
|
171
|
-
return value instanceof Object && typeof value.cacheId === "number" && typeof value.indexInCache === "number";
|
|
172
|
-
}
|
|
173
|
-
function isCodeActionData(value) {
|
|
174
|
-
Debug.cast(value);
|
|
175
|
-
return value instanceof Object && typeof value.name === "string" && value.location instanceof Object && ls2.DocumentUri.is(value.location.uri) && ls2.Position.is(value.location.position) && "data" in value;
|
|
176
|
-
}
|
|
177
|
-
var SourceFileEdit = class {
|
|
178
|
-
constructor(sourceFile, range, text) {
|
|
179
|
-
this.sourceFile = sourceFile;
|
|
180
|
-
this.range = range;
|
|
181
|
-
this.text = text;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
var NodeLocation = class {
|
|
185
|
-
constructor(sourceFile, path) {
|
|
186
|
-
this.sourceFile = sourceFile;
|
|
187
|
-
this.path = path;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
184
|
// source/services/a/TreeUtils.ts
|
|
192
185
|
function getPrecedingToken(sourceFile, offset) {
|
|
193
186
|
let token = getTokenAtOffset(sourceFile, offset, true);
|
|
@@ -6224,155 +6217,6 @@ var RenameServiceA = class extends RenameService {
|
|
|
6224
6217
|
}
|
|
6225
6218
|
};
|
|
6226
6219
|
|
|
6227
|
-
// source/services/common/script-editing/ScriptEditingService.ts
|
|
6228
|
-
var ScriptEditingService = class _ScriptEditingService {
|
|
6229
|
-
static {
|
|
6230
|
-
this.indentationStep = " ";
|
|
6231
|
-
}
|
|
6232
|
-
static {
|
|
6233
|
-
this.elementParameterNameText = "o";
|
|
6234
|
-
}
|
|
6235
|
-
static {
|
|
6236
|
-
this.elementParameterName = new Name(_ScriptEditingService.elementParameterNameText);
|
|
6237
|
-
}
|
|
6238
|
-
createScriptBlockText(blockInfo, indentation, newLine) {
|
|
6239
|
-
const i = indentation;
|
|
6240
|
-
const s = _ScriptEditingService.indentationStep;
|
|
6241
|
-
const nl = newLine;
|
|
6242
|
-
const el = _ScriptEditingService.elementParameterNameText;
|
|
6243
|
-
let result = `${i}${blockInfo.name}(${nl}${i}${s}key = ${blockInfo.key},${nl}`;
|
|
6244
|
-
if (blockInfo.areaIndex !== void 0) {
|
|
6245
|
-
result += `${i}${s}areaIndex = ${blockInfo.areaIndex},${nl}`;
|
|
6246
|
-
}
|
|
6247
|
-
result += `${i}${s}body =${nl}${i}${s}{${nl}` + Object.entries(blockInfo.elementProperties).map(([p, v]) => `${i}${s}${s}${el}.${p} = ${v}${nl}`).join("");
|
|
6248
|
-
if (blockInfo.nestedBlocks.length > 0) {
|
|
6249
|
-
result += blockInfo.nestedBlocks.map((b) => this.createScriptBlockText(b, `${i}${s}${s}`, nl) + nl).join("");
|
|
6250
|
-
}
|
|
6251
|
-
result += `${i}${s}})`;
|
|
6252
|
-
return result;
|
|
6253
|
-
}
|
|
6254
|
-
detectNewLine(text) {
|
|
6255
|
-
return text.includes("\r\n") ? "\r\n" : "\n";
|
|
6256
|
-
}
|
|
6257
|
-
};
|
|
6258
|
-
|
|
6259
|
-
// source/services/a/ScriptEditingService.ts
|
|
6260
|
-
var ScriptEditingServiceA = class _ScriptEditingServiceA extends ScriptEditingService {
|
|
6261
|
-
createEditWithFieldAssignment(analyzer, sourceFile, scriptDeclaration, fieldName, value) {
|
|
6262
|
-
const subprogramBlock = scriptDeclaration.block;
|
|
6263
|
-
if (subprogramBlock === void 0) {
|
|
6264
|
-
return void 0;
|
|
6265
|
-
}
|
|
6266
|
-
const lastAssignmentStatement = this.findLastAssignmentToField(analyzer, subprogramBlock, fieldName);
|
|
6267
|
-
let result;
|
|
6268
|
-
if (lastAssignmentStatement !== void 0) {
|
|
6269
|
-
result = new SourceFileEdit(sourceFile, lastAssignmentStatement.right.rangeWithoutTrivia, value);
|
|
6270
|
-
} else {
|
|
6271
|
-
const assignmentText = `${_ScriptEditingServiceA.elementParameterNameText}.${fieldName} = ${value}`;
|
|
6272
|
-
const lastStatement = subprogramBlock.statementList?.statements.last();
|
|
6273
|
-
let editRange;
|
|
6274
|
-
let indentationText;
|
|
6275
|
-
if (lastStatement !== void 0) {
|
|
6276
|
-
editRange = Range.empty(lastStatement.rangeWithoutTrivia.end);
|
|
6277
|
-
const statementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
|
|
6278
|
-
indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(statementStartCharacter)}`;
|
|
6279
|
-
} else {
|
|
6280
|
-
const openBraceRange = subprogramBlock.openBraceToken.rangeWithoutTrivia;
|
|
6281
|
-
const closeBraceRange = subprogramBlock.closeBraceToken.rangeWithoutTrivia;
|
|
6282
|
-
const openBracePosition = sourceFile.getPositionAt(openBraceRange.start);
|
|
6283
|
-
const closeBracePosition = sourceFile.getPositionAt(closeBraceRange.start);
|
|
6284
|
-
if (openBracePosition.line !== closeBracePosition.line) {
|
|
6285
|
-
editRange = Range.empty(openBraceRange.end);
|
|
6286
|
-
indentationText = `${this.detectNewLine(sourceFile.getSourceText())}${" ".repeat(closeBracePosition.character + 2)}`;
|
|
6287
|
-
} else {
|
|
6288
|
-
editRange = Range.empty(openBraceRange.end);
|
|
6289
|
-
indentationText = " ";
|
|
6290
|
-
}
|
|
6291
|
-
}
|
|
6292
|
-
result = new SourceFileEdit(sourceFile, editRange, `${indentationText}${assignmentText}`);
|
|
6293
|
-
}
|
|
6294
|
-
return result;
|
|
6295
|
-
}
|
|
6296
|
-
createEditAddingBlocks(sourceFile, scriptDeclaration, addedBlockInfos) {
|
|
6297
|
-
const subprogramBlock = scriptDeclaration.block;
|
|
6298
|
-
if (subprogramBlock === void 0) {
|
|
6299
|
-
return void 0;
|
|
6300
|
-
}
|
|
6301
|
-
let scriptBlockIndentation;
|
|
6302
|
-
let editStart;
|
|
6303
|
-
const lastStatement = subprogramBlock.statementList.statements.last();
|
|
6304
|
-
if (lastStatement !== void 0) {
|
|
6305
|
-
const lastStatementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
|
|
6306
|
-
scriptBlockIndentation = " ".repeat(lastStatementStartCharacter);
|
|
6307
|
-
editStart = lastStatement.rangeWithoutTrivia.end;
|
|
6308
|
-
} else {
|
|
6309
|
-
const openBraceStartCharacter = sourceFile.getPositionAt(subprogramBlock.openBraceToken.rangeWithoutTrivia.start).character;
|
|
6310
|
-
scriptBlockIndentation = " ".repeat(openBraceStartCharacter) + _ScriptEditingServiceA.indentationStep;
|
|
6311
|
-
editStart = subprogramBlock.openBraceToken.rangeWithoutTrivia.end;
|
|
6312
|
-
}
|
|
6313
|
-
const newLine = this.detectNewLine(sourceFile.getSourceText());
|
|
6314
|
-
const scriptBlocksText = addedBlockInfos.map((i) => this.createScriptBlockText(i, scriptBlockIndentation, newLine)).join(newLine);
|
|
6315
|
-
const editText = `${newLine}${scriptBlocksText}`;
|
|
6316
|
-
const result = new SourceFileEdit(sourceFile, Range.empty(editStart), editText);
|
|
6317
|
-
return result;
|
|
6318
|
-
}
|
|
6319
|
-
canDeleteBlocks(outerScriptFunctionLocation, scriptFunctionLocations) {
|
|
6320
|
-
const outerScriptPathText = outerScriptFunctionLocation.path.toString();
|
|
6321
|
-
return scriptFunctionLocations.every((l) => l.sourceFile === outerScriptFunctionLocation.sourceFile && l.path.toString().startsWith(outerScriptPathText));
|
|
6322
|
-
}
|
|
6323
|
-
createEditDeletingBlock(sourceFile, scriptDeclaration) {
|
|
6324
|
-
let result;
|
|
6325
|
-
if (isRegularOrBlockFunctionLiteral(scriptDeclaration) && scriptDeclaration.parent.kind === 148 /* Argument */ && scriptDeclaration.parent.parent.parent.kind === 65 /* CallExpression */) {
|
|
6326
|
-
const callExpression = scriptDeclaration.parent.parent.parent;
|
|
6327
|
-
let rangeStart = callExpression.rangeWithoutTrivia.start;
|
|
6328
|
-
let rangeEnd = callExpression.rangeWithoutTrivia.end;
|
|
6329
|
-
const leadingTrivia = callExpression.findLeftmostToken()?.selectLeadingTrivia(() => true);
|
|
6330
|
-
const lastLeadingTrivia = leadingTrivia !== void 0 && leadingTrivia.length > 0 ? leadingTrivia[leadingTrivia.length - 1] : void 0;
|
|
6331
|
-
if (lastLeadingTrivia?.kind === 0 /* Whitespace */) {
|
|
6332
|
-
rangeStart = lastLeadingTrivia.range.start;
|
|
6333
|
-
}
|
|
6334
|
-
const trailingTrivia = callExpression.findRightmostToken()?.selectTrailingTrivia(() => true);
|
|
6335
|
-
if (trailingTrivia !== void 0) {
|
|
6336
|
-
let trailingTriviaIndex = -1;
|
|
6337
|
-
if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 0 /* Whitespace */) {
|
|
6338
|
-
trailingTriviaIndex++;
|
|
6339
|
-
}
|
|
6340
|
-
if (trailingTrivia.length > trailingTriviaIndex + 1 && trailingTrivia[trailingTriviaIndex + 1].kind === 1 /* NewLine */) {
|
|
6341
|
-
trailingTriviaIndex++;
|
|
6342
|
-
}
|
|
6343
|
-
if (trailingTriviaIndex >= 0) {
|
|
6344
|
-
rangeEnd = trailingTrivia[trailingTriviaIndex].range.end;
|
|
6345
|
-
}
|
|
6346
|
-
}
|
|
6347
|
-
result = new SourceFileEdit(sourceFile, new Range(rangeStart, rangeEnd), "");
|
|
6348
|
-
}
|
|
6349
|
-
return result;
|
|
6350
|
-
}
|
|
6351
|
-
findLastAssignmentToField(analyzer, block, fieldNameText) {
|
|
6352
|
-
const fieldName = new Name(fieldNameText);
|
|
6353
|
-
const statements = block.statementList.statements.toArray();
|
|
6354
|
-
for (let i = statements.length - 1; i >= 0; i--) {
|
|
6355
|
-
const statement = statements[i];
|
|
6356
|
-
if (statement.kind === 90 /* AssignmentStatement */) {
|
|
6357
|
-
const left = statement.left.unwrapParenthesizedExpressions();
|
|
6358
|
-
if (left.kind === 73 /* MemberAccessExpression */) {
|
|
6359
|
-
const memberAccessMeaning = analyzer.resolveMemberAccessExpression(left);
|
|
6360
|
-
if (memberAccessMeaning.kind === "instance-field-access" && memberAccessMeaning.field.getName().considerEqual(fieldName)) {
|
|
6361
|
-
const receiver = left.expression.unwrapParenthesizedExpressions();
|
|
6362
|
-
if (receiver.kind === 86 /* IdentifierExpression */) {
|
|
6363
|
-
const receiverMeaning = analyzer.resolveIdentifierExpression(receiver);
|
|
6364
|
-
if (receiverMeaning.kind === "variable-access" && receiverMeaning.variable.getName().considerEqual(_ScriptEditingServiceA.elementParameterName)) {
|
|
6365
|
-
return statement;
|
|
6366
|
-
}
|
|
6367
|
-
}
|
|
6368
|
-
}
|
|
6369
|
-
}
|
|
6370
|
-
}
|
|
6371
|
-
}
|
|
6372
|
-
return void 0;
|
|
6373
|
-
}
|
|
6374
|
-
};
|
|
6375
|
-
|
|
6376
6220
|
// source/services/common/selection-rage/Types.ts
|
|
6377
6221
|
var SelectionRange = class {
|
|
6378
6222
|
constructor(range, parent) {
|
|
@@ -10201,9 +10045,13 @@ var EntityToSyntax = class {
|
|
|
10201
10045
|
return SyntaxFactory.indexedElementGetterDeclaration(tags, modifiers, parameters, type, void 0);
|
|
10202
10046
|
}
|
|
10203
10047
|
case 5 /* IndexedElementSetter */: {
|
|
10048
|
+
const owningEntity = entity.getAccessorOwner();
|
|
10049
|
+
if (owningEntity?.kind !== 3 /* Indexer */) {
|
|
10050
|
+
return SyntaxFactory.missingTypeMemberDeclaration([], []);
|
|
10051
|
+
}
|
|
10204
10052
|
const parameterEntities = entity.getParameters();
|
|
10205
10053
|
const parameters = this.convertParameters(parameterEntities.slice(0, parameterEntities.length - 1));
|
|
10206
|
-
const type = this.convertType(
|
|
10054
|
+
const type = this.convertType(owningEntity.getType());
|
|
10207
10055
|
return SyntaxFactory.indexedElementSetterDeclaration(tags, modifiers, parameters, type, void 0);
|
|
10208
10056
|
}
|
|
10209
10057
|
case 6 /* DereferencedVariableGetter */: {
|
|
@@ -10211,7 +10059,11 @@ var EntityToSyntax = class {
|
|
|
10211
10059
|
return SyntaxFactory.dereferencedVariableGetterDeclaration(tags, modifiers, type, void 0);
|
|
10212
10060
|
}
|
|
10213
10061
|
case 7 /* DereferencedVariableSetter */: {
|
|
10214
|
-
const
|
|
10062
|
+
const owningEntity = entity.getAccessorOwner();
|
|
10063
|
+
if (owningEntity?.kind !== 4 /* DereferenceOperator */) {
|
|
10064
|
+
return SyntaxFactory.missingTypeMemberDeclaration([], []);
|
|
10065
|
+
}
|
|
10066
|
+
const type = this.convertType(owningEntity.getType());
|
|
10215
10067
|
return SyntaxFactory.dereferencedVariableSetterDeclaration(tags, modifiers, type, void 0);
|
|
10216
10068
|
}
|
|
10217
10069
|
default:
|
|
@@ -11082,7 +10934,6 @@ var _LanguageServer = class _LanguageServer {
|
|
|
11082
10934
|
this.signatureHelpServiceA = new SignatureHelpServiceA();
|
|
11083
10935
|
this.fileSystemTreeDisplayService = new FileSystemTreeDisplayService();
|
|
11084
10936
|
this.selectionRangeServiceA = new SelectionRangeServiceA();
|
|
11085
|
-
this.scriptEditingServiceA = new ScriptEditingServiceA();
|
|
11086
10937
|
this.codeActionsServiceA = new CodeActionsServiceA();
|
|
11087
10938
|
this.connection = config.connection;
|
|
11088
10939
|
this.config = config;
|
|
@@ -11101,6 +10952,22 @@ var _LanguageServer = class _LanguageServer {
|
|
|
11101
10952
|
static {
|
|
11102
10953
|
this.DefaultCancellationTokenThrottleTime = 50;
|
|
11103
10954
|
}
|
|
10955
|
+
registerMessageHandler(handler) {
|
|
10956
|
+
switch (handler.kind) {
|
|
10957
|
+
case "request": {
|
|
10958
|
+
const disposable = this.connection.onRequest(handler.requestType, (params, token) => this.withTaskController(token, (taskController) => handler.onRequest(params, this.getOrCreateMessageHandlerContext(), taskController)));
|
|
10959
|
+
this.disposables.push(disposable);
|
|
10960
|
+
break;
|
|
10961
|
+
}
|
|
10962
|
+
case "notification": {
|
|
10963
|
+
const disposable = this.connection.onNotification(handler.notificationType, (params) => this.withTaskController(void 0, (taskController) => handler.onNotification(params, this.getOrCreateMessageHandlerContext(), taskController)));
|
|
10964
|
+
this.disposables.push(disposable);
|
|
10965
|
+
break;
|
|
10966
|
+
}
|
|
10967
|
+
default:
|
|
10968
|
+
Debug.never(handler);
|
|
10969
|
+
}
|
|
10970
|
+
}
|
|
11104
10971
|
start() {
|
|
11105
10972
|
let disposable;
|
|
11106
10973
|
disposable = this.connection.onInitialize((params) => this.onInitialize(params));
|
|
@@ -11177,16 +11044,6 @@ var _LanguageServer = class _LanguageServer {
|
|
|
11177
11044
|
(params) => this.onDeleteSourceFile(params)
|
|
11178
11045
|
);
|
|
11179
11046
|
this.disposables.push(disposable);
|
|
11180
|
-
disposable = this.connection.onRequest(customRequests.getNodeRange, (params, token) => this.withTaskController(token, (taskController) => this.onGetNodeRange(params, taskController)));
|
|
11181
|
-
this.disposables.push(disposable);
|
|
11182
|
-
disposable = this.connection.onRequest(customRequests.assignField, (params, token) => this.withTaskController(token, (taskController) => this.onAssignField(params, taskController)));
|
|
11183
|
-
this.disposables.push(disposable);
|
|
11184
|
-
disposable = this.connection.onRequest(customRequests.addBlocksToScript, (params, token) => this.withTaskController(token, (taskController) => this.onAddBlocksToScript(params, taskController)));
|
|
11185
|
-
this.disposables.push(disposable);
|
|
11186
|
-
disposable = this.connection.onRequest(customRequests.canDeleteBlocksFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onCanDeleteBlocksFromScript(params, taskController)));
|
|
11187
|
-
this.disposables.push(disposable);
|
|
11188
|
-
disposable = this.connection.onRequest(customRequests.deleteBlocksFromScript, (params, token) => this.withTaskController(token, (taskController) => this.onDeleteBlocksFromScript(params, taskController)));
|
|
11189
|
-
this.disposables.push(disposable);
|
|
11190
11047
|
this.connection.listen();
|
|
11191
11048
|
}
|
|
11192
11049
|
dispose() {
|
|
@@ -11831,143 +11688,6 @@ var _LanguageServer = class _LanguageServer {
|
|
|
11831
11688
|
const code = diagnostic.data.code;
|
|
11832
11689
|
return { message, range, severity, tags, code };
|
|
11833
11690
|
}
|
|
11834
|
-
onAssignField(params, taskController) {
|
|
11835
|
-
return __async(this, null, function* () {
|
|
11836
|
-
const scriptFunctionUri = URI.parse(params.scriptFunctionUri);
|
|
11837
|
-
const sourceFileContext = yield this.getSourceFileContext(scriptFunctionUri, taskController);
|
|
11838
|
-
if (sourceFileContext !== void 0) {
|
|
11839
|
-
const { analyzer, sourceFile } = sourceFileContext;
|
|
11840
|
-
let sourceFileEdit;
|
|
11841
|
-
switch (sourceFile.dialect) {
|
|
11842
|
-
case 0 /* ArtelA */: {
|
|
11843
|
-
const scriptDeclaration = NodePath.parse(scriptFunctionUri.fragment).getNode(sourceFile.getSyntaxNode());
|
|
11844
|
-
if (scriptDeclaration !== void 0 && isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
|
|
11845
|
-
sourceFileEdit = this.scriptEditingServiceA.createEditWithFieldAssignment(
|
|
11846
|
-
analyzer.dialectA,
|
|
11847
|
-
sourceFile,
|
|
11848
|
-
scriptDeclaration,
|
|
11849
|
-
params.fieldName,
|
|
11850
|
-
params.value
|
|
11851
|
-
);
|
|
11852
|
-
}
|
|
11853
|
-
break;
|
|
11854
|
-
}
|
|
11855
|
-
case 1 /* ArtelM */:
|
|
11856
|
-
break;
|
|
11857
|
-
default:
|
|
11858
|
-
Debug.never(sourceFile);
|
|
11859
|
-
}
|
|
11860
|
-
if (sourceFileEdit !== void 0) {
|
|
11861
|
-
const textDocumentEdit = this.convertSourceFileEdit(sourceFileEdit);
|
|
11862
|
-
const workspaceEdit = { documentChanges: [textDocumentEdit] };
|
|
11863
|
-
yield this.connection.workspace.applyEdit(workspaceEdit);
|
|
11864
|
-
}
|
|
11865
|
-
}
|
|
11866
|
-
});
|
|
11867
|
-
}
|
|
11868
|
-
onAddBlocksToScript(params, taskController) {
|
|
11869
|
-
return __async(this, null, function* () {
|
|
11870
|
-
const sourceFileEdits = new Array();
|
|
11871
|
-
const convertAddedScriptBlock = (block) => {
|
|
11872
|
-
return {
|
|
11873
|
-
name: block.name,
|
|
11874
|
-
key: block.key,
|
|
11875
|
-
areaIndex: block.areaIndex,
|
|
11876
|
-
elementProperties: block.elementProperties ?? {},
|
|
11877
|
-
nestedBlocks: block.nestedBlocks?.map(convertAddedScriptBlock) ?? []
|
|
11878
|
-
};
|
|
11879
|
-
};
|
|
11880
|
-
for (const scriptBlockAddedToOuterScript of params) {
|
|
11881
|
-
const scriptFunctionUri = URI.parse(scriptBlockAddedToOuterScript.outerScriptFunctionUri);
|
|
11882
|
-
const sourceFileContext = yield this.getSourceFileContext(scriptFunctionUri, taskController);
|
|
11883
|
-
if (sourceFileContext !== void 0) {
|
|
11884
|
-
const { sourceFile } = sourceFileContext;
|
|
11885
|
-
let sourceFileEdit;
|
|
11886
|
-
switch (sourceFile.dialect) {
|
|
11887
|
-
case 0 /* ArtelA */: {
|
|
11888
|
-
const scriptDeclaration = NodePath.parse(scriptFunctionUri.fragment).getNode(sourceFile.getSyntaxNode());
|
|
11889
|
-
if (scriptDeclaration !== void 0 && isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
|
|
11890
|
-
const addedBlockInfos = scriptBlockAddedToOuterScript.values.map(convertAddedScriptBlock);
|
|
11891
|
-
sourceFileEdit = this.scriptEditingServiceA.createEditAddingBlocks(
|
|
11892
|
-
sourceFile,
|
|
11893
|
-
scriptDeclaration,
|
|
11894
|
-
addedBlockInfos
|
|
11895
|
-
);
|
|
11896
|
-
}
|
|
11897
|
-
break;
|
|
11898
|
-
}
|
|
11899
|
-
case 1 /* ArtelM */:
|
|
11900
|
-
break;
|
|
11901
|
-
default:
|
|
11902
|
-
Debug.never(sourceFile);
|
|
11903
|
-
}
|
|
11904
|
-
if (sourceFileEdit !== void 0) {
|
|
11905
|
-
sourceFileEdits.push(sourceFileEdit);
|
|
11906
|
-
}
|
|
11907
|
-
}
|
|
11908
|
-
}
|
|
11909
|
-
if (sourceFileEdits.length > 0) {
|
|
11910
|
-
const workspaceEdit = this.convertSourceFileEditsToWorkspaceEdit(sourceFileEdits);
|
|
11911
|
-
yield this.connection.workspace.applyEdit(workspaceEdit);
|
|
11912
|
-
}
|
|
11913
|
-
});
|
|
11914
|
-
}
|
|
11915
|
-
onCanDeleteBlocksFromScript(params, taskController) {
|
|
11916
|
-
return __async(this, null, function* () {
|
|
11917
|
-
let result = false;
|
|
11918
|
-
const outerScriptFunctionUri = URI.parse(params.outerScriptFunctionUri);
|
|
11919
|
-
const sourceFileContext = yield this.getSourceFileContext(outerScriptFunctionUri, taskController);
|
|
11920
|
-
if (sourceFileContext !== void 0) {
|
|
11921
|
-
const outerScriptFunctionLocation = new NodeLocation(
|
|
11922
|
-
sourceFileContext.sourceFile,
|
|
11923
|
-
NodePath.parse(outerScriptFunctionUri.fragment)
|
|
11924
|
-
);
|
|
11925
|
-
const scriptFunctionLocations = Query.from(params.scriptFunctionUris).map((u) => {
|
|
11926
|
-
const parsedVscodeUri = URI.parse(u);
|
|
11927
|
-
const uri = this.convertVscodeUriToUri(parsedVscodeUri);
|
|
11928
|
-
const sourceFile = sourceFileContext.analyzer.compilation.getSourceFileByUri(uri);
|
|
11929
|
-
return sourceFile !== void 0 ? new NodeLocation(sourceFile, NodePath.parse(parsedVscodeUri.fragment)) : void 0;
|
|
11930
|
-
}).toNullable();
|
|
11931
|
-
if (scriptFunctionLocations !== void 0) {
|
|
11932
|
-
result = this.scriptEditingServiceA.canDeleteBlocks(outerScriptFunctionLocation, scriptFunctionLocations);
|
|
11933
|
-
}
|
|
11934
|
-
}
|
|
11935
|
-
return result;
|
|
11936
|
-
});
|
|
11937
|
-
}
|
|
11938
|
-
onDeleteBlocksFromScript(params, taskController) {
|
|
11939
|
-
return __async(this, null, function* () {
|
|
11940
|
-
const sourceFileEdits = new Array();
|
|
11941
|
-
for (const scriptFunctionUri of params.scriptFunctionUris) {
|
|
11942
|
-
const parsedScriptFunctionUri = URI.parse(scriptFunctionUri);
|
|
11943
|
-
const sourceFileContext = yield this.getSourceFileContext(parsedScriptFunctionUri, taskController);
|
|
11944
|
-
if (sourceFileContext !== void 0) {
|
|
11945
|
-
const { sourceFile } = sourceFileContext;
|
|
11946
|
-
let sourceFileEdit;
|
|
11947
|
-
switch (sourceFile.dialect) {
|
|
11948
|
-
case 0 /* ArtelA */: {
|
|
11949
|
-
const scriptDeclaration = NodePath.parse(parsedScriptFunctionUri.fragment).getNode(sourceFile.getSyntaxNode());
|
|
11950
|
-
if (scriptDeclaration !== void 0 && isSubprogramDeclarationOrLiteral(scriptDeclaration)) {
|
|
11951
|
-
sourceFileEdit = this.scriptEditingServiceA.createEditDeletingBlock(sourceFile, scriptDeclaration);
|
|
11952
|
-
}
|
|
11953
|
-
break;
|
|
11954
|
-
}
|
|
11955
|
-
case 1 /* ArtelM */:
|
|
11956
|
-
break;
|
|
11957
|
-
default:
|
|
11958
|
-
Debug.never(sourceFile);
|
|
11959
|
-
}
|
|
11960
|
-
if (sourceFileEdit !== void 0) {
|
|
11961
|
-
sourceFileEdits.push(sourceFileEdit);
|
|
11962
|
-
}
|
|
11963
|
-
}
|
|
11964
|
-
}
|
|
11965
|
-
if (sourceFileEdits.length > 0) {
|
|
11966
|
-
const workspaceEdit = this.convertSourceFileEditsToWorkspaceEdit(sourceFileEdits);
|
|
11967
|
-
yield this.connection.workspace.applyEdit(workspaceEdit);
|
|
11968
|
-
}
|
|
11969
|
-
});
|
|
11970
|
-
}
|
|
11971
11691
|
convertSourceFileEdit(edit) {
|
|
11972
11692
|
const range = this.convertSourceFileRange(edit.sourceFile, edit.range);
|
|
11973
11693
|
const textDocument = ls3.OptionalVersionedTextDocumentIdentifier.create(
|
|
@@ -11980,24 +11700,6 @@ var _LanguageServer = class _LanguageServer {
|
|
|
11980
11700
|
const convertedEdits = edits.map((e) => this.convertSourceFileEdit(e));
|
|
11981
11701
|
return { documentChanges: convertedEdits };
|
|
11982
11702
|
}
|
|
11983
|
-
onGetNodeRange(params, taskController) {
|
|
11984
|
-
return __async(this, null, function* () {
|
|
11985
|
-
const uri = URI.parse(params.uri);
|
|
11986
|
-
const sourceFileContext = yield this.getSourceFileContext(uri, taskController);
|
|
11987
|
-
let result;
|
|
11988
|
-
if (sourceFileContext !== void 0) {
|
|
11989
|
-
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
11990
|
-
if (node !== void 0) {
|
|
11991
|
-
let nodeForRange = node;
|
|
11992
|
-
if (node.kind === 90 /* AssignmentStatement */) {
|
|
11993
|
-
nodeForRange = node.right;
|
|
11994
|
-
}
|
|
11995
|
-
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|
|
11996
|
-
}
|
|
11997
|
-
}
|
|
11998
|
-
return result;
|
|
11999
|
-
});
|
|
12000
|
-
}
|
|
12001
11703
|
onCreateOrUpdateSourceFile(params) {
|
|
12002
11704
|
return __async(this, null, function* () {
|
|
12003
11705
|
const uri = this.convertVscodeUriToUri(URI.parse(params.uri));
|
|
@@ -12588,6 +12290,21 @@ ${e}`);
|
|
|
12588
12290
|
convertVscodeUriToUri(uri) {
|
|
12589
12291
|
return Uri.from(uri.scheme, uri.authority, uri.path);
|
|
12590
12292
|
}
|
|
12293
|
+
getOrCreateMessageHandlerContext() {
|
|
12294
|
+
if (this.messageHandlerContext === void 0) {
|
|
12295
|
+
this.messageHandlerContext = {
|
|
12296
|
+
connection: this.connection,
|
|
12297
|
+
workspace: this.workspace,
|
|
12298
|
+
convertSourceFileEdit: this.convertSourceFileEdit.bind(this),
|
|
12299
|
+
convertSourceFileEditsToWorkspaceEdit: this.convertSourceFileEditsToWorkspaceEdit.bind(this),
|
|
12300
|
+
convertSourceFileRange: this.convertSourceFileRange.bind(this),
|
|
12301
|
+
convertUriToVscodeUri: this.convertUriToVscodeUri.bind(this),
|
|
12302
|
+
convertVscodeUriToUri: this.convertVscodeUriToUri.bind(this),
|
|
12303
|
+
getSourceFileContext: this.getSourceFileContext.bind(this)
|
|
12304
|
+
};
|
|
12305
|
+
}
|
|
12306
|
+
return this.messageHandlerContext;
|
|
12307
|
+
}
|
|
12591
12308
|
createCancellationToken(cancellationToken) {
|
|
12592
12309
|
if (!this.enableRequestCancellation) {
|
|
12593
12310
|
return new StubCancellationToken();
|
|
@@ -12596,9 +12313,10 @@ ${e}`);
|
|
|
12596
12313
|
}
|
|
12597
12314
|
withTaskController(token, handler) {
|
|
12598
12315
|
return __async(this, null, function* () {
|
|
12316
|
+
const cancellationToken = token !== void 0 ? this.createCancellationToken(token) : void 0;
|
|
12599
12317
|
const taskController = new TaskController(
|
|
12600
12318
|
_LanguageServer.DefaultCancellationTokenThrottleTime,
|
|
12601
|
-
|
|
12319
|
+
cancellationToken
|
|
12602
12320
|
);
|
|
12603
12321
|
try {
|
|
12604
12322
|
return yield handler(taskController);
|
|
@@ -12663,5 +12381,16 @@ export {
|
|
|
12663
12381
|
ClientCancellationToken,
|
|
12664
12382
|
FileSystemSynchronizationMode,
|
|
12665
12383
|
LanguageServer,
|
|
12666
|
-
|
|
12384
|
+
NodeLocation,
|
|
12385
|
+
Range,
|
|
12386
|
+
SourceFileContext,
|
|
12387
|
+
SourceFileEdit,
|
|
12388
|
+
SourceLocation,
|
|
12389
|
+
TaskController,
|
|
12390
|
+
Uri,
|
|
12391
|
+
UrisRelativityKind,
|
|
12392
|
+
Workspace,
|
|
12393
|
+
customRequests,
|
|
12394
|
+
isCodeActionData,
|
|
12395
|
+
isCompletionItemData
|
|
12667
12396
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Compiler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HOPCXROF.js";
|
|
4
4
|
import {
|
|
5
5
|
ArtelVersion,
|
|
6
6
|
Cached,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
__async,
|
|
17
17
|
performanceMeasurementStageNames,
|
|
18
18
|
performanceMeasurementStages
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IJGHVDYP.js";
|
|
20
20
|
|
|
21
21
|
// source/executor/FileSystemUri.ts
|
|
22
22
|
import { platform } from "os";
|