monaco-editor11 1.0.9 → 1.1.1
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/dist/index.d.ts +1 -1
- package/dist/monaco-editor11.es.js +12 -16
- package/dist/monaco-editor11.umd.js +1 -1
- package/package.json +2 -2
- package/dist/monaco.d.ts +0 -8
- package/dist/workers/common/initialize.js +0 -16
- package/dist/workers/common/workers.js +0 -141
- package/dist/workers/editor/common/abstractSyntaxTokenBackend.js +0 -128
- package/dist/workers/editor/common/abstractText.js +0 -89
- package/dist/workers/editor/common/ast.js +0 -485
- package/dist/workers/editor/common/autoIndent.js +0 -390
- package/dist/workers/editor/common/beforeEditPositionMapper.js +0 -110
- package/dist/workers/editor/common/bracketPairsImpl.js +0 -717
- package/dist/workers/editor/common/bracketPairsTree.js +0 -343
- package/dist/workers/editor/common/brackets.js +0 -108
- package/dist/workers/editor/common/characterClassifier.js +0 -59
- package/dist/workers/editor/common/characterPair.js +0 -40
- package/dist/workers/editor/common/colorizedBracketPairsDecorationProvider.js +0 -97
- package/dist/workers/editor/common/columnRange.js +0 -35
- package/dist/workers/editor/common/combineTextEditInfos.js +0 -124
- package/dist/workers/editor/common/common.js +0 -20
- package/dist/workers/editor/common/computeMovedLines.js +0 -249
- package/dist/workers/editor/common/concat23Trees.js +0 -192
- package/dist/workers/editor/common/contiguousMultilineTokens.js +0 -32
- package/dist/workers/editor/common/contiguousMultilineTokensBuilder.js +0 -23
- package/dist/workers/editor/common/contiguousTokensEditing.js +0 -128
- package/dist/workers/editor/common/contiguousTokensStore.js +0 -207
- package/dist/workers/editor/common/coordinatesConverter.js +0 -51
- package/dist/workers/editor/common/cursor.js +0 -899
- package/dist/workers/editor/common/cursorAtomicMoveOperations.js +0 -145
- package/dist/workers/editor/common/cursorCollection.js +0 -194
- package/dist/workers/editor/common/cursorColumnSelection.js +0 -93
- package/dist/workers/editor/common/cursorColumns.js +0 -112
- package/dist/workers/editor/common/cursorCommon.js +0 -250
- package/dist/workers/editor/common/cursorContext.js +0 -15
- package/dist/workers/editor/common/cursorDeleteOperations.js +0 -231
- package/dist/workers/editor/common/cursorMoveCommands.js +0 -676
- package/dist/workers/editor/common/cursorMoveOperations.js +0 -290
- package/dist/workers/editor/common/cursorTypeEditOperations.js +0 -968
- package/dist/workers/editor/common/cursorTypeOperations.js +0 -173
- package/dist/workers/editor/common/cursorUtils.js +0 -75
- package/dist/workers/editor/common/cursorWordOperations.js +0 -720
- package/dist/workers/editor/common/defaultDocumentColorsComputer.js +0 -138
- package/dist/workers/editor/common/defaultLinesDiffComputer.js +0 -188
- package/dist/workers/editor/common/diffAlgorithm.js +0 -139
- package/dist/workers/editor/common/diffEditor.js +0 -38
- package/dist/workers/editor/common/dynamicProgrammingDiffing.js +0 -101
- package/dist/workers/editor/common/edit.js +0 -183
- package/dist/workers/editor/common/editOperation.js +0 -36
- package/dist/workers/editor/common/editStack.js +0 -363
- package/dist/workers/editor/common/editorAction.js +0 -26
- package/dist/workers/editor/common/editorBaseApi.js +0 -43
- package/dist/workers/editor/common/editorColorRegistry.js +0 -102
- package/dist/workers/editor/common/editorCommon.js +0 -13
- package/dist/workers/editor/common/editorConfigurationSchema.js +0 -338
- package/dist/workers/editor/common/editorContextKeys.js +0 -84
- package/dist/workers/editor/common/editorFeatures.js +0 -17
- package/dist/workers/editor/common/editorOptions.js +0 -3440
- package/dist/workers/editor/common/editorTheme.js +0 -23
- package/dist/workers/editor/common/editorWebWorker.js +0 -299
- package/dist/workers/editor/common/editorWorker.js +0 -9
- package/dist/workers/editor/common/editorWorkerHost.js +0 -15
- package/dist/workers/editor/common/editorZoom.js +0 -26
- package/dist/workers/editor/common/electricCharacter.js +0 -55
- package/dist/workers/editor/common/encodedTokenAttributes.js +0 -79
- package/dist/workers/editor/common/enterAction.js +0 -53
- package/dist/workers/editor/common/eolCounter.js +0 -44
- package/dist/workers/editor/common/findSectionHeaders.js +0 -128
- package/dist/workers/editor/common/fixBrackets.js +0 -67
- package/dist/workers/editor/common/fixedArray.js +0 -70
- package/dist/workers/editor/common/fontInfo.js +0 -172
- package/dist/workers/editor/common/fontInfoFromSettings.js +0 -29
- package/dist/workers/editor/common/getIconClasses.js +0 -106
- package/dist/workers/editor/common/getPositionOffsetTransformerFromTextModel.js +0 -24
- package/dist/workers/editor/common/glyphLanesModel.js +0 -61
- package/dist/workers/editor/common/guidesTextModelPart.js +0 -405
- package/dist/workers/editor/common/heuristicSequenceOptimizations.js +0 -374
- package/dist/workers/editor/common/indentRules.js +0 -63
- package/dist/workers/editor/common/indentation.js +0 -39
- package/dist/workers/editor/common/indentationGuesser.js +0 -178
- package/dist/workers/editor/common/indentationLineProcessor.js +0 -193
- package/dist/workers/editor/common/inlineDecorations.js +0 -26
- package/dist/workers/editor/common/inplaceReplaceSupport.js +0 -87
- package/dist/workers/editor/common/inputMode.js +0 -22
- package/dist/workers/editor/common/intervalTree.js +0 -1002
- package/dist/workers/editor/common/language.js +0 -9
- package/dist/workers/editor/common/languageBracketsConfiguration.js +0 -133
- package/dist/workers/editor/common/languageConfiguration.js +0 -138
- package/dist/workers/editor/common/languageConfigurationRegistry.js +0 -361
- package/dist/workers/editor/common/languageFeatureDebounce.js +0 -137
- package/dist/workers/editor/common/languageFeatureRegistry.js +0 -180
- package/dist/workers/editor/common/languageFeatures.js +0 -9
- package/dist/workers/editor/common/languageFeaturesService.js +0 -47
- package/dist/workers/editor/common/languageSelector.js +0 -112
- package/dist/workers/editor/common/languageService.js +0 -92
- package/dist/workers/editor/common/languages.js +0 -522
- package/dist/workers/editor/common/languagesAssociations.js +0 -193
- package/dist/workers/editor/common/languagesRegistry.js +0 -237
- package/dist/workers/editor/common/legacyLinesDiffComputer.js +0 -468
- package/dist/workers/editor/common/length.js +0 -129
- package/dist/workers/editor/common/lineDecorations.js +0 -208
- package/dist/workers/editor/common/lineEdit.js +0 -75
- package/dist/workers/editor/common/lineHeights.js +0 -370
- package/dist/workers/editor/common/linePart.js +0 -25
- package/dist/workers/editor/common/lineRange.js +0 -312
- package/dist/workers/editor/common/lineSequence.js +0 -36
- package/dist/workers/editor/common/lineTokens.js +0 -405
- package/dist/workers/editor/common/linesDiffComputer.js +0 -29
- package/dist/workers/editor/common/linesDiffComputers.js +0 -13
- package/dist/workers/editor/common/linesLayout.js +0 -765
- package/dist/workers/editor/common/linesSliceCharSequence.js +0 -205
- package/dist/workers/editor/common/linkComputer.js +0 -269
- package/dist/workers/editor/common/markerDecorations.js +0 -9
- package/dist/workers/editor/common/markerDecorationsService.js +0 -248
- package/dist/workers/editor/common/minimapTokensColorTracker.js +0 -58
- package/dist/workers/editor/common/mirrorTextModel.js +0 -117
- package/dist/workers/editor/common/model.js +0 -9
- package/dist/workers/editor/common/modelLineProjection.js +0 -350
- package/dist/workers/editor/common/modelLineProjectionData.js +0 -297
- package/dist/workers/editor/common/modelService.js +0 -413
- package/dist/workers/editor/common/modesRegistry.js +0 -75
- package/dist/workers/editor/common/monospaceLineBreaksComputer.js +0 -473
- package/dist/workers/editor/common/myersDiffAlgorithm.js +0 -159
- package/dist/workers/editor/common/nodeReader.js +0 -127
- package/dist/workers/editor/common/nullTokenize.js +0 -29
- package/dist/workers/editor/common/offsetRange.js +0 -225
- package/dist/workers/editor/common/onEnter.js +0 -109
- package/dist/workers/editor/common/oneCursor.js +0 -117
- package/dist/workers/editor/common/overviewZoneManager.js +0 -176
- package/dist/workers/editor/common/parser.js +0 -121
- package/dist/workers/editor/common/pieceTreeBase.js +0 -1473
- package/dist/workers/editor/common/pieceTreeTextBuffer.js +0 -461
- package/dist/workers/editor/common/pieceTreeTextBufferBuilder.js +0 -140
- package/dist/workers/editor/common/point.js +0 -50
- package/dist/workers/editor/common/position.js +0 -142
- package/dist/workers/editor/common/positionToOffset.js +0 -17
- package/dist/workers/editor/common/positionToOffsetImpl.js +0 -98
- package/dist/workers/editor/common/prefixSumComputer.js +0 -226
- package/dist/workers/editor/common/range.js +0 -421
- package/dist/workers/editor/common/rangeMapping.js +0 -229
- package/dist/workers/editor/common/rangeSingleLine.js +0 -17
- package/dist/workers/editor/common/rbTreeBase.js +0 -362
- package/dist/workers/editor/common/rect.js +0 -163
- package/dist/workers/editor/common/replaceCommand.js +0 -158
- package/dist/workers/editor/common/resolverService.js +0 -5
- package/dist/workers/editor/common/rgba.js +0 -35
- package/dist/workers/editor/common/richEditBrackets.js +0 -356
- package/dist/workers/editor/common/selection.js +0 -145
- package/dist/workers/editor/common/semanticTokensDto.js +0 -82
- package/dist/workers/editor/common/semanticTokensProviderStyling.js +0 -263
- package/dist/workers/editor/common/semanticTokensStyling.js +0 -9
- package/dist/workers/editor/common/semanticTokensStylingService.js +0 -47
- package/dist/workers/editor/common/shiftCommand.js +0 -241
- package/dist/workers/editor/common/smallImmutableSet.js +0 -108
- package/dist/workers/editor/common/sparseMultilineTokens.js +0 -548
- package/dist/workers/editor/common/sparseTokensStore.js +0 -210
- package/dist/workers/editor/common/standaloneEnums.js +0 -1017
- package/dist/workers/editor/common/standaloneStrings.js +0 -42
- package/dist/workers/editor/common/stringBuilder.js +0 -122
- package/dist/workers/editor/common/stringEdit.js +0 -165
- package/dist/workers/editor/common/supports.js +0 -58
- package/dist/workers/editor/common/surroundSelectionCommand.js +0 -44
- package/dist/workers/editor/common/textChange.js +0 -248
- package/dist/workers/editor/common/textEdit.js +0 -269
- package/dist/workers/editor/common/textLength.js +0 -87
- package/dist/workers/editor/common/textModel.js +0 -2031
- package/dist/workers/editor/common/textModelBracketPairs.js +0 -45
- package/dist/workers/editor/common/textModelDefaults.js +0 -18
- package/dist/workers/editor/common/textModelEditSource.js +0 -166
- package/dist/workers/editor/common/textModelEvents.js +0 -216
- package/dist/workers/editor/common/textModelGuides.js +0 -40
- package/dist/workers/editor/common/textModelPart.js +0 -23
- package/dist/workers/editor/common/textModelSearch.js +0 -455
- package/dist/workers/editor/common/textModelStringEdit.js +0 -11
- package/dist/workers/editor/common/textModelSync.impl.js +0 -307
- package/dist/workers/editor/common/textModelText.js +0 -26
- package/dist/workers/editor/common/textModelTokens.js +0 -436
- package/dist/workers/editor/common/textResourceConfiguration.js +0 -6
- package/dist/workers/editor/common/textToHtmlTokenizer.js +0 -139
- package/dist/workers/editor/common/tokenStore.js +0 -407
- package/dist/workers/editor/common/tokenWithTextArray.js +0 -73
- package/dist/workers/editor/common/tokenization.js +0 -287
- package/dist/workers/editor/common/tokenizationRegistry.js +0 -123
- package/dist/workers/editor/common/tokenizationTextModelPart.js +0 -275
- package/dist/workers/editor/common/tokenizer.js +0 -301
- package/dist/workers/editor/common/tokenizerSyntaxTokenBackend.js +0 -261
- package/dist/workers/editor/common/treeSitterLibraryService.js +0 -9
- package/dist/workers/editor/common/treeSitterSyntaxTokenBackend.js +0 -167
- package/dist/workers/editor/common/treeSitterThemeService.js +0 -9
- package/dist/workers/editor/common/treeSitterTokenizationImpl.js +0 -713
- package/dist/workers/editor/common/treeSitterTree.js +0 -395
- package/dist/workers/editor/common/treeViewsDnd.js +0 -24
- package/dist/workers/editor/common/treeViewsDndService.js +0 -12
- package/dist/workers/editor/common/trimTrailingWhitespaceCommand.js +0 -98
- package/dist/workers/editor/common/unicodeTextModelHighlighter.js +0 -188
- package/dist/workers/editor/common/utils.js +0 -62
- package/dist/workers/editor/common/viewContext.js +0 -22
- package/dist/workers/editor/common/viewEventHandler.js +0 -186
- package/dist/workers/editor/common/viewEvents.js +0 -180
- package/dist/workers/editor/common/viewLayout.js +0 -368
- package/dist/workers/editor/common/viewLineRenderer.js +0 -948
- package/dist/workers/editor/common/viewLinesViewportData.js +0 -30
- package/dist/workers/editor/common/viewModel.js +0 -98
- package/dist/workers/editor/common/viewModelDecoration.js +0 -55
- package/dist/workers/editor/common/viewModelDecorations.js +0 -132
- package/dist/workers/editor/common/viewModelEventDispatcher.js +0 -398
- package/dist/workers/editor/common/viewModelImpl.js +0 -1163
- package/dist/workers/editor/common/viewModelLines.js +0 -938
- package/dist/workers/editor/common/wordCharacterClassifier.js +0 -87
- package/dist/workers/editor/common/wordHelper.js +0 -127
- package/dist/workers/language/cssMode.js +0 -198
- package/dist/workers/language/cssWorker.js +0 -183
- package/dist/workers/language/htmlMode.js +0 -213
- package/dist/workers/language/htmlWorker.js +0 -126
- package/dist/workers/language/jsonMode.js +0 -224
- package/dist/workers/language/jsonWorker.js +0 -187
- package/dist/workers/language/languageFeatures.js +0 -1009
- package/dist/workers/language/lib.index.js +0 -103
- package/dist/workers/language/lib.js +0 -1107
- package/dist/workers/language/lspLanguageFeatures.js +0 -716
- package/dist/workers/language/monaco.contribution.js +0 -144
- package/dist/workers/language/tokenization.js +0 -189
- package/dist/workers/language/tsMode.js +0 -212
- package/dist/workers/language/tsWorker.js +0 -352
- package/dist/workers/language/typescriptServices.js +0 -210154
- package/dist/workers/language/typescriptServicesMetadata.js +0 -3
- package/dist/workers/language/workerManager.js +0 -65
- /package/dist/workers/{language/css.worker.js → css.worker.js} +0 -0
- /package/dist/workers/{editor/editor.worker.js → editor.worker.js} +0 -0
- /package/dist/workers/{language/html.worker.js → html.worker.js} +0 -0
- /package/dist/workers/{language/json.worker.js → json.worker.js} +0 -0
- /package/dist/workers/{language/ts.worker.js → ts.worker.js} +0 -0
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import * as typescriptServices from './lib/typescriptServices.js';
|
|
2
|
-
import { typescript, createLanguageService, ScriptKind } from './lib/typescriptServices.js';
|
|
3
|
-
import { libFileMap } from './lib/lib.js';
|
|
4
|
-
|
|
5
|
-
function fileNameIsLib(resource) {
|
|
6
|
-
if (typeof resource === "string") {
|
|
7
|
-
if (/^file:\/\/\//.test(resource)) {
|
|
8
|
-
return !!libFileMap[resource.substr(8)];
|
|
9
|
-
}
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (resource.path.indexOf("/lib.") === 0) {
|
|
13
|
-
return !!libFileMap[resource.path.slice(1)];
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
class TypeScriptWorker {
|
|
18
|
-
constructor(ctx, createData) {
|
|
19
|
-
this._extraLibs = /* @__PURE__ */ Object.create(null);
|
|
20
|
-
this._languageService = createLanguageService(this);
|
|
21
|
-
this._ctx = ctx;
|
|
22
|
-
this._compilerOptions = createData.compilerOptions;
|
|
23
|
-
this._extraLibs = createData.extraLibs;
|
|
24
|
-
this._inlayHintsOptions = createData.inlayHintsOptions;
|
|
25
|
-
}
|
|
26
|
-
// --- language service host ---------------
|
|
27
|
-
getCompilationSettings() {
|
|
28
|
-
return this._compilerOptions;
|
|
29
|
-
}
|
|
30
|
-
getLanguageService() {
|
|
31
|
-
return this._languageService;
|
|
32
|
-
}
|
|
33
|
-
getExtraLibs() {
|
|
34
|
-
return this._extraLibs;
|
|
35
|
-
}
|
|
36
|
-
getScriptFileNames() {
|
|
37
|
-
const allModels = this._ctx.getMirrorModels().map((model) => model.uri);
|
|
38
|
-
const models = allModels.filter((uri) => !fileNameIsLib(uri)).map((uri) => uri.toString());
|
|
39
|
-
return models.concat(Object.keys(this._extraLibs));
|
|
40
|
-
}
|
|
41
|
-
_getModel(fileName) {
|
|
42
|
-
let models = this._ctx.getMirrorModels();
|
|
43
|
-
for (let i = 0; i < models.length; i++) {
|
|
44
|
-
const uri = models[i].uri;
|
|
45
|
-
if (uri.toString() === fileName || uri.toString(true) === fileName) {
|
|
46
|
-
return models[i];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
getScriptVersion(fileName) {
|
|
52
|
-
let model = this._getModel(fileName);
|
|
53
|
-
if (model) {
|
|
54
|
-
return model.version.toString();
|
|
55
|
-
} else if (this.isDefaultLibFileName(fileName)) {
|
|
56
|
-
return "1";
|
|
57
|
-
} else if (fileName in this._extraLibs) {
|
|
58
|
-
return String(this._extraLibs[fileName].version);
|
|
59
|
-
}
|
|
60
|
-
return "";
|
|
61
|
-
}
|
|
62
|
-
async getScriptText(fileName) {
|
|
63
|
-
return this._getScriptText(fileName);
|
|
64
|
-
}
|
|
65
|
-
_getScriptText(fileName) {
|
|
66
|
-
let text;
|
|
67
|
-
let model = this._getModel(fileName);
|
|
68
|
-
const libizedFileName = "lib." + fileName + ".d.ts";
|
|
69
|
-
if (model) {
|
|
70
|
-
text = model.getValue();
|
|
71
|
-
} else if (fileName in libFileMap) {
|
|
72
|
-
text = libFileMap[fileName];
|
|
73
|
-
} else if (libizedFileName in libFileMap) {
|
|
74
|
-
text = libFileMap[libizedFileName];
|
|
75
|
-
} else if (fileName in this._extraLibs) {
|
|
76
|
-
text = this._extraLibs[fileName].content;
|
|
77
|
-
} else {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
return text;
|
|
81
|
-
}
|
|
82
|
-
getScriptSnapshot(fileName) {
|
|
83
|
-
const text = this._getScriptText(fileName);
|
|
84
|
-
if (text === void 0) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
getText: (start, end) => text.substring(start, end),
|
|
89
|
-
getLength: () => text.length,
|
|
90
|
-
getChangeRange: () => void 0
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
getScriptKind(fileName) {
|
|
94
|
-
const suffix = fileName.substr(fileName.lastIndexOf(".") + 1);
|
|
95
|
-
switch (suffix) {
|
|
96
|
-
case "ts":
|
|
97
|
-
return ScriptKind.TS;
|
|
98
|
-
case "tsx":
|
|
99
|
-
return ScriptKind.TSX;
|
|
100
|
-
case "js":
|
|
101
|
-
return ScriptKind.JS;
|
|
102
|
-
case "jsx":
|
|
103
|
-
return ScriptKind.JSX;
|
|
104
|
-
default:
|
|
105
|
-
return this.getCompilationSettings().allowJs ? ScriptKind.JS : ScriptKind.TS;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
getCurrentDirectory() {
|
|
109
|
-
return "";
|
|
110
|
-
}
|
|
111
|
-
getDefaultLibFileName(options) {
|
|
112
|
-
switch (options.target) {
|
|
113
|
-
case 99:
|
|
114
|
-
const esnext = "lib.esnext.full.d.ts";
|
|
115
|
-
if (esnext in libFileMap || esnext in this._extraLibs) return esnext;
|
|
116
|
-
case 7:
|
|
117
|
-
case 6:
|
|
118
|
-
case 5:
|
|
119
|
-
case 4:
|
|
120
|
-
case 3:
|
|
121
|
-
case 2:
|
|
122
|
-
default:
|
|
123
|
-
const eslib = `lib.es${2013 + (options.target || 99)}.full.d.ts`;
|
|
124
|
-
if (eslib in libFileMap || eslib in this._extraLibs) {
|
|
125
|
-
return eslib;
|
|
126
|
-
}
|
|
127
|
-
return "lib.es6.d.ts";
|
|
128
|
-
// We don't use lib.es2015.full.d.ts due to breaking change.
|
|
129
|
-
case 1:
|
|
130
|
-
case 0:
|
|
131
|
-
return "lib.d.ts";
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
isDefaultLibFileName(fileName) {
|
|
135
|
-
return fileName === this.getDefaultLibFileName(this._compilerOptions);
|
|
136
|
-
}
|
|
137
|
-
readFile(path) {
|
|
138
|
-
return this._getScriptText(path);
|
|
139
|
-
}
|
|
140
|
-
fileExists(path) {
|
|
141
|
-
return this._getScriptText(path) !== void 0;
|
|
142
|
-
}
|
|
143
|
-
async getLibFiles() {
|
|
144
|
-
return libFileMap;
|
|
145
|
-
}
|
|
146
|
-
// --- language features
|
|
147
|
-
static clearFiles(tsDiagnostics) {
|
|
148
|
-
const diagnostics = [];
|
|
149
|
-
for (const tsDiagnostic of tsDiagnostics) {
|
|
150
|
-
const diagnostic = { ...tsDiagnostic };
|
|
151
|
-
diagnostic.file = diagnostic.file ? { fileName: diagnostic.file.fileName } : void 0;
|
|
152
|
-
if (tsDiagnostic.relatedInformation) {
|
|
153
|
-
diagnostic.relatedInformation = [];
|
|
154
|
-
for (const tsRelatedDiagnostic of tsDiagnostic.relatedInformation) {
|
|
155
|
-
const relatedDiagnostic = { ...tsRelatedDiagnostic };
|
|
156
|
-
relatedDiagnostic.file = relatedDiagnostic.file ? { fileName: relatedDiagnostic.file.fileName } : void 0;
|
|
157
|
-
diagnostic.relatedInformation.push(relatedDiagnostic);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
diagnostics.push(diagnostic);
|
|
161
|
-
}
|
|
162
|
-
return diagnostics;
|
|
163
|
-
}
|
|
164
|
-
async getSyntacticDiagnostics(fileName) {
|
|
165
|
-
if (fileNameIsLib(fileName)) {
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
const diagnostics = this._languageService.getSyntacticDiagnostics(fileName);
|
|
169
|
-
return TypeScriptWorker.clearFiles(diagnostics);
|
|
170
|
-
}
|
|
171
|
-
async getSemanticDiagnostics(fileName) {
|
|
172
|
-
if (fileNameIsLib(fileName)) {
|
|
173
|
-
return [];
|
|
174
|
-
}
|
|
175
|
-
const diagnostics = this._languageService.getSemanticDiagnostics(fileName);
|
|
176
|
-
return TypeScriptWorker.clearFiles(diagnostics);
|
|
177
|
-
}
|
|
178
|
-
async getSuggestionDiagnostics(fileName) {
|
|
179
|
-
if (fileNameIsLib(fileName)) {
|
|
180
|
-
return [];
|
|
181
|
-
}
|
|
182
|
-
const diagnostics = this._languageService.getSuggestionDiagnostics(fileName);
|
|
183
|
-
return TypeScriptWorker.clearFiles(diagnostics);
|
|
184
|
-
}
|
|
185
|
-
async getCompilerOptionsDiagnostics(fileName) {
|
|
186
|
-
if (fileNameIsLib(fileName)) {
|
|
187
|
-
return [];
|
|
188
|
-
}
|
|
189
|
-
const diagnostics = this._languageService.getCompilerOptionsDiagnostics();
|
|
190
|
-
return TypeScriptWorker.clearFiles(diagnostics);
|
|
191
|
-
}
|
|
192
|
-
async getCompletionsAtPosition(fileName, position) {
|
|
193
|
-
if (fileNameIsLib(fileName)) {
|
|
194
|
-
return void 0;
|
|
195
|
-
}
|
|
196
|
-
return this._languageService.getCompletionsAtPosition(fileName, position, void 0);
|
|
197
|
-
}
|
|
198
|
-
async getCompletionEntryDetails(fileName, position, entry) {
|
|
199
|
-
return this._languageService.getCompletionEntryDetails(
|
|
200
|
-
fileName,
|
|
201
|
-
position,
|
|
202
|
-
entry,
|
|
203
|
-
void 0,
|
|
204
|
-
void 0,
|
|
205
|
-
void 0,
|
|
206
|
-
void 0
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
async getSignatureHelpItems(fileName, position, options) {
|
|
210
|
-
if (fileNameIsLib(fileName)) {
|
|
211
|
-
return void 0;
|
|
212
|
-
}
|
|
213
|
-
return this._languageService.getSignatureHelpItems(fileName, position, options);
|
|
214
|
-
}
|
|
215
|
-
async getQuickInfoAtPosition(fileName, position) {
|
|
216
|
-
if (fileNameIsLib(fileName)) {
|
|
217
|
-
return void 0;
|
|
218
|
-
}
|
|
219
|
-
return this._languageService.getQuickInfoAtPosition(fileName, position);
|
|
220
|
-
}
|
|
221
|
-
async getDocumentHighlights(fileName, position, filesToSearch) {
|
|
222
|
-
if (fileNameIsLib(fileName)) {
|
|
223
|
-
return void 0;
|
|
224
|
-
}
|
|
225
|
-
return this._languageService.getDocumentHighlights(fileName, position, filesToSearch);
|
|
226
|
-
}
|
|
227
|
-
async getDefinitionAtPosition(fileName, position) {
|
|
228
|
-
if (fileNameIsLib(fileName)) {
|
|
229
|
-
return void 0;
|
|
230
|
-
}
|
|
231
|
-
return this._languageService.getDefinitionAtPosition(fileName, position);
|
|
232
|
-
}
|
|
233
|
-
async getReferencesAtPosition(fileName, position) {
|
|
234
|
-
if (fileNameIsLib(fileName)) {
|
|
235
|
-
return void 0;
|
|
236
|
-
}
|
|
237
|
-
return this._languageService.getReferencesAtPosition(fileName, position);
|
|
238
|
-
}
|
|
239
|
-
async getNavigationTree(fileName) {
|
|
240
|
-
if (fileNameIsLib(fileName)) {
|
|
241
|
-
return void 0;
|
|
242
|
-
}
|
|
243
|
-
return this._languageService.getNavigationTree(fileName);
|
|
244
|
-
}
|
|
245
|
-
async getFormattingEditsForDocument(fileName, options) {
|
|
246
|
-
if (fileNameIsLib(fileName)) {
|
|
247
|
-
return [];
|
|
248
|
-
}
|
|
249
|
-
return this._languageService.getFormattingEditsForDocument(fileName, options);
|
|
250
|
-
}
|
|
251
|
-
async getFormattingEditsForRange(fileName, start, end, options) {
|
|
252
|
-
if (fileNameIsLib(fileName)) {
|
|
253
|
-
return [];
|
|
254
|
-
}
|
|
255
|
-
return this._languageService.getFormattingEditsForRange(fileName, start, end, options);
|
|
256
|
-
}
|
|
257
|
-
async getFormattingEditsAfterKeystroke(fileName, postion, ch, options) {
|
|
258
|
-
if (fileNameIsLib(fileName)) {
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
return this._languageService.getFormattingEditsAfterKeystroke(fileName, postion, ch, options);
|
|
262
|
-
}
|
|
263
|
-
async findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) {
|
|
264
|
-
if (fileNameIsLib(fileName)) {
|
|
265
|
-
return void 0;
|
|
266
|
-
}
|
|
267
|
-
return this._languageService.findRenameLocations(
|
|
268
|
-
fileName,
|
|
269
|
-
position,
|
|
270
|
-
findInStrings,
|
|
271
|
-
findInComments,
|
|
272
|
-
providePrefixAndSuffixTextForRename
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
async getRenameInfo(fileName, position, options) {
|
|
276
|
-
if (fileNameIsLib(fileName)) {
|
|
277
|
-
return { canRename: false, localizedErrorMessage: "Cannot rename in lib file" };
|
|
278
|
-
}
|
|
279
|
-
return this._languageService.getRenameInfo(fileName, position, options);
|
|
280
|
-
}
|
|
281
|
-
async getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) {
|
|
282
|
-
if (fileNameIsLib(fileName)) {
|
|
283
|
-
return { outputFiles: [], emitSkipped: true };
|
|
284
|
-
}
|
|
285
|
-
const emitOutput = this._languageService.getEmitOutput(
|
|
286
|
-
fileName,
|
|
287
|
-
emitOnlyDtsFiles,
|
|
288
|
-
forceDtsEmit
|
|
289
|
-
);
|
|
290
|
-
const diagnostics = emitOutput.diagnostics ? TypeScriptWorker.clearFiles(emitOutput.diagnostics) : void 0;
|
|
291
|
-
return { ...emitOutput, diagnostics };
|
|
292
|
-
}
|
|
293
|
-
async getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) {
|
|
294
|
-
if (fileNameIsLib(fileName)) {
|
|
295
|
-
return [];
|
|
296
|
-
}
|
|
297
|
-
const preferences = {};
|
|
298
|
-
try {
|
|
299
|
-
return this._languageService.getCodeFixesAtPosition(
|
|
300
|
-
fileName,
|
|
301
|
-
start,
|
|
302
|
-
end,
|
|
303
|
-
errorCodes,
|
|
304
|
-
formatOptions,
|
|
305
|
-
preferences
|
|
306
|
-
);
|
|
307
|
-
} catch {
|
|
308
|
-
return [];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
async updateExtraLibs(extraLibs) {
|
|
312
|
-
this._extraLibs = extraLibs;
|
|
313
|
-
}
|
|
314
|
-
async provideInlayHints(fileName, start, end) {
|
|
315
|
-
if (fileNameIsLib(fileName)) {
|
|
316
|
-
return [];
|
|
317
|
-
}
|
|
318
|
-
const preferences = this._inlayHintsOptions ?? {};
|
|
319
|
-
const span = {
|
|
320
|
-
start,
|
|
321
|
-
length: end - start
|
|
322
|
-
};
|
|
323
|
-
try {
|
|
324
|
-
return this._languageService.provideInlayHints(fileName, span, preferences);
|
|
325
|
-
} catch {
|
|
326
|
-
return [];
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function create(ctx, createData) {
|
|
331
|
-
let TSWorkerClass = TypeScriptWorker;
|
|
332
|
-
if (createData.customWorkerPath) {
|
|
333
|
-
if (typeof importScripts === "undefined") {
|
|
334
|
-
console.warn(
|
|
335
|
-
"Monaco is not using webworkers for background tasks, and that is needed to support the customWorkerPath flag"
|
|
336
|
-
);
|
|
337
|
-
} else {
|
|
338
|
-
self.importScripts(createData.customWorkerPath);
|
|
339
|
-
const workerFactoryFunc = self.customTSWorkerFactory;
|
|
340
|
-
if (!workerFactoryFunc) {
|
|
341
|
-
throw new Error(
|
|
342
|
-
`The script at ${createData.customWorkerPath} does not add customTSWorkerFactory to self`
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
TSWorkerClass = workerFactoryFunc(TypeScriptWorker, typescriptServices, libFileMap);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return new TSWorkerClass(ctx, createData);
|
|
349
|
-
}
|
|
350
|
-
globalThis.ts = typescript;
|
|
351
|
-
|
|
352
|
-
export { TypeScriptWorker, create };
|