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,395 +0,0 @@
|
|
|
1
|
-
import { TaskQueue } from '../../../../../base/common/async.js';
|
|
2
|
-
import { Disposable, toDisposable } from '../../../../../base/common/lifecycle.js';
|
|
3
|
-
import '../../../../../base/common/observableInternal/index.js';
|
|
4
|
-
import { setTimeout0 } from '../../../../../base/common/platform.js';
|
|
5
|
-
import { ILogService } from '../../../../../platform/log/common/log.js';
|
|
6
|
-
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
|
|
7
|
-
import { TextLength } from '../../../core/text/textLength.js';
|
|
8
|
-
import { gotoParent, getClosestPreviousNodes, nextSiblingOrParentSibling, gotoNthChild } from './cursorUtils.js';
|
|
9
|
-
import { Range } from '../../../core/range.js';
|
|
10
|
-
import { transaction } from '../../../../../base/common/observableInternal/transaction.js';
|
|
11
|
-
import { observableValue } from '../../../../../base/common/observableInternal/observables/observableValue.js';
|
|
12
|
-
|
|
13
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
};
|
|
19
|
-
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
|
|
20
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
21
|
-
};
|
|
22
|
-
let TreeSitterTree = class TreeSitterTree extends Disposable {
|
|
23
|
-
constructor(languageId, _ranges,
|
|
24
|
-
// readonly treeSitterLanguage: Language,
|
|
25
|
-
/** Must have the language set! */
|
|
26
|
-
_parser, _parserClass,
|
|
27
|
-
// private readonly _injectionQuery: TreeSitter.Query,
|
|
28
|
-
textModel, _logService, _telemetryService) {
|
|
29
|
-
super();
|
|
30
|
-
this.languageId = languageId;
|
|
31
|
-
this._ranges = _ranges;
|
|
32
|
-
this._parser = _parser;
|
|
33
|
-
this._parserClass = _parserClass;
|
|
34
|
-
this.textModel = textModel;
|
|
35
|
-
this._logService = _logService;
|
|
36
|
-
this._telemetryService = _telemetryService;
|
|
37
|
-
this._tree = observableValue(this, undefined);
|
|
38
|
-
this.tree = this._tree;
|
|
39
|
-
this._treeLastParsedVersion = observableValue(this, -1);
|
|
40
|
-
this.treeLastParsedVersion = this._treeLastParsedVersion;
|
|
41
|
-
this._onDidChangeContentQueue = new TaskQueue();
|
|
42
|
-
this._tree = observableValue(this, undefined);
|
|
43
|
-
this.tree = this._tree;
|
|
44
|
-
this._register(toDisposable(() => {
|
|
45
|
-
this._tree.get()?.delete();
|
|
46
|
-
this._lastFullyParsed?.delete();
|
|
47
|
-
this._lastFullyParsedWithEdits?.delete();
|
|
48
|
-
this._parser.delete();
|
|
49
|
-
}));
|
|
50
|
-
this.handleContentChange(undefined, this._ranges);
|
|
51
|
-
}
|
|
52
|
-
handleContentChange(e, ranges) {
|
|
53
|
-
const version = this.textModel.getVersionId();
|
|
54
|
-
let newRanges = [];
|
|
55
|
-
if (ranges) {
|
|
56
|
-
newRanges = this._setRanges(ranges);
|
|
57
|
-
}
|
|
58
|
-
if (e) {
|
|
59
|
-
this._applyEdits(e.changes);
|
|
60
|
-
}
|
|
61
|
-
this._onDidChangeContentQueue.clearPending();
|
|
62
|
-
this._onDidChangeContentQueue.schedule(async () => {
|
|
63
|
-
if (this._store.isDisposed) {
|
|
64
|
-
// No need to continue the queue if we are disposed
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const oldTree = this._lastFullyParsed;
|
|
68
|
-
let changedNodes;
|
|
69
|
-
if (this._lastFullyParsedWithEdits && this._lastFullyParsed) {
|
|
70
|
-
changedNodes = this._findChangedNodes(this._lastFullyParsedWithEdits, this._lastFullyParsed);
|
|
71
|
-
}
|
|
72
|
-
const completed = await this._parseAndUpdateTree(version);
|
|
73
|
-
if (completed) {
|
|
74
|
-
let ranges;
|
|
75
|
-
if (!changedNodes) {
|
|
76
|
-
if (this._ranges) {
|
|
77
|
-
ranges = this._ranges.map(r => ({ newRange: new Range(r.startPosition.row + 1, r.startPosition.column + 1, r.endPosition.row + 1, r.endPosition.column + 1), oldRangeLength: r.endIndex - r.startIndex, newRangeStartOffset: r.startIndex, newRangeEndOffset: r.endIndex }));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else if (oldTree && changedNodes) {
|
|
81
|
-
ranges = this._findTreeChanges(completed, changedNodes, newRanges);
|
|
82
|
-
}
|
|
83
|
-
if (!ranges) {
|
|
84
|
-
ranges = [{ newRange: this.textModel.getFullModelRange(), newRangeStartOffset: 0, newRangeEndOffset: this.textModel.getValueLength() }];
|
|
85
|
-
}
|
|
86
|
-
const previousTree = this._tree.get();
|
|
87
|
-
transaction(tx => {
|
|
88
|
-
this._tree.set(completed, tx, { ranges, versionId: version });
|
|
89
|
-
this._treeLastParsedVersion.set(version, tx);
|
|
90
|
-
});
|
|
91
|
-
previousTree?.delete();
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
_applyEdits(changes) {
|
|
96
|
-
for (const change of changes) {
|
|
97
|
-
const originalTextLength = TextLength.ofRange(Range.lift(change.range));
|
|
98
|
-
const newTextLength = TextLength.ofText(change.text);
|
|
99
|
-
const summedTextLengths = change.text.length === 0 ? newTextLength : originalTextLength.add(newTextLength);
|
|
100
|
-
const edit = {
|
|
101
|
-
startIndex: change.rangeOffset,
|
|
102
|
-
oldEndIndex: change.rangeOffset + change.rangeLength,
|
|
103
|
-
newEndIndex: change.rangeOffset + change.text.length,
|
|
104
|
-
startPosition: { row: change.range.startLineNumber - 1, column: change.range.startColumn - 1 },
|
|
105
|
-
oldEndPosition: { row: change.range.endLineNumber - 1, column: change.range.endColumn - 1 },
|
|
106
|
-
newEndPosition: { row: change.range.startLineNumber + summedTextLengths.lineCount - 1, column: summedTextLengths.lineCount ? summedTextLengths.columnCount : (change.range.endColumn + summedTextLengths.columnCount) }
|
|
107
|
-
};
|
|
108
|
-
this._tree.get()?.edit(edit);
|
|
109
|
-
this._lastFullyParsedWithEdits?.edit(edit);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
_findChangedNodes(newTree, oldTree) {
|
|
113
|
-
if ((this._ranges && this._ranges.every(range => range.startPosition.row !== newTree.rootNode.startPosition.row)) || newTree.rootNode.startPosition.row !== 0) {
|
|
114
|
-
return [];
|
|
115
|
-
}
|
|
116
|
-
const newCursor = newTree.walk();
|
|
117
|
-
const oldCursor = oldTree.walk();
|
|
118
|
-
const nodes = [];
|
|
119
|
-
let next = true;
|
|
120
|
-
do {
|
|
121
|
-
if (newCursor.currentNode.hasChanges) {
|
|
122
|
-
// Check if only one of the children has changes.
|
|
123
|
-
// If it's only one, then we go to that child.
|
|
124
|
-
// If it's more then, we need to go to each child
|
|
125
|
-
// If it's none, then we've found one of our ranges
|
|
126
|
-
const newChildren = newCursor.currentNode.children;
|
|
127
|
-
const indexChangedChildren = [];
|
|
128
|
-
const changedChildren = newChildren.filter((c, index) => {
|
|
129
|
-
if (c?.hasChanges || (oldCursor.currentNode.children.length <= index)) {
|
|
130
|
-
indexChangedChildren.push(index);
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
return false;
|
|
134
|
-
});
|
|
135
|
-
// If we have changes and we *had* an error, the whole node should be refreshed.
|
|
136
|
-
if ((changedChildren.length === 0) || (newCursor.currentNode.hasError !== oldCursor.currentNode.hasError)) {
|
|
137
|
-
// walk up again until we get to the first one that's named as unnamed nodes can be too granular
|
|
138
|
-
while (newCursor.currentNode.parent && next && !newCursor.currentNode.isNamed) {
|
|
139
|
-
next = gotoParent(newCursor, oldCursor);
|
|
140
|
-
}
|
|
141
|
-
// Use the end position of the previous node and the start position of the current node
|
|
142
|
-
const newNode = newCursor.currentNode;
|
|
143
|
-
const closestPreviousNode = getClosestPreviousNodes(newCursor, newTree) ?? newNode;
|
|
144
|
-
nodes.push({
|
|
145
|
-
startIndex: closestPreviousNode.startIndex,
|
|
146
|
-
endIndex: newNode.endIndex,
|
|
147
|
-
startPosition: closestPreviousNode.startPosition,
|
|
148
|
-
endPosition: newNode.endPosition
|
|
149
|
-
});
|
|
150
|
-
next = nextSiblingOrParentSibling(newCursor, oldCursor);
|
|
151
|
-
}
|
|
152
|
-
else if (changedChildren.length >= 1) {
|
|
153
|
-
next = gotoNthChild(newCursor, oldCursor, indexChangedChildren[0]);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
next = nextSiblingOrParentSibling(newCursor, oldCursor);
|
|
158
|
-
}
|
|
159
|
-
} while (next);
|
|
160
|
-
newCursor.delete();
|
|
161
|
-
oldCursor.delete();
|
|
162
|
-
return nodes;
|
|
163
|
-
}
|
|
164
|
-
_findTreeChanges(newTree, changedNodes, newRanges) {
|
|
165
|
-
let newRangeIndex = 0;
|
|
166
|
-
const mergedChanges = [];
|
|
167
|
-
// Find the parent in the new tree of the changed node
|
|
168
|
-
for (let nodeIndex = 0; nodeIndex < changedNodes.length; nodeIndex++) {
|
|
169
|
-
const node = changedNodes[nodeIndex];
|
|
170
|
-
if (mergedChanges.length > 0) {
|
|
171
|
-
if ((node.startIndex >= mergedChanges[mergedChanges.length - 1].newRangeStartOffset) && (node.endIndex <= mergedChanges[mergedChanges.length - 1].newRangeEndOffset)) {
|
|
172
|
-
// This node is within the previous range, skip it
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const cursor = newTree.walk();
|
|
177
|
-
const cursorContainersNode = () => cursor.startIndex < node.startIndex && cursor.endIndex > node.endIndex;
|
|
178
|
-
while (cursorContainersNode()) {
|
|
179
|
-
// See if we can go to a child
|
|
180
|
-
let child = cursor.gotoFirstChild();
|
|
181
|
-
let foundChild = false;
|
|
182
|
-
while (child) {
|
|
183
|
-
if (cursorContainersNode() && cursor.currentNode.isNamed) {
|
|
184
|
-
foundChild = true;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
child = cursor.gotoNextSibling();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (!foundChild) {
|
|
192
|
-
cursor.gotoParent();
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
if (cursor.currentNode.childCount === 0) {
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
const startPosition = cursor.currentNode.startPosition;
|
|
200
|
-
const endPosition = cursor.currentNode.endPosition;
|
|
201
|
-
const startIndex = cursor.currentNode.startIndex;
|
|
202
|
-
const endIndex = cursor.currentNode.endIndex;
|
|
203
|
-
const newChange = { newRange: new Range(startPosition.row + 1, startPosition.column + 1, endPosition.row + 1, endPosition.column + 1), newRangeStartOffset: startIndex, newRangeEndOffset: endIndex };
|
|
204
|
-
if ((newRangeIndex < newRanges.length) && rangesIntersect(newRanges[newRangeIndex], { startIndex, endIndex})) {
|
|
205
|
-
// combine the new change with the range
|
|
206
|
-
if (newRanges[newRangeIndex].startIndex < newChange.newRangeStartOffset) {
|
|
207
|
-
newChange.newRange = newChange.newRange.setStartPosition(newRanges[newRangeIndex].startPosition.row + 1, newRanges[newRangeIndex].startPosition.column + 1);
|
|
208
|
-
newChange.newRangeStartOffset = newRanges[newRangeIndex].startIndex;
|
|
209
|
-
}
|
|
210
|
-
if (newRanges[newRangeIndex].endIndex > newChange.newRangeEndOffset) {
|
|
211
|
-
newChange.newRange = newChange.newRange.setEndPosition(newRanges[newRangeIndex].endPosition.row + 1, newRanges[newRangeIndex].endPosition.column + 1);
|
|
212
|
-
newChange.newRangeEndOffset = newRanges[newRangeIndex].endIndex;
|
|
213
|
-
}
|
|
214
|
-
newRangeIndex++;
|
|
215
|
-
}
|
|
216
|
-
else if (newRangeIndex < newRanges.length && newRanges[newRangeIndex].endIndex < newChange.newRangeStartOffset) {
|
|
217
|
-
// add the full range to the merged changes
|
|
218
|
-
mergedChanges.push({
|
|
219
|
-
newRange: new Range(newRanges[newRangeIndex].startPosition.row + 1, newRanges[newRangeIndex].startPosition.column + 1, newRanges[newRangeIndex].endPosition.row + 1, newRanges[newRangeIndex].endPosition.column + 1),
|
|
220
|
-
newRangeStartOffset: newRanges[newRangeIndex].startIndex,
|
|
221
|
-
newRangeEndOffset: newRanges[newRangeIndex].endIndex
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
if ((mergedChanges.length > 0) && (mergedChanges[mergedChanges.length - 1].newRangeEndOffset >= newChange.newRangeStartOffset)) {
|
|
225
|
-
// Merge the changes
|
|
226
|
-
mergedChanges[mergedChanges.length - 1].newRange = Range.fromPositions(mergedChanges[mergedChanges.length - 1].newRange.getStartPosition(), newChange.newRange.getEndPosition());
|
|
227
|
-
mergedChanges[mergedChanges.length - 1].newRangeEndOffset = newChange.newRangeEndOffset;
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
mergedChanges.push(newChange);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return this._constrainRanges(mergedChanges);
|
|
234
|
-
}
|
|
235
|
-
_constrainRanges(changes) {
|
|
236
|
-
if (!this._ranges) {
|
|
237
|
-
return changes;
|
|
238
|
-
}
|
|
239
|
-
const constrainedChanges = [];
|
|
240
|
-
let changesIndex = 0;
|
|
241
|
-
let rangesIndex = 0;
|
|
242
|
-
while (changesIndex < changes.length && rangesIndex < this._ranges.length) {
|
|
243
|
-
const change = changes[changesIndex];
|
|
244
|
-
const range = this._ranges[rangesIndex];
|
|
245
|
-
if (change.newRangeEndOffset < range.startIndex) {
|
|
246
|
-
// Change is before the range, move to the next change
|
|
247
|
-
changesIndex++;
|
|
248
|
-
}
|
|
249
|
-
else if (change.newRangeStartOffset > range.endIndex) {
|
|
250
|
-
// Change is after the range, move to the next range
|
|
251
|
-
rangesIndex++;
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
// Change is within the range, constrain it
|
|
255
|
-
const newRangeStartOffset = Math.max(change.newRangeStartOffset, range.startIndex);
|
|
256
|
-
const newRangeEndOffset = Math.min(change.newRangeEndOffset, range.endIndex);
|
|
257
|
-
const newRange = change.newRange.intersectRanges(new Range(range.startPosition.row + 1, range.startPosition.column + 1, range.endPosition.row + 1, range.endPosition.column + 1));
|
|
258
|
-
constrainedChanges.push({
|
|
259
|
-
newRange,
|
|
260
|
-
newRangeEndOffset,
|
|
261
|
-
newRangeStartOffset
|
|
262
|
-
});
|
|
263
|
-
// Remove the intersected range from the current change
|
|
264
|
-
if (newRangeEndOffset < change.newRangeEndOffset) {
|
|
265
|
-
change.newRange = Range.fromPositions(newRange.getEndPosition(), change.newRange.getEndPosition());
|
|
266
|
-
change.newRangeStartOffset = newRangeEndOffset + 1;
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
// Move to the next change
|
|
270
|
-
changesIndex++;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return constrainedChanges;
|
|
275
|
-
}
|
|
276
|
-
async _parseAndUpdateTree(version) {
|
|
277
|
-
const tree = await this._parse();
|
|
278
|
-
if (tree) {
|
|
279
|
-
this._lastFullyParsed?.delete();
|
|
280
|
-
this._lastFullyParsed = tree.copy();
|
|
281
|
-
this._lastFullyParsedWithEdits?.delete();
|
|
282
|
-
this._lastFullyParsedWithEdits = tree.copy();
|
|
283
|
-
return tree;
|
|
284
|
-
}
|
|
285
|
-
else if (!this._tree.get()) {
|
|
286
|
-
// No tree means this is the initial parse and there were edits
|
|
287
|
-
// parse function doesn't handle this well and we can end up with an incorrect tree, so we reset
|
|
288
|
-
this._parser.reset();
|
|
289
|
-
}
|
|
290
|
-
return undefined;
|
|
291
|
-
}
|
|
292
|
-
_parse() {
|
|
293
|
-
let parseType = "fullParse" /* TelemetryParseType.Full */;
|
|
294
|
-
if (this._tree.get()) {
|
|
295
|
-
parseType = "incrementalParse" /* TelemetryParseType.Incremental */;
|
|
296
|
-
}
|
|
297
|
-
return this._parseAndYield(parseType);
|
|
298
|
-
}
|
|
299
|
-
async _parseAndYield(parseType) {
|
|
300
|
-
let time = 0;
|
|
301
|
-
let passes = 0;
|
|
302
|
-
const inProgressVersion = this.textModel.getVersionId();
|
|
303
|
-
let newTree;
|
|
304
|
-
const progressCallback = newTimeOutProgressCallback();
|
|
305
|
-
do {
|
|
306
|
-
const timer = performance.now();
|
|
307
|
-
newTree = this._parser.parse((index, position) => this._parseCallback(index), this._tree.get(), { progressCallback, includedRanges: this._ranges });
|
|
308
|
-
time += performance.now() - timer;
|
|
309
|
-
passes++;
|
|
310
|
-
// So long as this isn't the initial parse, even if the model changes and edits are applied, the tree parsing will continue correctly after the await.
|
|
311
|
-
await new Promise(resolve => setTimeout0(resolve));
|
|
312
|
-
} while (!this._store.isDisposed && !newTree && inProgressVersion === this.textModel.getVersionId());
|
|
313
|
-
this._sendParseTimeTelemetry(parseType, time, passes);
|
|
314
|
-
return (newTree && (inProgressVersion === this.textModel.getVersionId())) ? newTree : undefined;
|
|
315
|
-
}
|
|
316
|
-
_parseCallback(index) {
|
|
317
|
-
try {
|
|
318
|
-
return this.textModel.getTextBuffer().getNearestChunk(index);
|
|
319
|
-
}
|
|
320
|
-
catch (e) {
|
|
321
|
-
this._logService.debug('Error getting chunk for tree-sitter parsing', e);
|
|
322
|
-
}
|
|
323
|
-
return undefined;
|
|
324
|
-
}
|
|
325
|
-
_setRanges(newRanges) {
|
|
326
|
-
const unKnownRanges = [];
|
|
327
|
-
// If we have existing ranges, find the parts of the new ranges that are not included in the existing ones
|
|
328
|
-
if (this._ranges) {
|
|
329
|
-
for (const newRange of newRanges) {
|
|
330
|
-
let isFullyIncluded = false;
|
|
331
|
-
for (let i = 0; i < this._ranges.length; i++) {
|
|
332
|
-
const existingRange = this._ranges[i];
|
|
333
|
-
if (rangesEqual(existingRange, newRange) || rangesIntersect(existingRange, newRange)) {
|
|
334
|
-
isFullyIncluded = true;
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
if (!isFullyIncluded) {
|
|
339
|
-
unKnownRanges.push(newRange);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
// No existing ranges, all new ranges are unknown
|
|
345
|
-
unKnownRanges.push(...newRanges);
|
|
346
|
-
}
|
|
347
|
-
this._ranges = newRanges;
|
|
348
|
-
return unKnownRanges;
|
|
349
|
-
}
|
|
350
|
-
_sendParseTimeTelemetry(parseType, time, passes) {
|
|
351
|
-
this._logService.debug(`Tree parsing (${parseType}) took ${time} ms and ${passes} passes.`);
|
|
352
|
-
if (parseType === "fullParse" /* TelemetryParseType.Full */) {
|
|
353
|
-
this._telemetryService.publicLog2(`treeSitter.fullParse`, { languageId: this.languageId, time, passes });
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
this._telemetryService.publicLog2(`treeSitter.incrementalParse`, { languageId: this.languageId, time, passes });
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
createParsedTreeSync(src) {
|
|
360
|
-
const parser = new this._parserClass();
|
|
361
|
-
parser.setLanguage(this._parser.language);
|
|
362
|
-
const tree = parser.parse(src);
|
|
363
|
-
parser.delete();
|
|
364
|
-
return tree ?? undefined;
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
TreeSitterTree = __decorate([
|
|
368
|
-
__param(5, ILogService),
|
|
369
|
-
__param(6, ITelemetryService)
|
|
370
|
-
], TreeSitterTree);
|
|
371
|
-
function newTimeOutProgressCallback() {
|
|
372
|
-
let lastYieldTime = performance.now();
|
|
373
|
-
return function parseProgressCallback(_state) {
|
|
374
|
-
const now = performance.now();
|
|
375
|
-
if (now - lastYieldTime > 50) {
|
|
376
|
-
lastYieldTime = now;
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
return false;
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function rangesEqual(a, b) {
|
|
383
|
-
return (a.startPosition.row === b.startPosition.row)
|
|
384
|
-
&& (a.startPosition.column === b.startPosition.column)
|
|
385
|
-
&& (a.endPosition.row === b.endPosition.row)
|
|
386
|
-
&& (a.endPosition.column === b.endPosition.column)
|
|
387
|
-
&& (a.startIndex === b.startIndex)
|
|
388
|
-
&& (a.endIndex === b.endIndex);
|
|
389
|
-
}
|
|
390
|
-
function rangesIntersect(a, b) {
|
|
391
|
-
return (a.startIndex <= b.startIndex && a.endIndex >= b.startIndex) ||
|
|
392
|
-
(b.startIndex <= a.startIndex && b.endIndex >= a.startIndex);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
export { TreeSitterTree, rangesEqual, rangesIntersect };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
class TreeViewsDnDService {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._dragOperations = new Map();
|
|
8
|
-
}
|
|
9
|
-
removeDragOperationTransfer(uuid) {
|
|
10
|
-
if ((uuid && this._dragOperations.has(uuid))) {
|
|
11
|
-
const operation = this._dragOperations.get(uuid);
|
|
12
|
-
this._dragOperations.delete(uuid);
|
|
13
|
-
return operation;
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
class DraggedTreeItemsIdentifier {
|
|
19
|
-
constructor(identifier) {
|
|
20
|
-
this.identifier = identifier;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { DraggedTreeItemsIdentifier, TreeViewsDnDService };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { registerSingleton } from '../../../platform/instantiation/common/extensions.js';
|
|
2
|
-
import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
|
|
3
|
-
import { TreeViewsDnDService } from './treeViewsDnd.js';
|
|
4
|
-
|
|
5
|
-
/*---------------------------------------------------------------------------------------------
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
8
|
-
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
const ITreeViewsDnDService = createDecorator('treeViewsDndService');
|
|
10
|
-
registerSingleton(ITreeViewsDnDService, TreeViewsDnDService, 1 /* InstantiationType.Delayed */);
|
|
11
|
-
|
|
12
|
-
export { ITreeViewsDnDService };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { lastNonWhitespaceIndex } from '../../../base/common/strings.js';
|
|
2
|
-
import { EditOperation } from '../core/editOperation.js';
|
|
3
|
-
import { Range } from '../core/range.js';
|
|
4
|
-
|
|
5
|
-
/*---------------------------------------------------------------------------------------------
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
8
|
-
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
class TrimTrailingWhitespaceCommand {
|
|
10
|
-
constructor(selection, cursors, trimInRegexesAndStrings) {
|
|
11
|
-
this._selection = selection;
|
|
12
|
-
this._cursors = cursors;
|
|
13
|
-
this._selectionId = null;
|
|
14
|
-
this._trimInRegexesAndStrings = trimInRegexesAndStrings;
|
|
15
|
-
}
|
|
16
|
-
getEditOperations(model, builder) {
|
|
17
|
-
const ops = trimTrailingWhitespace(model, this._cursors, this._trimInRegexesAndStrings);
|
|
18
|
-
for (let i = 0, len = ops.length; i < len; i++) {
|
|
19
|
-
const op = ops[i];
|
|
20
|
-
builder.addEditOperation(op.range, op.text);
|
|
21
|
-
}
|
|
22
|
-
this._selectionId = builder.trackSelection(this._selection);
|
|
23
|
-
}
|
|
24
|
-
computeCursorState(model, helper) {
|
|
25
|
-
return helper.getTrackedSelection(this._selectionId);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Generate commands for trimming trailing whitespace on a model and ignore lines on which cursors are sitting.
|
|
30
|
-
*/
|
|
31
|
-
function trimTrailingWhitespace(model, cursors, trimInRegexesAndStrings) {
|
|
32
|
-
// Sort cursors ascending
|
|
33
|
-
cursors.sort((a, b) => {
|
|
34
|
-
if (a.lineNumber === b.lineNumber) {
|
|
35
|
-
return a.column - b.column;
|
|
36
|
-
}
|
|
37
|
-
return a.lineNumber - b.lineNumber;
|
|
38
|
-
});
|
|
39
|
-
// Reduce multiple cursors on the same line and only keep the last one on the line
|
|
40
|
-
for (let i = cursors.length - 2; i >= 0; i--) {
|
|
41
|
-
if (cursors[i].lineNumber === cursors[i + 1].lineNumber) {
|
|
42
|
-
// Remove cursor at `i`
|
|
43
|
-
cursors.splice(i, 1);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const r = [];
|
|
47
|
-
let rLen = 0;
|
|
48
|
-
let cursorIndex = 0;
|
|
49
|
-
const cursorLen = cursors.length;
|
|
50
|
-
for (let lineNumber = 1, lineCount = model.getLineCount(); lineNumber <= lineCount; lineNumber++) {
|
|
51
|
-
const lineContent = model.getLineContent(lineNumber);
|
|
52
|
-
const maxLineColumn = lineContent.length + 1;
|
|
53
|
-
let minEditColumn = 0;
|
|
54
|
-
if (cursorIndex < cursorLen && cursors[cursorIndex].lineNumber === lineNumber) {
|
|
55
|
-
minEditColumn = cursors[cursorIndex].column;
|
|
56
|
-
cursorIndex++;
|
|
57
|
-
if (minEditColumn === maxLineColumn) {
|
|
58
|
-
// The cursor is at the end of the line => no edits for sure on this line
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (lineContent.length === 0) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const lastNonWhitespaceIndex$1 = lastNonWhitespaceIndex(lineContent);
|
|
66
|
-
let fromColumn = 0;
|
|
67
|
-
if (lastNonWhitespaceIndex$1 === -1) {
|
|
68
|
-
// Entire line is whitespace
|
|
69
|
-
fromColumn = 1;
|
|
70
|
-
}
|
|
71
|
-
else if (lastNonWhitespaceIndex$1 !== lineContent.length - 1) {
|
|
72
|
-
// There is trailing whitespace
|
|
73
|
-
fromColumn = lastNonWhitespaceIndex$1 + 2;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// There is no trailing whitespace
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (!trimInRegexesAndStrings) {
|
|
80
|
-
if (!model.tokenization.hasAccurateTokensForLine(lineNumber)) {
|
|
81
|
-
// We don't want to force line tokenization, as that can be expensive, but we also don't want to trim
|
|
82
|
-
// trailing whitespace in lines that are not tokenized yet, as that can be wrong and trim whitespace from
|
|
83
|
-
// lines that the user requested we don't. So we bail out if the tokens are not accurate for this line.
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const lineTokens = model.tokenization.getLineTokens(lineNumber);
|
|
87
|
-
const fromColumnType = lineTokens.getStandardTokenType(lineTokens.findTokenIndexAtOffset(fromColumn));
|
|
88
|
-
if (fromColumnType === 2 /* StandardTokenType.String */ || fromColumnType === 3 /* StandardTokenType.RegEx */) {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
fromColumn = Math.max(minEditColumn, fromColumn);
|
|
93
|
-
r[rLen++] = EditOperation.delete(new Range(lineNumber, fromColumn, lineNumber, maxLineColumn));
|
|
94
|
-
}
|
|
95
|
-
return r;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { TrimTrailingWhitespaceCommand, trimTrailingWhitespace };
|