diff --git a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts index 20ea1f461d367bfe8103737e1bebc42c20635099..5a49e8d3070f8b98d77c3b7674dffec5fa23d697 100644 --- a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts +++ b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts @@ -65,7 +65,6 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay { const selectionIsEmpty = e.selections[0].isEmpty(); if (this._selectionIsEmpty !== selectionIsEmpty) { this._selectionIsEmpty = selectionIsEmpty; - hasChanged = true; return true; } diff --git a/src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts b/src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts index 31781146edb433d2b3f34a5b098102b61ecee5fa..b3054d0408accf9b931213cb20697b4f57a770b1 100644 --- a/src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts +++ b/src/vs/editor/browser/viewParts/currentLineMarginHighlight/currentLineMarginHighlight.ts @@ -63,7 +63,6 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay { const selectionIsEmpty = e.selections[0].isEmpty(); if (this._selectionIsEmpty !== selectionIsEmpty) { this._selectionIsEmpty = selectionIsEmpty; - hasChanged = true; return true; } diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 57173f08a01440a4c0d234480eac5fa6a7445294..d8ee1d9226bbabfc5aaa0cf875d63afdb806cb57 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -1954,7 +1954,7 @@ export class EditorOptionsValidator { } else if (renderWhitespace === false) { renderWhitespace = 'none'; } - renderWhitespace = _stringSet<'none' | 'boundary' | 'all'>(opts.renderWhitespace, defaults.renderWhitespace, ['none', 'boundary', 'all']); + renderWhitespace = _stringSet<'none' | 'boundary' | 'all'>(renderWhitespace, defaults.renderWhitespace, ['none', 'boundary', 'all']); } let renderLineHighlight = opts.renderLineHighlight; @@ -1965,7 +1965,7 @@ export class EditorOptionsValidator { } else if (renderLineHighlight === false) { renderLineHighlight = 'none'; } - renderLineHighlight = _stringSet<'none' | 'gutter' | 'line' | 'all'>(opts.renderLineHighlight, defaults.renderLineHighlight, ['none', 'gutter', 'line', 'all']); + renderLineHighlight = _stringSet<'none' | 'gutter' | 'line' | 'all'>(renderLineHighlight, defaults.renderLineHighlight, ['none', 'gutter', 'line', 'all']); } let mouseWheelScrollSensitivity = _float(opts.mouseWheelScrollSensitivity, defaults.scrollbar.mouseWheelScrollSensitivity); diff --git a/src/vs/editor/common/controller/cursorTypeOperations.ts b/src/vs/editor/common/controller/cursorTypeOperations.ts index 2097cb3817def60bb7bb82aefb1a6c2ff1508d44..ac585844d865740e54c57bcbf47a0124d0222d3a 100644 --- a/src/vs/editor/common/controller/cursorTypeOperations.ts +++ b/src/vs/editor/common/controller/cursorTypeOperations.ts @@ -159,7 +159,7 @@ export class TypeOperations { action = expectedIndentAction.action; indentation = expectedIndentAction.indentation; } else if (lineNumber > 1) { - let lastLineNumber = lineNumber - 1; + let lastLineNumber: number; for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) { let lineText = model.getLineContent(lastLineNumber); let nonWhitespaceIdx = strings.lastNonWhitespaceIndex(lineText); diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index 9912616baad417dc5a6f710c2107ca0760d989f0..9d9a1a7d8c4139029cfa54ebef17b4d4ecbcce54 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -732,6 +732,12 @@ export interface ITextModel { */ findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null; + /** + * Flush all tokenization state. + * @internal + */ + flushTokens(): void; + /** * Force tokenization information for `lineNumber` to be accurate. * @internal diff --git a/src/vs/editor/common/model/intervalTree.ts b/src/vs/editor/common/model/intervalTree.ts index 1800edbf0e4a289bbfac886aecb3d184688d3faf..496e77b9ef4bad739aad94ecf542f343fafc89eb 100644 --- a/src/vs/editor/common/model/intervalTree.ts +++ b/src/vs/editor/common/model/intervalTree.ts @@ -464,11 +464,9 @@ export function nodeAcceptEdit(node: IntervalNode, start: number, end: number, t const deltaColumn = (insertingCnt - deletingCnt); if (!startDone) { node.start = Math.max(0, nodeStart + deltaColumn); - startDone = true; } if (!endDone) { node.end = Math.max(0, nodeEnd + deltaColumn); - endDone = true; } if (node.start > node.end) { diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index 449a69f35c0a0d420997a0c9bcbb6b24d107c96d..eb07a0cd49f5d85607175172d4175264632e7632 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -1840,6 +1840,16 @@ export class TextModel extends Disposable implements model.ITextModel { } } + public flushTokens(): void { + this._resetTokenizationState(); + this.emitModelTokensChangedEvent({ + ranges: [{ + fromLineNumber: 1, + toLineNumber: this.getLineCount() + }] + }); + } + public forceTokenization(lineNumber: number): void { if (lineNumber < 1 || lineNumber > this.getLineCount()) { throw new Error('Illegal value for lineNumber'); diff --git a/src/vs/editor/common/model/textModelTokens.ts b/src/vs/editor/common/model/textModelTokens.ts index c5f2e74f03405ab91d3a739531c2a803414ea1d8..02b3a9460992676e328eb02ec108e253a6a46500 100644 --- a/src/vs/editor/common/model/textModelTokens.ts +++ b/src/vs/editor/common/model/textModelTokens.ts @@ -154,7 +154,7 @@ class ModelLineTokens { let fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, chIndex); if (fromTokenIndex > 0) { - const fromTokenStartOffset = (fromTokenIndex > 0 ? tokens[(fromTokenIndex - 1) << 1] : 0); + const fromTokenStartOffset = tokens[(fromTokenIndex - 1) << 1]; if (fromTokenStartOffset === chIndex) { fromTokenIndex--; } diff --git a/src/vs/editor/common/model/wordHelper.ts b/src/vs/editor/common/model/wordHelper.ts index b39bc6a563d1a9b1a4e1f02a0a0fe8a140f6f45c..3e849b0dddf274fbf747e615443964a3c3672923 100644 --- a/src/vs/editor/common/model/wordHelper.ts +++ b/src/vs/editor/common/model/wordHelper.ts @@ -60,10 +60,6 @@ function getWordAtPosFast(column: number, wordDefinition: RegExp, text: string, let pos = column - 1 - textOffset; let start = text.lastIndexOf(' ', pos - 1) + 1; - let end = text.indexOf(' ', pos); - if (end === -1) { - end = text.length; - } wordDefinition.lastIndex = start; let match: RegExpMatchArray | null; diff --git a/src/vs/editor/common/modes/languageConfigurationRegistry.ts b/src/vs/editor/common/modes/languageConfigurationRegistry.ts index 0efcb9559f4fed91da0957451bb331e351d3ee86..1c46797d5e7b9067d2c42a09b6c7ad419e6e97dc 100644 --- a/src/vs/editor/common/modes/languageConfigurationRegistry.ts +++ b/src/vs/editor/common/modes/languageConfigurationRegistry.ts @@ -332,7 +332,7 @@ export class LanguageConfigurationRegistryImpl { private getPrecedingValidLine(model: IVirtualModel, lineNumber: number, indentRulesSupport: IndentRulesSupport) { let languageID = model.getLanguageIdAtPosition(lineNumber, 0); if (lineNumber > 1) { - let lastLineNumber = lineNumber - 1; + let lastLineNumber: number; let resultLineNumber = -1; for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) { diff --git a/src/vs/editor/common/viewModel/viewModelDecorations.ts b/src/vs/editor/common/viewModel/viewModelDecorations.ts index c8020eb4823652001e2e5f4304388b1a45a0f751..969440889192ebb94eb7d475a3baa0fd508be6fd 100644 --- a/src/vs/editor/common/viewModel/viewModelDecorations.ts +++ b/src/vs/editor/common/viewModel/viewModelDecorations.ts @@ -92,8 +92,7 @@ export class ViewModelDecorations implements IDisposable { } public getDecorationsViewportData(viewRange: Range): IDecorationsViewportData { - let cacheIsValid = true; - cacheIsValid = cacheIsValid && (this._cachedModelDecorationsResolver !== null); + let cacheIsValid = (this._cachedModelDecorationsResolver !== null); cacheIsValid = cacheIsValid && (viewRange.equalsRange(this._cachedModelDecorationsResolverViewRange)); if (!cacheIsValid) { this._cachedModelDecorationsResolver = this._getDecorationsViewportData(viewRange); diff --git a/src/vs/editor/standalone/common/monarch/monarchCompile.ts b/src/vs/editor/standalone/common/monarch/monarchCompile.ts index 93332bf9432f91a8b26769f25b683fcd22e667fd..6609690f55af3e18723d38a805bc0aa031d69ee4 100644 --- a/src/vs/editor/standalone/common/monarch/monarchCompile.ts +++ b/src/vs/editor/standalone/common/monarch/monarchCompile.ts @@ -219,7 +219,6 @@ function compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: else if (action.token || action.token === '') { if (typeof (action.token) !== 'string') { throw monarchCommon.createError(lexer, 'a \'token\' attribute must be of type string, in rule: ' + ruleName); - return { token: '' }; } else { // only copy specific typed fields (only happens once during compile Lexer) @@ -321,7 +320,6 @@ function compileAction(lexer: monarchCommon.ILexerMin, ruleName: string, action: } else { throw monarchCommon.createError(lexer, 'an action must be a string, an object with a \'token\' or \'cases\' attribute, or an array of actions; in rule: ' + ruleName); - return ''; } } diff --git a/src/vs/platform/integrity/node/integrityServiceImpl.ts b/src/vs/platform/integrity/node/integrityServiceImpl.ts index 64ee7abfc42e7047cc93c50967cabf0803aee171..25970d2f57f4d3537afd6cc7379f7e56a2284c90 100644 --- a/src/vs/platform/integrity/node/integrityServiceImpl.ts +++ b/src/vs/platform/integrity/node/integrityServiceImpl.ts @@ -115,7 +115,7 @@ export class IntegrityServiceImpl implements IIntegrityService { return Promise.all(asyncResults).then((allResults) => { let isPure = true; - for (let i = 0, len = allResults.length; isPure && i < len; i++) { + for (let i = 0, len = allResults.length; i < len; i++) { if (!allResults[i].isPure) { isPure = false; break; diff --git a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts index 020b8f1890b70cfdfb9a7cffc78f631b4fc4c1c5..515a166f13407d9e27fdec7d348d09b7135259b2 100644 --- a/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts +++ b/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts @@ -800,7 +800,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper { for (let i = 0, len = kbCombos.length; i < len; i++) { const kbCombo = kbCombos[i]; // find out the priority of this scan code for this key code - let colPriority = '-'; + let colPriority: string; const scanCodeCombos = this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(kbCombo); if (scanCodeCombos.length === 1) {