chore(vscode): update to 1.55.2

This commit is contained in:
Akash Satheesan
2021-04-09 11:32:27 +05:30
1102 changed files with 39988 additions and 23544 deletions

View File

@@ -509,7 +509,7 @@ const editorConfiguration: IConfigurationNode = {
nls.localize('wordBasedSuggestionsMode.matchingDocuments', 'Suggest words from all open documents of the same language.'),
nls.localize('wordBasedSuggestionsMode.allDocuments', 'Suggest words from all open documents.')
],
description: nls.localize('wordBasedSuggestionsMode', "Controls from what documents word based completions are computed.")
description: nls.localize('wordBasedSuggestionsMode', "Controls from which documents word based completions are computed.")
},
'editor.semanticHighlighting.enabled': {
enum: [true, false, 'configuredByTheme'],

View File

@@ -28,7 +28,7 @@ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'bracket
/**
* Configuration options for typing over closing quotes or brackets
*/
export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never';
/**
* Configuration options for auto indentation in the editor
@@ -139,10 +139,15 @@ export interface IEditorOptions {
*/
extraEditorClassName?: string;
/**
* Should the editor be read only.
* Should the editor be read only. See also `domReadOnly`.
* Defaults to false.
*/
readOnly?: boolean;
/**
* Should the textarea used for input use the DOM `readonly` attribute.
* Defaults to false.
*/
domReadOnly?: boolean;
/**
* Enable linked editing.
* Defaults to false.
@@ -413,10 +418,14 @@ export interface IEditorOptions {
* Defaults to language defined behavior.
*/
autoClosingQuotes?: EditorAutoClosingStrategy;
/**
* Options for pressing backspace near quotes or bracket pairs.
*/
autoClosingDelete?: EditorAutoClosingEditStrategy;
/**
* Options for typing over closing quotes or brackets.
*/
autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
autoClosingOvertype?: EditorAutoClosingEditStrategy;
/**
* Options for auto surrounding.
* Defaults to always allowing auto surrounding.
@@ -1393,8 +1402,8 @@ class EditorFind extends BaseEditorOption<EditorOption.find, EditorFindOptions>
enum: ['never', 'always', 'multiline'],
default: defaults.autoFindInSelection,
enumDescriptions: [
nls.localize('editor.find.autoFindInSelection.never', 'Never turn on Find in selection automatically (default)'),
nls.localize('editor.find.autoFindInSelection.always', 'Always turn on Find in selection automatically'),
nls.localize('editor.find.autoFindInSelection.never', 'Never turn on Find in selection automatically (default).'),
nls.localize('editor.find.autoFindInSelection.always', 'Always turn on Find in selection automatically.'),
nls.localize('editor.find.autoFindInSelection.multiline', 'Turn on Find in selection automatically when multiple lines of content are selected.')
],
description: nls.localize('find.autoFindInSelection', "Controls the condition for turning on find in selection automatically.")
@@ -3140,7 +3149,7 @@ export interface ISuggestOptions {
*/
snippetsPreventQuickSuggestions?: boolean;
/**
* Favours words that appear close to the cursor.
* Favors words that appear close to the cursor.
*/
localityBonus?: boolean;
/**
@@ -3332,7 +3341,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
'editor.suggest.localityBonus': {
type: 'boolean',
default: defaults.localityBonus,
description: nls.localize('suggest.localityBonus', "Controls whether sorting favours words that appear close to the cursor.")
description: nls.localize('suggest.localityBonus', "Controls whether sorting favors words that appear close to the cursor.")
},
'editor.suggest.shareSuggestSelections': {
type: 'boolean',
@@ -3725,6 +3734,7 @@ export const enum EditorOption {
accessibilityPageSize,
ariaLabel,
autoClosingBrackets,
autoClosingDelete,
autoClosingOvertype,
autoClosingQuotes,
autoIndent,
@@ -3746,6 +3756,7 @@ export const enum EditorOption {
cursorWidth,
disableLayerHinting,
disableMonospaceOptimizations,
domReadOnly,
dragAndDrop,
emptySelectionClipboard,
extraEditorClassName,
@@ -3883,7 +3894,10 @@ export const EditorOptions = {
)),
accessibilitySupport: register(new EditorAccessibilitySupport()),
accessibilityPageSize: register(new EditorIntOption(EditorOption.accessibilityPageSize, 'accessibilityPageSize', 10, 1, Constants.MAX_SAFE_SMALL_INTEGER,
{ description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.") })),
{
description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 2000. Warning: this has a performance implication for numbers larger than the default."),
deprecationMessage: nls.localize('accessibilityPageSize.deprecated', "This setting is deprecated, editor will automatically choose the accessibility page size when we detect a screen reader. 2000 lines will be the new default.")
})),
ariaLabel: register(new EditorStringOption(
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
)),
@@ -3901,6 +3915,19 @@ export const EditorOptions = {
description: nls.localize('autoClosingBrackets', "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")
}
)),
autoClosingDelete: register(new EditorStringEnumOption(
EditorOption.autoClosingDelete, 'autoClosingDelete',
'auto' as 'always' | 'auto' | 'never',
['always', 'auto', 'never'] as const,
{
enumDescriptions: [
'',
nls.localize('editor.autoClosingDelete.auto', "Remove adjacent closing quotes or brackets only if they were automatically inserted."),
'',
],
description: nls.localize('autoClosingDelete', "Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")
}
)),
autoClosingOvertype: register(new EditorStringEnumOption(
EditorOption.autoClosingOvertype, 'autoClosingOvertype',
'auto' as 'always' | 'auto' | 'never',
@@ -3963,7 +3990,7 @@ export const EditorOptions = {
)),
stickyTabStops: register(new EditorBooleanOption(
EditorOption.stickyTabStops, 'stickyTabStops', false,
{ description: nls.localize('stickyTabStops', "Emulate selection behaviour of tab characters when using spaces for indentation. Selection will stick to tab stops.") }
{ description: nls.localize('stickyTabStops', "Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.") }
)),
codeLens: register(new EditorBooleanOption(
EditorOption.codeLens, 'codeLens', true,
@@ -4042,6 +4069,9 @@ export const EditorOptions = {
disableMonospaceOptimizations: register(new EditorBooleanOption(
EditorOption.disableMonospaceOptimizations, 'disableMonospaceOptimizations', false
)),
domReadOnly: register(new EditorBooleanOption(
EditorOption.domReadOnly, 'domReadOnly', false,
)),
dragAndDrop: register(new EditorBooleanOption(
EditorOption.dragAndDrop, 'dragAndDrop', true,
{ description: nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.") }
@@ -4264,7 +4294,7 @@ export const EditorOptions = {
)),
renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(
EditorOption.renderLineHighlightOnlyWhenFocus, 'renderLineHighlightOnlyWhenFocus', false,
{ description: nls.localize('renderLineHighlightOnlyWhenFocus', "Controls if the editor should render the current line highlight only when the editor is focused") }
{ description: nls.localize('renderLineHighlightOnlyWhenFocus', "Controls if the editor should render the current line highlight only when the editor is focused.") }
)),
renderValidationDecorations: register(new EditorStringEnumOption(
EditorOption.renderValidationDecorations, 'renderValidationDecorations',
@@ -4280,7 +4310,7 @@ export const EditorOptions = {
'',
nls.localize('renderWhitespace.boundary', "Render whitespace characters except for single spaces between words."),
nls.localize('renderWhitespace.selection', "Render whitespace characters only on selected text."),
nls.localize('renderWhitespace.trailing', "Render only trailing whitespace characters"),
nls.localize('renderWhitespace.trailing', "Render only trailing whitespace characters."),
''
],
description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters.")

View File

@@ -620,6 +620,10 @@ export class Cursor extends Disposable {
this._isDoingComposition = isDoingComposition;
}
public getAutoClosedCharacters(): Range[] {
return AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
}
public startComposition(eventsCollector: ViewModelEventsCollector): void {
this._selectionsWhenCompositionStarted = this.getSelections().slice(0);
}
@@ -628,8 +632,7 @@ export class Cursor extends Disposable {
this._executeEdit(() => {
if (source === 'keyboard') {
// composition finishes, let's check if we need to auto complete if necessary.
const autoClosedCharacters = AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
this._executeEditOperation(TypeOperations.compositionEndWithInterceptors(this._prevEditOperationType, this.context.cursorConfig, this._model, this._selectionsWhenCompositionStarted, this.getSelections(), autoClosedCharacters));
this._executeEditOperation(TypeOperations.compositionEndWithInterceptors(this._prevEditOperationType, this.context.cursorConfig, this._model, this._selectionsWhenCompositionStarted, this.getSelections(), this.getAutoClosedCharacters()));
this._selectionsWhenCompositionStarted = null;
}
}, eventsCollector, source);
@@ -647,8 +650,7 @@ export class Cursor extends Disposable {
const chr = text.substr(offset, charLength);
// Here we must interpret each typed character individually
const autoClosedCharacters = AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
this._executeEditOperation(TypeOperations.typeWithInterceptors(this._isDoingComposition, this._prevEditOperationType, this.context.cursorConfig, this._model, this.getSelections(), autoClosedCharacters, chr));
this._executeEditOperation(TypeOperations.typeWithInterceptors(this._isDoingComposition, this._prevEditOperationType, this.context.cursorConfig, this._model, this.getSelections(), this.getAutoClosedCharacters(), chr));
offset += charLength;
}

View File

@@ -87,7 +87,7 @@ export class ColumnSelection {
public static columnSelectLeft(config: CursorConfiguration, model: ICursorSimpleModel, prevColumnSelectData: IColumnSelectData): IColumnSelectResult {
let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;
if (toViewVisualColumn > 1) {
if (toViewVisualColumn > 0) {
toViewVisualColumn--;
}

View File

@@ -6,7 +6,7 @@
import { CharCode } from 'vs/base/common/charCode';
import { onUnexpectedError } from 'vs/base/common/errors';
import * as strings from 'vs/base/common/strings';
import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, ConfigurationChangedEvent, EditorAutoClosingOvertypeStrategy, EditorOption, EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions';
import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, ConfigurationChangedEvent, EditorAutoClosingEditStrategy, EditorOption, EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { ISelection, Selection } from 'vs/editor/common/core/selection';
@@ -73,7 +73,8 @@ export class CursorConfiguration {
public readonly multiCursorPaste: 'spread' | 'full';
public readonly autoClosingBrackets: EditorAutoClosingStrategy;
public readonly autoClosingQuotes: EditorAutoClosingStrategy;
public readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
public readonly autoClosingDelete: EditorAutoClosingEditStrategy;
public readonly autoClosingOvertype: EditorAutoClosingEditStrategy;
public readonly autoSurround: EditorAutoSurroundStrategy;
public readonly autoIndent: EditorAutoIndentStrategy;
public readonly autoClosingPairs: AutoClosingPairs;
@@ -92,6 +93,7 @@ export class CursorConfiguration {
|| e.hasChanged(EditorOption.multiCursorPaste)
|| e.hasChanged(EditorOption.autoClosingBrackets)
|| e.hasChanged(EditorOption.autoClosingQuotes)
|| e.hasChanged(EditorOption.autoClosingDelete)
|| e.hasChanged(EditorOption.autoClosingOvertype)
|| e.hasChanged(EditorOption.autoSurround)
|| e.hasChanged(EditorOption.useTabStops)
@@ -125,6 +127,7 @@ export class CursorConfiguration {
this.multiCursorPaste = options.get(EditorOption.multiCursorPaste);
this.autoClosingBrackets = options.get(EditorOption.autoClosingBrackets);
this.autoClosingQuotes = options.get(EditorOption.autoClosingQuotes);
this.autoClosingDelete = options.get(EditorOption.autoClosingDelete);
this.autoClosingOvertype = options.get(EditorOption.autoClosingOvertype);
this.autoSurround = options.get(EditorOption.autoSurround);
this.autoIndent = options.get(EditorOption.autoIndent);

View File

@@ -5,7 +5,7 @@
import * as strings from 'vs/base/common/strings';
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
import { EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
import { EditorAutoClosingEditStrategy, EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
import { CursorColumns, CursorConfiguration, EditOperationResult, EditOperationType, ICursorSimpleModel, isQuote } from 'vs/editor/common/controller/cursorCommon';
import { MoveOperations } from 'vs/editor/common/controller/cursorMoveOperations';
import { Range } from 'vs/editor/common/core/range';
@@ -50,15 +50,20 @@ export class DeleteOperations {
}
public static isAutoClosingPairDelete(
autoClosingDelete: EditorAutoClosingEditStrategy,
autoClosingBrackets: EditorAutoClosingStrategy,
autoClosingQuotes: EditorAutoClosingStrategy,
autoClosingPairsOpen: Map<string, StandardAutoClosingPairConditional[]>,
model: ICursorSimpleModel,
selections: Selection[]
selections: Selection[],
autoClosedCharacters: Range[]
): boolean {
if (autoClosingBrackets === 'never' && autoClosingQuotes === 'never') {
return false;
}
if (autoClosingDelete === 'never') {
return false;
}
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
@@ -100,6 +105,21 @@ export class DeleteOperations {
if (!foundAutoClosingPair) {
return false;
}
// Must delete the pair only if it was automatically inserted by the editor
if (autoClosingDelete === 'auto') {
let found = false;
for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {
const autoClosedCharacter = autoClosedCharacters[j];
if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
return true;
@@ -120,9 +140,9 @@ export class DeleteOperations {
return [true, commands];
}
public static deleteLeft(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): [boolean, Array<ICommand | null>] {
public static deleteLeft(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[], autoClosedCharacters: Range[]): [boolean, Array<ICommand | null>] {
if (this.isAutoClosingPairDelete(config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairs.autoClosingPairsOpenByEnd, model, selections)) {
if (this.isAutoClosingPairDelete(config.autoClosingDelete, config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairs.autoClosingPairsOpenByEnd, model, selections, autoClosedCharacters)) {
return this._runAutoClosingPairDelete(config, model, selections);
}

View File

@@ -5,7 +5,7 @@
import { CharCode } from 'vs/base/common/charCode';
import * as strings from 'vs/base/common/strings';
import { EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
import { EditorAutoClosingEditStrategy, EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
import { CursorConfiguration, ICursorSimpleModel, SingleCursorState } from 'vs/editor/common/controller/cursorCommon';
import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperations';
import { WordCharacterClass, WordCharacterClassifier, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
@@ -52,9 +52,11 @@ export interface DeleteWordContext {
model: ITextModel;
selection: Selection;
whitespaceHeuristics: boolean;
autoClosingDelete: EditorAutoClosingEditStrategy;
autoClosingBrackets: EditorAutoClosingStrategy;
autoClosingQuotes: EditorAutoClosingStrategy;
autoClosingPairs: AutoClosingPairs;
autoClosedCharacters: Range[];
}
export class WordOperations {
@@ -384,7 +386,7 @@ export class WordOperations {
return selection;
}
if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpenByEnd, ctx.model, [ctx.selection])) {
if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingDelete, ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpenByEnd, ctx.model, [ctx.selection], ctx.autoClosedCharacters)) {
const position = ctx.selection.getPosition();
return new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);
}

View File

@@ -23,10 +23,26 @@ export interface IStringBuilder {
appendASCIIString(str: string): void;
}
let _utf16LE_TextDecoder: TextDecoder | null;
function getUTF16LE_TextDecoder(): TextDecoder {
if (!_utf16LE_TextDecoder) {
_utf16LE_TextDecoder = new TextDecoder('UTF-16LE');
}
return _utf16LE_TextDecoder;
}
let _utf16BE_TextDecoder: TextDecoder | null;
function getUTF16BE_TextDecoder(): TextDecoder {
if (!_utf16BE_TextDecoder) {
_utf16BE_TextDecoder = new TextDecoder('UTF-16BE');
}
return _utf16BE_TextDecoder;
}
let _platformTextDecoder: TextDecoder | null;
export function getPlatformTextDecoder(): TextDecoder {
if (!_platformTextDecoder) {
_platformTextDecoder = new TextDecoder(platform.isLittleEndian() ? 'UTF-16LE' : 'UTF-16BE');
_platformTextDecoder = platform.isLittleEndian() ? getUTF16LE_TextDecoder() : getUTF16BE_TextDecoder();
}
return _platformTextDecoder;
}
@@ -45,7 +61,14 @@ if (hasTextDecoder) {
function standardDecodeUTF16LE(source: Uint8Array, offset: number, len: number): string {
const view = new Uint16Array(source.buffer, offset, len);
return getPlatformTextDecoder().decode(view);
if (len > 0 && (view[0] === 0xFEFF || view[0] === 0xFFFE)) {
// UTF16 sometimes starts with a BOM https://de.wikipedia.org/wiki/Byte_Order_Mark
// It looks like TextDecoder.decode will eat up a leading BOM (0xFEFF or 0xFFFE)
// We don't want that behavior because we know the string is UTF16LE and the BOM should be maintained
// So we use the manual decoder
return compatDecodeUTF16LE(source, offset, len);
}
return getUTF16LE_TextDecoder().decode(view);
}
function compatDecodeUTF16LE(source: Uint8Array, offset: number, len: number): string {

View File

@@ -19,7 +19,7 @@ function uriGetComparisonKey(resource: URI): string {
return resource.toString();
}
class SingleModelEditStackData {
export class SingleModelEditStackData {
public static create(model: ITextModel, beforeCursorState: Selection[] | null): SingleModelEditStackData {
const alternativeVersionId = model.getAlternativeVersionId();

View File

@@ -881,55 +881,49 @@ export class TextModel extends Disposable implements model.ITextModel {
* Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.
* Will try to not allocate if possible.
*/
private _validateRangeRelaxedNoAllocations(range: IRange): Range {
public _validateRangeRelaxedNoAllocations(range: IRange): Range {
const linesCount = this._buffer.getLineCount();
const initialStartLineNumber = range.startLineNumber;
const initialStartColumn = range.startColumn;
let startLineNumber: number;
let startColumn: number;
let startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);
let startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);
if (initialStartLineNumber < 1) {
if (startLineNumber < 1) {
startLineNumber = 1;
startColumn = 1;
} else if (initialStartLineNumber > linesCount) {
} else if (startLineNumber > linesCount) {
startLineNumber = linesCount;
startColumn = this.getLineMaxColumn(startLineNumber);
} else {
startLineNumber = initialStartLineNumber | 0;
if (initialStartColumn <= 1) {
if (startColumn <= 1) {
startColumn = 1;
} else {
const maxColumn = this.getLineMaxColumn(startLineNumber);
if (initialStartColumn >= maxColumn) {
if (startColumn >= maxColumn) {
startColumn = maxColumn;
} else {
startColumn = initialStartColumn | 0;
}
}
}
const initialEndLineNumber = range.endLineNumber;
const initialEndColumn = range.endColumn;
let endLineNumber: number;
let endColumn: number;
let endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);
let endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);
if (initialEndLineNumber < 1) {
if (endLineNumber < 1) {
endLineNumber = 1;
endColumn = 1;
} else if (initialEndLineNumber > linesCount) {
} else if (endLineNumber > linesCount) {
endLineNumber = linesCount;
endColumn = this.getLineMaxColumn(endLineNumber);
} else {
endLineNumber = initialEndLineNumber | 0;
if (initialEndColumn <= 1) {
if (endColumn <= 1) {
endColumn = 1;
} else {
const maxColumn = this.getLineMaxColumn(endLineNumber);
if (initialEndColumn >= maxColumn) {
if (endColumn >= maxColumn) {
endColumn = maxColumn;
} else {
endColumn = initialEndColumn | 0;
}
}
}

View File

@@ -297,11 +297,11 @@ export interface EvaluatableExpressionProvider {
}
/**
* An open ended information bag passed to the inline value provider.
* A minimal context containes just the document location where the debugger has stopped.
* A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
* @internal
*/
export interface InlineValueContext {
frameId: number;
stoppedLocation: Range;
}
@@ -699,8 +699,8 @@ export interface CodeAction {
* @internal
*/
export const enum CodeActionTriggerType {
Auto = 1,
Manual = 2,
Invoke = 1,
Auto = 2,
}
/**
@@ -1683,33 +1683,6 @@ export interface CommentThreadChangedEvent {
readonly changed: CommentThread[];
}
/**
* @internal
*/
export interface IWebviewPortMapping {
webviewPort: number;
extensionHostPort: number;
}
/**
* @internal
*/
export interface IWebviewOptions {
readonly enableScripts?: boolean;
readonly enableCommandUris?: boolean;
readonly localResourceRoots?: ReadonlyArray<UriComponents>;
readonly portMapping?: ReadonlyArray<IWebviewPortMapping>;
}
/**
* @internal
*/
export interface IWebviewPanelOptions {
readonly enableFindWidget?: boolean;
readonly retainContextWhenHidden?: boolean;
}
export interface CodeLens {
range: IRange;
id?: string;

View File

@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { mergeSort } from 'vs/base/common/arrays';
import { stringDiff } from 'vs/base/common/diff/diff';
import { IDisposable } from 'vs/base/common/lifecycle';
import { globals } from 'vs/base/common/platform';
@@ -455,7 +454,7 @@ export class EditorSimpleWorker implements IRequestHandler, IDisposable {
const result: TextEdit[] = [];
let lastEol: EndOfLineSequence | undefined = undefined;
edits = mergeSort(edits, (a, b) => {
edits = edits.slice(0).sort((a, b) => {
if (a.range && b.range) {
return Range.compareRangesUsingStarts(a.range, b.range);
}

View File

@@ -741,6 +741,19 @@ export class ModelSemanticColoring extends Disposable {
this._fetchDocumentSemanticTokens.schedule();
}
}));
this._register(this._model.onDidChangeLanguage(() => {
// clear any outstanding state
if (this._currentDocumentResponse) {
this._currentDocumentResponse.dispose();
this._currentDocumentResponse = null;
}
if (this._currentDocumentRequestCancellationTokenSource) {
this._currentDocumentRequestCancellationTokenSource.cancel();
this._currentDocumentRequestCancellationTokenSource = null;
}
this._setDocumentSemanticTokens(null, null, null, []);
this._fetchDocumentSemanticTokens.schedule(0);
}));
const bindDocumentChangeListeners = () => {
dispose(this._documentProvidersChangeListeners);
this._documentProvidersChangeListeners = [];

View File

@@ -173,126 +173,128 @@ export enum EditorOption {
accessibilityPageSize = 3,
ariaLabel = 4,
autoClosingBrackets = 5,
autoClosingOvertype = 6,
autoClosingQuotes = 7,
autoIndent = 8,
automaticLayout = 9,
autoSurround = 10,
codeLens = 11,
codeLensFontFamily = 12,
codeLensFontSize = 13,
colorDecorators = 14,
columnSelection = 15,
comments = 16,
contextmenu = 17,
copyWithSyntaxHighlighting = 18,
cursorBlinking = 19,
cursorSmoothCaretAnimation = 20,
cursorStyle = 21,
cursorSurroundingLines = 22,
cursorSurroundingLinesStyle = 23,
cursorWidth = 24,
disableLayerHinting = 25,
disableMonospaceOptimizations = 26,
dragAndDrop = 27,
emptySelectionClipboard = 28,
extraEditorClassName = 29,
fastScrollSensitivity = 30,
find = 31,
fixedOverflowWidgets = 32,
folding = 33,
foldingStrategy = 34,
foldingHighlight = 35,
unfoldOnClickAfterEndOfLine = 36,
fontFamily = 37,
fontInfo = 38,
fontLigatures = 39,
fontSize = 40,
fontWeight = 41,
formatOnPaste = 42,
formatOnType = 43,
glyphMargin = 44,
gotoLocation = 45,
hideCursorInOverviewRuler = 46,
highlightActiveIndentGuide = 47,
hover = 48,
inDiffEditor = 49,
letterSpacing = 50,
lightbulb = 51,
lineDecorationsWidth = 52,
lineHeight = 53,
lineNumbers = 54,
lineNumbersMinChars = 55,
linkedEditing = 56,
links = 57,
matchBrackets = 58,
minimap = 59,
mouseStyle = 60,
mouseWheelScrollSensitivity = 61,
mouseWheelZoom = 62,
multiCursorMergeOverlapping = 63,
multiCursorModifier = 64,
multiCursorPaste = 65,
occurrencesHighlight = 66,
overviewRulerBorder = 67,
overviewRulerLanes = 68,
padding = 69,
parameterHints = 70,
peekWidgetDefaultFocus = 71,
definitionLinkOpensInPeek = 72,
quickSuggestions = 73,
quickSuggestionsDelay = 74,
readOnly = 75,
renameOnType = 76,
renderControlCharacters = 77,
renderIndentGuides = 78,
renderFinalNewline = 79,
renderLineHighlight = 80,
renderLineHighlightOnlyWhenFocus = 81,
renderValidationDecorations = 82,
renderWhitespace = 83,
revealHorizontalRightPadding = 84,
roundedSelection = 85,
rulers = 86,
scrollbar = 87,
scrollBeyondLastColumn = 88,
scrollBeyondLastLine = 89,
scrollPredominantAxis = 90,
selectionClipboard = 91,
selectionHighlight = 92,
selectOnLineNumbers = 93,
showFoldingControls = 94,
showUnused = 95,
snippetSuggestions = 96,
smartSelect = 97,
smoothScrolling = 98,
stickyTabStops = 99,
stopRenderingLineAfter = 100,
suggest = 101,
suggestFontSize = 102,
suggestLineHeight = 103,
suggestOnTriggerCharacters = 104,
suggestSelection = 105,
tabCompletion = 106,
tabIndex = 107,
unusualLineTerminators = 108,
useTabStops = 109,
wordSeparators = 110,
wordWrap = 111,
wordWrapBreakAfterCharacters = 112,
wordWrapBreakBeforeCharacters = 113,
wordWrapColumn = 114,
wordWrapOverride1 = 115,
wordWrapOverride2 = 116,
wrappingIndent = 117,
wrappingStrategy = 118,
showDeprecated = 119,
inlineHints = 120,
editorClassName = 121,
pixelRatio = 122,
tabFocusMode = 123,
layoutInfo = 124,
wrappingInfo = 125
autoClosingDelete = 6,
autoClosingOvertype = 7,
autoClosingQuotes = 8,
autoIndent = 9,
automaticLayout = 10,
autoSurround = 11,
codeLens = 12,
codeLensFontFamily = 13,
codeLensFontSize = 14,
colorDecorators = 15,
columnSelection = 16,
comments = 17,
contextmenu = 18,
copyWithSyntaxHighlighting = 19,
cursorBlinking = 20,
cursorSmoothCaretAnimation = 21,
cursorStyle = 22,
cursorSurroundingLines = 23,
cursorSurroundingLinesStyle = 24,
cursorWidth = 25,
disableLayerHinting = 26,
disableMonospaceOptimizations = 27,
domReadOnly = 28,
dragAndDrop = 29,
emptySelectionClipboard = 30,
extraEditorClassName = 31,
fastScrollSensitivity = 32,
find = 33,
fixedOverflowWidgets = 34,
folding = 35,
foldingStrategy = 36,
foldingHighlight = 37,
unfoldOnClickAfterEndOfLine = 38,
fontFamily = 39,
fontInfo = 40,
fontLigatures = 41,
fontSize = 42,
fontWeight = 43,
formatOnPaste = 44,
formatOnType = 45,
glyphMargin = 46,
gotoLocation = 47,
hideCursorInOverviewRuler = 48,
highlightActiveIndentGuide = 49,
hover = 50,
inDiffEditor = 51,
letterSpacing = 52,
lightbulb = 53,
lineDecorationsWidth = 54,
lineHeight = 55,
lineNumbers = 56,
lineNumbersMinChars = 57,
linkedEditing = 58,
links = 59,
matchBrackets = 60,
minimap = 61,
mouseStyle = 62,
mouseWheelScrollSensitivity = 63,
mouseWheelZoom = 64,
multiCursorMergeOverlapping = 65,
multiCursorModifier = 66,
multiCursorPaste = 67,
occurrencesHighlight = 68,
overviewRulerBorder = 69,
overviewRulerLanes = 70,
padding = 71,
parameterHints = 72,
peekWidgetDefaultFocus = 73,
definitionLinkOpensInPeek = 74,
quickSuggestions = 75,
quickSuggestionsDelay = 76,
readOnly = 77,
renameOnType = 78,
renderControlCharacters = 79,
renderIndentGuides = 80,
renderFinalNewline = 81,
renderLineHighlight = 82,
renderLineHighlightOnlyWhenFocus = 83,
renderValidationDecorations = 84,
renderWhitespace = 85,
revealHorizontalRightPadding = 86,
roundedSelection = 87,
rulers = 88,
scrollbar = 89,
scrollBeyondLastColumn = 90,
scrollBeyondLastLine = 91,
scrollPredominantAxis = 92,
selectionClipboard = 93,
selectionHighlight = 94,
selectOnLineNumbers = 95,
showFoldingControls = 96,
showUnused = 97,
snippetSuggestions = 98,
smartSelect = 99,
smoothScrolling = 100,
stickyTabStops = 101,
stopRenderingLineAfter = 102,
suggest = 103,
suggestFontSize = 104,
suggestLineHeight = 105,
suggestOnTriggerCharacters = 106,
suggestSelection = 107,
tabCompletion = 108,
tabIndex = 109,
unusualLineTerminators = 110,
useTabStops = 111,
wordSeparators = 112,
wordWrap = 113,
wordWrapBreakAfterCharacters = 114,
wordWrapBreakBeforeCharacters = 115,
wordWrapColumn = 116,
wordWrapOverride1 = 117,
wordWrapOverride2 = 118,
wrappingIndent = 119,
wrappingStrategy = 120,
showDeprecated = 121,
inlineHints = 122,
editorClassName = 123,
pixelRatio = 124,
tabFocusMode = 125,
layoutInfo = 126,
wrappingInfo = 127
}
/**

View File

@@ -346,38 +346,48 @@ export class RenderLineOutput {
export function renderViewLine(input: RenderLineInput, sb: IStringBuilder): RenderLineOutput {
if (input.lineContent.length === 0) {
let containsForeignElements = ForeignElementType.None;
let content: string = '<span><span></span></span>';
if (input.lineDecorations.length > 0) {
// This line is empty, but it contains inline decorations
const beforeClassNames: string[] = [];
const afterClassNames: string[] = [];
for (let i = 0, len = input.lineDecorations.length; i < len; i++) {
const lineDecoration = input.lineDecorations[i];
if (lineDecoration.type === InlineDecorationType.Before) {
beforeClassNames.push(input.lineDecorations[i].className);
containsForeignElements |= ForeignElementType.Before;
}
if (lineDecoration.type === InlineDecorationType.After) {
afterClassNames.push(input.lineDecorations[i].className);
containsForeignElements |= ForeignElementType.After;
sb.appendASCIIString(`<span>`);
let beforeCount = 0;
let afterCount = 0;
let containsForeignElements = ForeignElementType.None;
for (const lineDecoration of input.lineDecorations) {
if (lineDecoration.type === InlineDecorationType.Before || lineDecoration.type === InlineDecorationType.After) {
sb.appendASCIIString(`<span class="`);
sb.appendASCIIString(lineDecoration.className);
sb.appendASCIIString(`"></span>`);
if (lineDecoration.type === InlineDecorationType.Before) {
containsForeignElements |= ForeignElementType.Before;
beforeCount++;
}
if (lineDecoration.type === InlineDecorationType.After) {
containsForeignElements |= ForeignElementType.After;
afterCount++;
}
}
}
if (containsForeignElements !== ForeignElementType.None) {
const beforeSpan = (beforeClassNames.length > 0 ? `<span class="${beforeClassNames.join(' ')}"></span>` : ``);
const afterSpan = (afterClassNames.length > 0 ? `<span class="${afterClassNames.join(' ')}"></span>` : ``);
content = `<span>${beforeSpan}${afterSpan}</span>`;
}
sb.appendASCIIString(`</span>`);
const characterMapping = new CharacterMapping(1, beforeCount + afterCount);
characterMapping.setPartData(0, beforeCount, 0, 0);
return new RenderLineOutput(
characterMapping,
false,
containsForeignElements
);
}
sb.appendASCIIString(content);
// completely empty line
sb.appendASCIIString('<span><span></span></span>');
return new RenderLineOutput(
new CharacterMapping(0, 0),
false,
containsForeignElements
ForeignElementType.None
);
}
@@ -943,7 +953,12 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render
break;
case CharCode.Null:
sb.appendASCIIString('&#00;');
if (renderControlCharacters) {
// See https://unicode-table.com/en/blocks/control-pictures/
sb.write1(9216);
} else {
sb.appendASCIIString('&#00;');
}
break;
case CharCode.UTF8_BOM:
@@ -957,8 +972,12 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render
if (strings.isFullWidthCharacter(charCode)) {
charWidth++;
}
// See https://unicode-table.com/en/blocks/control-pictures/
if (renderControlCharacters && charCode < 32) {
sb.write1(9216 + charCode);
} else if (renderControlCharacters && charCode === 127) {
// DEL
sb.write1(9249);
} else {
sb.write1(charCode);
}

View File

@@ -213,6 +213,7 @@ export interface IViewModel extends ICursorSimpleModel {
getCursorStates(): CursorState[];
setCursorStates(source: string | null | undefined, reason: CursorChangeReason, states: PartialCursorState[] | null): void;
getCursorColumnSelectData(): IColumnSelectData;
getCursorAutoClosedCharacters(): Range[];
setCursorColumnSelectData(columnSelectData: IColumnSelectData): void;
getPrevEditOperationType(): EditOperationType;
setPrevEditOperationType(type: EditOperationType): void;

View File

@@ -898,6 +898,9 @@ export class ViewModel extends Disposable implements IViewModel {
public getCursorColumnSelectData(): IColumnSelectData {
return this._cursor.getCursorColumnSelectData();
}
public getCursorAutoClosedCharacters(): Range[] {
return this._cursor.getAutoClosedCharacters();
}
public setCursorColumnSelectData(columnSelectData: IColumnSelectData): void {
this._cursor.setCursorColumnSelectData(columnSelectData);
}