Merge branch 'main' into merogge/ibe

This commit is contained in:
Megan Rogge 2023-05-31 11:06:04 -05:00 committed by GitHub
commit 48f46820b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 26 deletions

View file

@ -8,6 +8,7 @@ import { StringBuilder } from 'vs/editor/common/core/stringBuilder';
import * as viewEvents from 'vs/editor/common/viewEvents';
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { BugIndicatingError } from 'vs/base/common/errors';
/**
* Represents a visible line
@ -80,7 +81,7 @@ export class RenderedLinesCollection<T extends ILine> {
public getLine(lineNumber: number): T {
const lineIndex = lineNumber - this._rendLineNumberStart;
if (lineIndex < 0 || lineIndex >= this._lines.length) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._lines[lineIndex];
}

View file

@ -5093,7 +5093,7 @@ export const EditorOptions = {
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
)),
screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', false,
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', true,
{
description: nls.localize('screenReaderAnnounceInlineSuggestion', "Control whether inline suggestions are announced by a screen reader."),
tags: ['accessibility']

View file

@ -13,6 +13,7 @@ import { TextModelPart } from 'vs/editor/common/model/textModelPart';
import { computeIndentLevel } from 'vs/editor/common/model/utils';
import { ILanguageConfigurationService, ResolvedLanguageConfiguration } from 'vs/editor/common/languages/languageConfigurationRegistry';
import { BracketGuideOptions, HorizontalGuidesState, IActiveIndentGuideInfo, IGuidesTextModelPart, IndentGuide, IndentGuideHorizontalLine } from 'vs/editor/common/textModelGuides';
import { BugIndicatingError } from 'vs/base/common/errors';
export class GuidesTextModelPart extends TextModelPart implements IGuidesTextModelPart {
constructor(
@ -46,7 +47,7 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod
const lineCount = this.textModel.getLineCount();
if (lineNumber < 1 || lineNumber > lineCount) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
const foldingRules = this.getLanguageConfiguration(

View file

@ -6,7 +6,7 @@
import { ArrayQueue, pushMany } from 'vs/base/common/arrays';
import { VSBuffer, VSBufferReadableStream } from 'vs/base/common/buffer';
import { Color } from 'vs/base/common/color';
import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
import { BugIndicatingError, illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { IMarkdownString } from 'vs/base/common/htmlContent';
import { combinedDisposable, Disposable, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
@ -792,7 +792,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getLineContent(lineNumber: number): string {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._buffer.getLineContent(lineNumber);
@ -801,7 +801,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getLineLength(lineNumber: number): number {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._buffer.getLineLength(lineNumber);
@ -834,7 +834,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getLineMaxColumn(lineNumber: number): number {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._buffer.getLineLength(lineNumber) + 1;
}
@ -842,7 +842,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getLineFirstNonWhitespaceColumn(lineNumber: number): number {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);
}
@ -850,7 +850,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getLineLastNonWhitespaceColumn(lineNumber: number): number {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
throw new BugIndicatingError('Illegal value for lineNumber');
}
return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);
}

View file

@ -544,7 +544,7 @@ class GrammarTokens extends Disposable {
return;
}
startLineNumber = Math.max(1, startLineNumber);
startLineNumber = Math.max(1, Math.min(this._textModel.getLineCount(), startLineNumber));
endLineNumber = Math.min(this._textModel.getLineCount(), endLineNumber);
const builder = new ContiguousMultilineTokensBuilder();

View file

@ -151,16 +151,24 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
this._register(disposableTimeout(() => this.promptRecommendations(uri, model), 0));
}
private promptRecommendations(uri: URI, model: ITextModel): void {
if (this.promptImportantRecommendations(uri, model)) {
return;
}
this.promptRecommendedExtensionForFileExtension(uri, extname(uri).toLowerCase());
}
/**
* Prompt the user to either install the recommended extension for the file type in the current editor model
* or prompt to search the marketplace if it has extensions that can support the file type
*/
private promptRecommendations(uri: URI, model: ITextModel, extensionRecommendations?: IStringDictionary<IFileOpenCondition[]>): void {
private promptImportantRecommendations(uri: URI, model: ITextModel, extensionRecommendations?: IStringDictionary<IFileOpenCondition[]>): boolean {
const pattern = extname(uri).toLowerCase();
extensionRecommendations = extensionRecommendations ?? this.recommendationsByPattern.get(pattern) ?? this.fileOpenRecommendations;
const extensionRecommendationEntries = Object.entries(extensionRecommendations);
if (extensionRecommendationEntries.length === 0) {
return;
return false;
}
const processedPathGlobs = new Map<string, boolean>();
@ -246,10 +254,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
}
}
if (Object.keys(matchedRecommendations).length) {
this.promptFromRecommendations(uri, model, matchedRecommendations);
}
this.recommendationsByPattern.set(pattern, recommendationsByPattern);
if (Object.keys(unmatchedRecommendations).length) {
if (listenOnLanguageChange) {
@ -258,7 +262,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
// re-schedule this bit of the operation to be off the critical path - in case glob-match is slow
disposables.add(disposableTimeout(() => {
if (!disposables.isDisposed) {
this.promptRecommendations(uri, model, unmatchedRecommendations);
this.promptImportantRecommendations(uri, model, unmatchedRecommendations);
disposables.dispose();
}
}, 0));
@ -266,6 +270,13 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
disposables.add(model.onWillDispose(() => disposables.dispose()));
}
}
if (Object.keys(matchedRecommendations).length) {
this.promptFromRecommendations(uri, model, matchedRecommendations);
return true;
}
return false;
}
private promptFromRecommendations(uri: URI, model: ITextModel, extensionRecommendations: IStringDictionary<IFileOpenCondition[]>): void {
@ -304,8 +315,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
this.promptRecommendedExtensionForFileType(languageName && isImportantRecommendationForLanguage && language !== PLAINTEXT_LANGUAGE_ID ? localize('languageName', "{0} language", languageName) : basename(uri), language, [...importantRecommendations])) {
return;
}
this.promptRecommendedExtensionForFileExtension(uri, extname(uri).toLowerCase());
}
private promptRecommendedExtensionForFileType(name: string, language: string, recommendations: string[]): boolean {

View file

@ -3,8 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .zone-widget.interactive-editor-widget {
z-index: 3;
}
.monaco-editor .interactive-editor {
z-index: 100;
color: inherit;
padding: 6px;
border-radius: 6px;
@ -181,6 +184,7 @@
background-color: var(--vscode-button-background);
border-radius: 2px;
padding: 4px 6px;
line-height: 18px;
}
.monaco-editor .interactive-editor .status .monaco-toolbar .action-item.button-item .action-label>.codicon {

View file

@ -1394,12 +1394,6 @@ const getActionableElementActions = (
], [
TestingContextKeys.supportsContinuousRun.key,
supportsCr,
], [
TestingContextKeys.controllerId.key,
test.controllerId,
], [
TestingContextKeys.testItemExtId.key,
test.item.extId,
]);
}