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,716 +0,0 @@
|
|
|
1
|
-
import { InsertTextFormat, CompletionItemKind, DocumentHighlightKind, SymbolKind, FoldingRangeKind, DiagnosticSeverity } from '../../../external/vscode-languageserver-types/lib/esm/main.js';
|
|
2
|
-
import '../../editor/browser/coreCommands.js';
|
|
3
|
-
import '../../editor/browser/widget/codeEditor/codeEditorWidget.js';
|
|
4
|
-
import '../../editor/browser/widget/diffEditor/diffEditor.contribution.js';
|
|
5
|
-
import '../../editor/contrib/anchorSelect/browser/anchorSelect.js';
|
|
6
|
-
import '../../editor/contrib/bracketMatching/browser/bracketMatching.js';
|
|
7
|
-
import '../../editor/contrib/caretOperations/browser/caretOperations.js';
|
|
8
|
-
import '../../editor/contrib/caretOperations/browser/transpose.js';
|
|
9
|
-
import '../../editor/contrib/clipboard/browser/clipboard.js';
|
|
10
|
-
import '../../editor/contrib/codeAction/browser/codeActionContributions.js';
|
|
11
|
-
import '../../editor/contrib/codelens/browser/codelensController.js';
|
|
12
|
-
import '../../editor/contrib/colorPicker/browser/colorPickerContribution.js';
|
|
13
|
-
import '../../editor/contrib/comment/browser/comment.js';
|
|
14
|
-
import '../../editor/contrib/contextmenu/browser/contextmenu.js';
|
|
15
|
-
import '../../editor/contrib/cursorUndo/browser/cursorUndo.js';
|
|
16
|
-
import '../../editor/contrib/dnd/browser/dnd.js';
|
|
17
|
-
import '../../editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js';
|
|
18
|
-
import '../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js';
|
|
19
|
-
import '../../editor/contrib/find/browser/findController.js';
|
|
20
|
-
import '../../editor/contrib/folding/browser/folding.js';
|
|
21
|
-
import '../../editor/contrib/fontZoom/browser/fontZoom.js';
|
|
22
|
-
import '../../editor/contrib/format/browser/formatActions.js';
|
|
23
|
-
import '../../editor/contrib/documentSymbols/browser/documentSymbols.js';
|
|
24
|
-
import '../../editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
|
|
25
|
-
import '../../editor/contrib/inlineProgress/browser/inlineProgress.js';
|
|
26
|
-
import '../../editor/contrib/gotoSymbol/browser/goToCommands.js';
|
|
27
|
-
import '../../editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js';
|
|
28
|
-
import '../../editor/contrib/gotoError/browser/gotoError.js';
|
|
29
|
-
import '../../editor/contrib/gpu/browser/gpuActions.js';
|
|
30
|
-
import '../../editor/contrib/hover/browser/hoverContribution.js';
|
|
31
|
-
import '../../editor/contrib/indentation/browser/indentation.js';
|
|
32
|
-
import '../../editor/contrib/inlayHints/browser/inlayHintsContribution.js';
|
|
33
|
-
import '../../editor/contrib/inPlaceReplace/browser/inPlaceReplace.js';
|
|
34
|
-
import '../../editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js';
|
|
35
|
-
import '../../editor/contrib/lineSelection/browser/lineSelection.js';
|
|
36
|
-
import '../../editor/contrib/linesOperations/browser/linesOperations.js';
|
|
37
|
-
import '../../editor/contrib/linkedEditing/browser/linkedEditing.js';
|
|
38
|
-
import '../../editor/contrib/links/browser/links.js';
|
|
39
|
-
import '../../editor/contrib/longLinesHelper/browser/longLinesHelper.js';
|
|
40
|
-
import '../../editor/contrib/middleScroll/browser/middleScroll.contribution.js';
|
|
41
|
-
import '../../editor/contrib/multicursor/browser/multicursor.js';
|
|
42
|
-
import '../../editor/contrib/parameterHints/browser/parameterHints.js';
|
|
43
|
-
import '../../editor/contrib/placeholderText/browser/placeholderText.contribution.js';
|
|
44
|
-
import '../../editor/contrib/rename/browser/rename.js';
|
|
45
|
-
import '../../editor/contrib/sectionHeaders/browser/sectionHeaders.js';
|
|
46
|
-
import '../../editor/contrib/semanticTokens/browser/documentSemanticTokens.js';
|
|
47
|
-
import '../../editor/contrib/semanticTokens/browser/viewportSemanticTokens.js';
|
|
48
|
-
import '../../editor/contrib/smartSelect/browser/smartSelect.js';
|
|
49
|
-
import '../../editor/contrib/snippet/browser/snippetController2.js';
|
|
50
|
-
import '../../editor/contrib/stickyScroll/browser/stickyScrollContribution.js';
|
|
51
|
-
import '../../editor/contrib/suggest/browser/suggestController.js';
|
|
52
|
-
import '../../editor/contrib/suggest/browser/suggestInlineCompletions.js';
|
|
53
|
-
import '../../editor/contrib/tokenization/browser/tokenization.js';
|
|
54
|
-
import '../../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
|
|
55
|
-
import '../../editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js';
|
|
56
|
-
import '../../editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js';
|
|
57
|
-
import '../../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
|
|
58
|
-
import '../../editor/contrib/wordOperations/browser/wordOperations.js';
|
|
59
|
-
import '../../editor/contrib/wordPartOperations/browser/wordPartOperations.js';
|
|
60
|
-
import '../../editor/contrib/readOnlyMessage/browser/contribution.js';
|
|
61
|
-
import '../../editor/contrib/diffEditorBreadcrumbs/browser/contribution.js';
|
|
62
|
-
import '../../editor/contrib/floatingMenu/browser/floatingMenu.contribution.js';
|
|
63
|
-
import '../../editor/common/standaloneStrings.js';
|
|
64
|
-
import '../../base/browser/ui/codicons/codicon/codicon.css';
|
|
65
|
-
import '../../base/browser/ui/codicons/codicon/codicon-modifiers.css';
|
|
66
|
-
import '../../editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
|
|
67
|
-
import '../../editor/standalone/browser/inspectTokens/inspectTokens.js';
|
|
68
|
-
import '../../editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
|
|
69
|
-
import '../../editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
|
|
70
|
-
import '../../editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
|
|
71
|
-
import '../../editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
|
|
72
|
-
import '../../editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
|
|
73
|
-
import '../../editor/standalone/browser/toggleHighContrast/toggleHighContrast.js';
|
|
74
|
-
import { editor, Range, languages, Uri, MarkerSeverity } from '../../editor/editor.api2.js';
|
|
75
|
-
|
|
76
|
-
class DiagnosticsAdapter {
|
|
77
|
-
constructor(_languageId, _worker, configChangeEvent) {
|
|
78
|
-
this._languageId = _languageId;
|
|
79
|
-
this._worker = _worker;
|
|
80
|
-
this._disposables = [];
|
|
81
|
-
this._listener = /* @__PURE__ */ Object.create(null);
|
|
82
|
-
const onModelAdd = (model) => {
|
|
83
|
-
let modeId = model.getLanguageId();
|
|
84
|
-
if (modeId !== this._languageId) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
let handle;
|
|
88
|
-
this._listener[model.uri.toString()] = model.onDidChangeContent(() => {
|
|
89
|
-
window.clearTimeout(handle);
|
|
90
|
-
handle = window.setTimeout(() => this._doValidate(model.uri, modeId), 500);
|
|
91
|
-
});
|
|
92
|
-
this._doValidate(model.uri, modeId);
|
|
93
|
-
};
|
|
94
|
-
const onModelRemoved = (model) => {
|
|
95
|
-
editor.setModelMarkers(model, this._languageId, []);
|
|
96
|
-
let uriStr = model.uri.toString();
|
|
97
|
-
let listener = this._listener[uriStr];
|
|
98
|
-
if (listener) {
|
|
99
|
-
listener.dispose();
|
|
100
|
-
delete this._listener[uriStr];
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
|
104
|
-
this._disposables.push(editor.onWillDisposeModel(onModelRemoved));
|
|
105
|
-
this._disposables.push(
|
|
106
|
-
editor.onDidChangeModelLanguage((event) => {
|
|
107
|
-
onModelRemoved(event.model);
|
|
108
|
-
onModelAdd(event.model);
|
|
109
|
-
})
|
|
110
|
-
);
|
|
111
|
-
this._disposables.push(
|
|
112
|
-
configChangeEvent((_) => {
|
|
113
|
-
editor.getModels().forEach((model) => {
|
|
114
|
-
if (model.getLanguageId() === this._languageId) {
|
|
115
|
-
onModelRemoved(model);
|
|
116
|
-
onModelAdd(model);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
})
|
|
120
|
-
);
|
|
121
|
-
this._disposables.push({
|
|
122
|
-
dispose: () => {
|
|
123
|
-
editor.getModels().forEach(onModelRemoved);
|
|
124
|
-
for (let key in this._listener) {
|
|
125
|
-
this._listener[key].dispose();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
editor.getModels().forEach(onModelAdd);
|
|
130
|
-
}
|
|
131
|
-
dispose() {
|
|
132
|
-
this._disposables.forEach((d) => d && d.dispose());
|
|
133
|
-
this._disposables.length = 0;
|
|
134
|
-
}
|
|
135
|
-
_doValidate(resource, languageId) {
|
|
136
|
-
this._worker(resource).then((worker) => {
|
|
137
|
-
return worker.doValidation(resource.toString());
|
|
138
|
-
}).then((diagnostics) => {
|
|
139
|
-
const markers = diagnostics.map((d) => toDiagnostics(resource, d));
|
|
140
|
-
let model = editor.getModel(resource);
|
|
141
|
-
if (model && model.getLanguageId() === languageId) {
|
|
142
|
-
editor.setModelMarkers(model, languageId, markers);
|
|
143
|
-
}
|
|
144
|
-
}).then(void 0, (err) => {
|
|
145
|
-
console.error(err);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function toSeverity(lsSeverity) {
|
|
150
|
-
switch (lsSeverity) {
|
|
151
|
-
case DiagnosticSeverity.Error:
|
|
152
|
-
return MarkerSeverity.Error;
|
|
153
|
-
case DiagnosticSeverity.Warning:
|
|
154
|
-
return MarkerSeverity.Warning;
|
|
155
|
-
case DiagnosticSeverity.Information:
|
|
156
|
-
return MarkerSeverity.Info;
|
|
157
|
-
case DiagnosticSeverity.Hint:
|
|
158
|
-
return MarkerSeverity.Hint;
|
|
159
|
-
default:
|
|
160
|
-
return MarkerSeverity.Info;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function toDiagnostics(resource, diag) {
|
|
164
|
-
let code = typeof diag.code === "number" ? String(diag.code) : diag.code;
|
|
165
|
-
return {
|
|
166
|
-
severity: toSeverity(diag.severity),
|
|
167
|
-
startLineNumber: diag.range.start.line + 1,
|
|
168
|
-
startColumn: diag.range.start.character + 1,
|
|
169
|
-
endLineNumber: diag.range.end.line + 1,
|
|
170
|
-
endColumn: diag.range.end.character + 1,
|
|
171
|
-
message: diag.message,
|
|
172
|
-
code,
|
|
173
|
-
source: diag.source
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
class CompletionAdapter {
|
|
177
|
-
constructor(_worker, _triggerCharacters) {
|
|
178
|
-
this._worker = _worker;
|
|
179
|
-
this._triggerCharacters = _triggerCharacters;
|
|
180
|
-
}
|
|
181
|
-
get triggerCharacters() {
|
|
182
|
-
return this._triggerCharacters;
|
|
183
|
-
}
|
|
184
|
-
provideCompletionItems(model, position, context, token) {
|
|
185
|
-
const resource = model.uri;
|
|
186
|
-
return this._worker(resource).then((worker) => {
|
|
187
|
-
return worker.doComplete(resource.toString(), fromPosition(position));
|
|
188
|
-
}).then((info) => {
|
|
189
|
-
if (!info) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const wordInfo = model.getWordUntilPosition(position);
|
|
193
|
-
const wordRange = new Range(
|
|
194
|
-
position.lineNumber,
|
|
195
|
-
wordInfo.startColumn,
|
|
196
|
-
position.lineNumber,
|
|
197
|
-
wordInfo.endColumn
|
|
198
|
-
);
|
|
199
|
-
const items = info.items.map((entry) => {
|
|
200
|
-
const item = {
|
|
201
|
-
label: entry.label,
|
|
202
|
-
insertText: entry.insertText || entry.label,
|
|
203
|
-
sortText: entry.sortText,
|
|
204
|
-
filterText: entry.filterText,
|
|
205
|
-
documentation: entry.documentation,
|
|
206
|
-
detail: entry.detail,
|
|
207
|
-
command: toCommand(entry.command),
|
|
208
|
-
range: wordRange,
|
|
209
|
-
kind: toCompletionItemKind(entry.kind)
|
|
210
|
-
};
|
|
211
|
-
if (entry.textEdit) {
|
|
212
|
-
if (isInsertReplaceEdit(entry.textEdit)) {
|
|
213
|
-
item.range = {
|
|
214
|
-
insert: toRange(entry.textEdit.insert),
|
|
215
|
-
replace: toRange(entry.textEdit.replace)
|
|
216
|
-
};
|
|
217
|
-
} else {
|
|
218
|
-
item.range = toRange(entry.textEdit.range);
|
|
219
|
-
}
|
|
220
|
-
item.insertText = entry.textEdit.newText;
|
|
221
|
-
}
|
|
222
|
-
if (entry.additionalTextEdits) {
|
|
223
|
-
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
|
224
|
-
}
|
|
225
|
-
if (entry.insertTextFormat === InsertTextFormat.Snippet) {
|
|
226
|
-
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
227
|
-
}
|
|
228
|
-
return item;
|
|
229
|
-
});
|
|
230
|
-
return {
|
|
231
|
-
isIncomplete: info.isIncomplete,
|
|
232
|
-
suggestions: items
|
|
233
|
-
};
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function fromPosition(position) {
|
|
238
|
-
if (!position) {
|
|
239
|
-
return void 0;
|
|
240
|
-
}
|
|
241
|
-
return { character: position.column - 1, line: position.lineNumber - 1 };
|
|
242
|
-
}
|
|
243
|
-
function fromRange(range) {
|
|
244
|
-
if (!range) {
|
|
245
|
-
return void 0;
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
start: {
|
|
249
|
-
line: range.startLineNumber - 1,
|
|
250
|
-
character: range.startColumn - 1
|
|
251
|
-
},
|
|
252
|
-
end: { line: range.endLineNumber - 1, character: range.endColumn - 1 }
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function toRange(range) {
|
|
256
|
-
if (!range) {
|
|
257
|
-
return void 0;
|
|
258
|
-
}
|
|
259
|
-
return new Range(
|
|
260
|
-
range.start.line + 1,
|
|
261
|
-
range.start.character + 1,
|
|
262
|
-
range.end.line + 1,
|
|
263
|
-
range.end.character + 1
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
function isInsertReplaceEdit(edit) {
|
|
267
|
-
return typeof edit.insert !== "undefined" && typeof edit.replace !== "undefined";
|
|
268
|
-
}
|
|
269
|
-
function toCompletionItemKind(kind) {
|
|
270
|
-
const mItemKind = languages.CompletionItemKind;
|
|
271
|
-
switch (kind) {
|
|
272
|
-
case CompletionItemKind.Text:
|
|
273
|
-
return mItemKind.Text;
|
|
274
|
-
case CompletionItemKind.Method:
|
|
275
|
-
return mItemKind.Method;
|
|
276
|
-
case CompletionItemKind.Function:
|
|
277
|
-
return mItemKind.Function;
|
|
278
|
-
case CompletionItemKind.Constructor:
|
|
279
|
-
return mItemKind.Constructor;
|
|
280
|
-
case CompletionItemKind.Field:
|
|
281
|
-
return mItemKind.Field;
|
|
282
|
-
case CompletionItemKind.Variable:
|
|
283
|
-
return mItemKind.Variable;
|
|
284
|
-
case CompletionItemKind.Class:
|
|
285
|
-
return mItemKind.Class;
|
|
286
|
-
case CompletionItemKind.Interface:
|
|
287
|
-
return mItemKind.Interface;
|
|
288
|
-
case CompletionItemKind.Module:
|
|
289
|
-
return mItemKind.Module;
|
|
290
|
-
case CompletionItemKind.Property:
|
|
291
|
-
return mItemKind.Property;
|
|
292
|
-
case CompletionItemKind.Unit:
|
|
293
|
-
return mItemKind.Unit;
|
|
294
|
-
case CompletionItemKind.Value:
|
|
295
|
-
return mItemKind.Value;
|
|
296
|
-
case CompletionItemKind.Enum:
|
|
297
|
-
return mItemKind.Enum;
|
|
298
|
-
case CompletionItemKind.Keyword:
|
|
299
|
-
return mItemKind.Keyword;
|
|
300
|
-
case CompletionItemKind.Snippet:
|
|
301
|
-
return mItemKind.Snippet;
|
|
302
|
-
case CompletionItemKind.Color:
|
|
303
|
-
return mItemKind.Color;
|
|
304
|
-
case CompletionItemKind.File:
|
|
305
|
-
return mItemKind.File;
|
|
306
|
-
case CompletionItemKind.Reference:
|
|
307
|
-
return mItemKind.Reference;
|
|
308
|
-
}
|
|
309
|
-
return mItemKind.Property;
|
|
310
|
-
}
|
|
311
|
-
function toTextEdit(textEdit) {
|
|
312
|
-
if (!textEdit) {
|
|
313
|
-
return void 0;
|
|
314
|
-
}
|
|
315
|
-
return {
|
|
316
|
-
range: toRange(textEdit.range),
|
|
317
|
-
text: textEdit.newText
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
function toCommand(c) {
|
|
321
|
-
return c && c.command === "editor.action.triggerSuggest" ? { id: c.command, title: c.title, arguments: c.arguments } : void 0;
|
|
322
|
-
}
|
|
323
|
-
class HoverAdapter {
|
|
324
|
-
constructor(_worker) {
|
|
325
|
-
this._worker = _worker;
|
|
326
|
-
}
|
|
327
|
-
provideHover(model, position, token) {
|
|
328
|
-
let resource = model.uri;
|
|
329
|
-
return this._worker(resource).then((worker) => {
|
|
330
|
-
return worker.doHover(resource.toString(), fromPosition(position));
|
|
331
|
-
}).then((info) => {
|
|
332
|
-
if (!info) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
range: toRange(info.range),
|
|
337
|
-
contents: toMarkedStringArray(info.contents)
|
|
338
|
-
};
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
function isMarkupContent(thing) {
|
|
343
|
-
return thing && typeof thing === "object" && typeof thing.kind === "string";
|
|
344
|
-
}
|
|
345
|
-
function toMarkdownString(entry) {
|
|
346
|
-
if (typeof entry === "string") {
|
|
347
|
-
return {
|
|
348
|
-
value: entry
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
if (isMarkupContent(entry)) {
|
|
352
|
-
if (entry.kind === "plaintext") {
|
|
353
|
-
return {
|
|
354
|
-
value: entry.value.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&")
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
value: entry.value
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
return { value: "```" + entry.language + "\n" + entry.value + "\n```\n" };
|
|
362
|
-
}
|
|
363
|
-
function toMarkedStringArray(contents) {
|
|
364
|
-
if (!contents) {
|
|
365
|
-
return void 0;
|
|
366
|
-
}
|
|
367
|
-
if (Array.isArray(contents)) {
|
|
368
|
-
return contents.map(toMarkdownString);
|
|
369
|
-
}
|
|
370
|
-
return [toMarkdownString(contents)];
|
|
371
|
-
}
|
|
372
|
-
class DocumentHighlightAdapter {
|
|
373
|
-
constructor(_worker) {
|
|
374
|
-
this._worker = _worker;
|
|
375
|
-
}
|
|
376
|
-
provideDocumentHighlights(model, position, token) {
|
|
377
|
-
const resource = model.uri;
|
|
378
|
-
return this._worker(resource).then((worker) => worker.findDocumentHighlights(resource.toString(), fromPosition(position))).then((entries) => {
|
|
379
|
-
if (!entries) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
return entries.map((entry) => {
|
|
383
|
-
return {
|
|
384
|
-
range: toRange(entry.range),
|
|
385
|
-
kind: toDocumentHighlightKind(entry.kind)
|
|
386
|
-
};
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
function toDocumentHighlightKind(kind) {
|
|
392
|
-
switch (kind) {
|
|
393
|
-
case DocumentHighlightKind.Read:
|
|
394
|
-
return languages.DocumentHighlightKind.Read;
|
|
395
|
-
case DocumentHighlightKind.Write:
|
|
396
|
-
return languages.DocumentHighlightKind.Write;
|
|
397
|
-
case DocumentHighlightKind.Text:
|
|
398
|
-
return languages.DocumentHighlightKind.Text;
|
|
399
|
-
}
|
|
400
|
-
return languages.DocumentHighlightKind.Text;
|
|
401
|
-
}
|
|
402
|
-
class DefinitionAdapter {
|
|
403
|
-
constructor(_worker) {
|
|
404
|
-
this._worker = _worker;
|
|
405
|
-
}
|
|
406
|
-
provideDefinition(model, position, token) {
|
|
407
|
-
const resource = model.uri;
|
|
408
|
-
return this._worker(resource).then((worker) => {
|
|
409
|
-
return worker.findDefinition(resource.toString(), fromPosition(position));
|
|
410
|
-
}).then((definition) => {
|
|
411
|
-
if (!definition) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
return [toLocation(definition)];
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function toLocation(location) {
|
|
419
|
-
return {
|
|
420
|
-
uri: Uri.parse(location.uri),
|
|
421
|
-
range: toRange(location.range)
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
class ReferenceAdapter {
|
|
425
|
-
constructor(_worker) {
|
|
426
|
-
this._worker = _worker;
|
|
427
|
-
}
|
|
428
|
-
provideReferences(model, position, context, token) {
|
|
429
|
-
const resource = model.uri;
|
|
430
|
-
return this._worker(resource).then((worker) => {
|
|
431
|
-
return worker.findReferences(resource.toString(), fromPosition(position));
|
|
432
|
-
}).then((entries) => {
|
|
433
|
-
if (!entries) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
return entries.map(toLocation);
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
class RenameAdapter {
|
|
441
|
-
constructor(_worker) {
|
|
442
|
-
this._worker = _worker;
|
|
443
|
-
}
|
|
444
|
-
provideRenameEdits(model, position, newName, token) {
|
|
445
|
-
const resource = model.uri;
|
|
446
|
-
return this._worker(resource).then((worker) => {
|
|
447
|
-
return worker.doRename(resource.toString(), fromPosition(position), newName);
|
|
448
|
-
}).then((edit) => {
|
|
449
|
-
return toWorkspaceEdit(edit);
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
function toWorkspaceEdit(edit) {
|
|
454
|
-
if (!edit || !edit.changes) {
|
|
455
|
-
return void 0;
|
|
456
|
-
}
|
|
457
|
-
let resourceEdits = [];
|
|
458
|
-
for (let uri in edit.changes) {
|
|
459
|
-
const _uri = Uri.parse(uri);
|
|
460
|
-
for (let e of edit.changes[uri]) {
|
|
461
|
-
resourceEdits.push({
|
|
462
|
-
resource: _uri,
|
|
463
|
-
versionId: void 0,
|
|
464
|
-
textEdit: {
|
|
465
|
-
range: toRange(e.range),
|
|
466
|
-
text: e.newText
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
edits: resourceEdits
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
class DocumentSymbolAdapter {
|
|
476
|
-
constructor(_worker) {
|
|
477
|
-
this._worker = _worker;
|
|
478
|
-
}
|
|
479
|
-
provideDocumentSymbols(model, token) {
|
|
480
|
-
const resource = model.uri;
|
|
481
|
-
return this._worker(resource).then((worker) => worker.findDocumentSymbols(resource.toString())).then((items) => {
|
|
482
|
-
if (!items) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
return items.map((item) => {
|
|
486
|
-
if (isDocumentSymbol(item)) {
|
|
487
|
-
return toDocumentSymbol(item);
|
|
488
|
-
}
|
|
489
|
-
return {
|
|
490
|
-
name: item.name,
|
|
491
|
-
detail: "",
|
|
492
|
-
containerName: item.containerName,
|
|
493
|
-
kind: toSymbolKind(item.kind),
|
|
494
|
-
range: toRange(item.location.range),
|
|
495
|
-
selectionRange: toRange(item.location.range),
|
|
496
|
-
tags: []
|
|
497
|
-
};
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function isDocumentSymbol(symbol) {
|
|
503
|
-
return "children" in symbol;
|
|
504
|
-
}
|
|
505
|
-
function toDocumentSymbol(symbol) {
|
|
506
|
-
return {
|
|
507
|
-
name: symbol.name,
|
|
508
|
-
detail: symbol.detail ?? "",
|
|
509
|
-
kind: toSymbolKind(symbol.kind),
|
|
510
|
-
range: toRange(symbol.range),
|
|
511
|
-
selectionRange: toRange(symbol.selectionRange),
|
|
512
|
-
tags: symbol.tags ?? [],
|
|
513
|
-
children: (symbol.children ?? []).map((item) => toDocumentSymbol(item))
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
function toSymbolKind(kind) {
|
|
517
|
-
let mKind = languages.SymbolKind;
|
|
518
|
-
switch (kind) {
|
|
519
|
-
case SymbolKind.File:
|
|
520
|
-
return mKind.File;
|
|
521
|
-
case SymbolKind.Module:
|
|
522
|
-
return mKind.Module;
|
|
523
|
-
case SymbolKind.Namespace:
|
|
524
|
-
return mKind.Namespace;
|
|
525
|
-
case SymbolKind.Package:
|
|
526
|
-
return mKind.Package;
|
|
527
|
-
case SymbolKind.Class:
|
|
528
|
-
return mKind.Class;
|
|
529
|
-
case SymbolKind.Method:
|
|
530
|
-
return mKind.Method;
|
|
531
|
-
case SymbolKind.Property:
|
|
532
|
-
return mKind.Property;
|
|
533
|
-
case SymbolKind.Field:
|
|
534
|
-
return mKind.Field;
|
|
535
|
-
case SymbolKind.Constructor:
|
|
536
|
-
return mKind.Constructor;
|
|
537
|
-
case SymbolKind.Enum:
|
|
538
|
-
return mKind.Enum;
|
|
539
|
-
case SymbolKind.Interface:
|
|
540
|
-
return mKind.Interface;
|
|
541
|
-
case SymbolKind.Function:
|
|
542
|
-
return mKind.Function;
|
|
543
|
-
case SymbolKind.Variable:
|
|
544
|
-
return mKind.Variable;
|
|
545
|
-
case SymbolKind.Constant:
|
|
546
|
-
return mKind.Constant;
|
|
547
|
-
case SymbolKind.String:
|
|
548
|
-
return mKind.String;
|
|
549
|
-
case SymbolKind.Number:
|
|
550
|
-
return mKind.Number;
|
|
551
|
-
case SymbolKind.Boolean:
|
|
552
|
-
return mKind.Boolean;
|
|
553
|
-
case SymbolKind.Array:
|
|
554
|
-
return mKind.Array;
|
|
555
|
-
}
|
|
556
|
-
return mKind.Function;
|
|
557
|
-
}
|
|
558
|
-
class DocumentLinkAdapter {
|
|
559
|
-
constructor(_worker) {
|
|
560
|
-
this._worker = _worker;
|
|
561
|
-
}
|
|
562
|
-
provideLinks(model, token) {
|
|
563
|
-
const resource = model.uri;
|
|
564
|
-
return this._worker(resource).then((worker) => worker.findDocumentLinks(resource.toString())).then((items) => {
|
|
565
|
-
if (!items) {
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
return {
|
|
569
|
-
links: items.map((item) => ({
|
|
570
|
-
range: toRange(item.range),
|
|
571
|
-
url: item.target
|
|
572
|
-
}))
|
|
573
|
-
};
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
class DocumentFormattingEditProvider {
|
|
578
|
-
constructor(_worker) {
|
|
579
|
-
this._worker = _worker;
|
|
580
|
-
}
|
|
581
|
-
provideDocumentFormattingEdits(model, options, token) {
|
|
582
|
-
const resource = model.uri;
|
|
583
|
-
return this._worker(resource).then((worker) => {
|
|
584
|
-
return worker.format(resource.toString(), null, fromFormattingOptions(options)).then((edits) => {
|
|
585
|
-
if (!edits || edits.length === 0) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
return edits.map(toTextEdit);
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
class DocumentRangeFormattingEditProvider {
|
|
594
|
-
constructor(_worker) {
|
|
595
|
-
this._worker = _worker;
|
|
596
|
-
this.canFormatMultipleRanges = false;
|
|
597
|
-
}
|
|
598
|
-
provideDocumentRangeFormattingEdits(model, range, options, token) {
|
|
599
|
-
const resource = model.uri;
|
|
600
|
-
return this._worker(resource).then((worker) => {
|
|
601
|
-
return worker.format(resource.toString(), fromRange(range), fromFormattingOptions(options)).then((edits) => {
|
|
602
|
-
if (!edits || edits.length === 0) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
return edits.map(toTextEdit);
|
|
606
|
-
});
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function fromFormattingOptions(options) {
|
|
611
|
-
return {
|
|
612
|
-
tabSize: options.tabSize,
|
|
613
|
-
insertSpaces: options.insertSpaces
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
class DocumentColorAdapter {
|
|
617
|
-
constructor(_worker) {
|
|
618
|
-
this._worker = _worker;
|
|
619
|
-
}
|
|
620
|
-
provideDocumentColors(model, token) {
|
|
621
|
-
const resource = model.uri;
|
|
622
|
-
return this._worker(resource).then((worker) => worker.findDocumentColors(resource.toString())).then((infos) => {
|
|
623
|
-
if (!infos) {
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
return infos.map((item) => ({
|
|
627
|
-
color: item.color,
|
|
628
|
-
range: toRange(item.range)
|
|
629
|
-
}));
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
provideColorPresentations(model, info, token) {
|
|
633
|
-
const resource = model.uri;
|
|
634
|
-
return this._worker(resource).then(
|
|
635
|
-
(worker) => worker.getColorPresentations(resource.toString(), info.color, fromRange(info.range))
|
|
636
|
-
).then((presentations) => {
|
|
637
|
-
if (!presentations) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
return presentations.map((presentation) => {
|
|
641
|
-
let item = {
|
|
642
|
-
label: presentation.label
|
|
643
|
-
};
|
|
644
|
-
if (presentation.textEdit) {
|
|
645
|
-
item.textEdit = toTextEdit(presentation.textEdit);
|
|
646
|
-
}
|
|
647
|
-
if (presentation.additionalTextEdits) {
|
|
648
|
-
item.additionalTextEdits = presentation.additionalTextEdits.map(toTextEdit);
|
|
649
|
-
}
|
|
650
|
-
return item;
|
|
651
|
-
});
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
class FoldingRangeAdapter {
|
|
656
|
-
constructor(_worker) {
|
|
657
|
-
this._worker = _worker;
|
|
658
|
-
}
|
|
659
|
-
provideFoldingRanges(model, context, token) {
|
|
660
|
-
const resource = model.uri;
|
|
661
|
-
return this._worker(resource).then((worker) => worker.getFoldingRanges(resource.toString(), context)).then((ranges) => {
|
|
662
|
-
if (!ranges) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
return ranges.map((range) => {
|
|
666
|
-
const result = {
|
|
667
|
-
start: range.startLine + 1,
|
|
668
|
-
end: range.endLine + 1
|
|
669
|
-
};
|
|
670
|
-
if (typeof range.kind !== "undefined") {
|
|
671
|
-
result.kind = toFoldingRangeKind(range.kind);
|
|
672
|
-
}
|
|
673
|
-
return result;
|
|
674
|
-
});
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
function toFoldingRangeKind(kind) {
|
|
679
|
-
switch (kind) {
|
|
680
|
-
case FoldingRangeKind.Comment:
|
|
681
|
-
return languages.FoldingRangeKind.Comment;
|
|
682
|
-
case FoldingRangeKind.Imports:
|
|
683
|
-
return languages.FoldingRangeKind.Imports;
|
|
684
|
-
case FoldingRangeKind.Region:
|
|
685
|
-
return languages.FoldingRangeKind.Region;
|
|
686
|
-
}
|
|
687
|
-
return void 0;
|
|
688
|
-
}
|
|
689
|
-
class SelectionRangeAdapter {
|
|
690
|
-
constructor(_worker) {
|
|
691
|
-
this._worker = _worker;
|
|
692
|
-
}
|
|
693
|
-
provideSelectionRanges(model, positions, token) {
|
|
694
|
-
const resource = model.uri;
|
|
695
|
-
return this._worker(resource).then(
|
|
696
|
-
(worker) => worker.getSelectionRanges(
|
|
697
|
-
resource.toString(),
|
|
698
|
-
positions.map(fromPosition)
|
|
699
|
-
)
|
|
700
|
-
).then((selectionRanges) => {
|
|
701
|
-
if (!selectionRanges) {
|
|
702
|
-
return;
|
|
703
|
-
}
|
|
704
|
-
return selectionRanges.map((selectionRange) => {
|
|
705
|
-
const result = [];
|
|
706
|
-
while (selectionRange) {
|
|
707
|
-
result.push({ range: toRange(selectionRange.range) });
|
|
708
|
-
selectionRange = selectionRange.parent;
|
|
709
|
-
}
|
|
710
|
-
return result;
|
|
711
|
-
});
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
export { CompletionAdapter, DefinitionAdapter, DiagnosticsAdapter, DocumentColorAdapter, DocumentFormattingEditProvider, DocumentHighlightAdapter, DocumentLinkAdapter, DocumentRangeFormattingEditProvider, DocumentSymbolAdapter, FoldingRangeAdapter, HoverAdapter, ReferenceAdapter, RenameAdapter, SelectionRangeAdapter, fromPosition, fromRange, toRange, toTextEdit };
|