Skip to content

Commit 48f4682

Browse files
authored
Merge branch 'main' into merogge/ibe
2 parents 5ff3aa8 + b9a77b3 commit 48f4682

File tree

8 files changed

+35
-26
lines changed

8 files changed

+35
-26
lines changed

src/vs/editor/browser/view/viewLayer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { StringBuilder } from 'vs/editor/common/core/stringBuilder';
88
import * as viewEvents from 'vs/editor/common/viewEvents';
99
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
1010
import { EditorOption } from 'vs/editor/common/config/editorOptions';
11+
import { BugIndicatingError } from 'vs/base/common/errors';
1112

1213
/**
1314
* Represents a visible line
@@ -80,7 +81,7 @@ export class RenderedLinesCollection<T extends ILine> {
8081
public getLine(lineNumber: number): T {
8182
const lineIndex = lineNumber - this._rendLineNumberStart;
8283
if (lineIndex < 0 || lineIndex >= this._lines.length) {
83-
throw new Error('Illegal value for lineNumber');
84+
throw new BugIndicatingError('Illegal value for lineNumber');
8485
}
8586
return this._lines[lineIndex];
8687
}

src/vs/editor/common/config/editorOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5093,7 +5093,7 @@ export const EditorOptions = {
50935093
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
50945094
)),
50955095
screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(
5096-
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', false,
5096+
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', true,
50975097
{
50985098
description: nls.localize('screenReaderAnnounceInlineSuggestion', "Control whether inline suggestions are announced by a screen reader."),
50995099
tags: ['accessibility']

src/vs/editor/common/model/guidesTextModelPart.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { TextModelPart } from 'vs/editor/common/model/textModelPart';
1313
import { computeIndentLevel } from 'vs/editor/common/model/utils';
1414
import { ILanguageConfigurationService, ResolvedLanguageConfiguration } from 'vs/editor/common/languages/languageConfigurationRegistry';
1515
import { BracketGuideOptions, HorizontalGuidesState, IActiveIndentGuideInfo, IGuidesTextModelPart, IndentGuide, IndentGuideHorizontalLine } from 'vs/editor/common/textModelGuides';
16+
import { BugIndicatingError } from 'vs/base/common/errors';
1617

1718
export class GuidesTextModelPart extends TextModelPart implements IGuidesTextModelPart {
1819
constructor(
@@ -46,7 +47,7 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod
4647
const lineCount = this.textModel.getLineCount();
4748

4849
if (lineNumber < 1 || lineNumber > lineCount) {
49-
throw new Error('Illegal value for lineNumber');
50+
throw new BugIndicatingError('Illegal value for lineNumber');
5051
}
5152

5253
const foldingRules = this.getLanguageConfiguration(

src/vs/editor/common/model/textModel.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { ArrayQueue, pushMany } from 'vs/base/common/arrays';
77
import { VSBuffer, VSBufferReadableStream } from 'vs/base/common/buffer';
88
import { Color } from 'vs/base/common/color';
9-
import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
9+
import { BugIndicatingError, illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
1010
import { Emitter, Event } from 'vs/base/common/event';
1111
import { IMarkdownString } from 'vs/base/common/htmlContent';
1212
import { combinedDisposable, Disposable, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
@@ -792,7 +792,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
792792
public getLineContent(lineNumber: number): string {
793793
this._assertNotDisposed();
794794
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
795-
throw new Error('Illegal value for lineNumber');
795+
throw new BugIndicatingError('Illegal value for lineNumber');
796796
}
797797

798798
return this._buffer.getLineContent(lineNumber);
@@ -801,7 +801,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
801801
public getLineLength(lineNumber: number): number {
802802
this._assertNotDisposed();
803803
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
804-
throw new Error('Illegal value for lineNumber');
804+
throw new BugIndicatingError('Illegal value for lineNumber');
805805
}
806806

807807
return this._buffer.getLineLength(lineNumber);
@@ -834,23 +834,23 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
834834
public getLineMaxColumn(lineNumber: number): number {
835835
this._assertNotDisposed();
836836
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
837-
throw new Error('Illegal value for lineNumber');
837+
throw new BugIndicatingError('Illegal value for lineNumber');
838838
}
839839
return this._buffer.getLineLength(lineNumber) + 1;
840840
}
841841

842842
public getLineFirstNonWhitespaceColumn(lineNumber: number): number {
843843
this._assertNotDisposed();
844844
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
845-
throw new Error('Illegal value for lineNumber');
845+
throw new BugIndicatingError('Illegal value for lineNumber');
846846
}
847847
return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);
848848
}
849849

850850
public getLineLastNonWhitespaceColumn(lineNumber: number): number {
851851
this._assertNotDisposed();
852852
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
853-
throw new Error('Illegal value for lineNumber');
853+
throw new BugIndicatingError('Illegal value for lineNumber');
854854
}
855855
return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);
856856
}

src/vs/editor/common/model/tokenizationTextModelPart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class GrammarTokens extends Disposable {
544544
return;
545545
}
546546

547-
startLineNumber = Math.max(1, startLineNumber);
547+
startLineNumber = Math.max(1, Math.min(this._textModel.getLineCount(), startLineNumber));
548548
endLineNumber = Math.min(this._textModel.getLineCount(), endLineNumber);
549549

550550
const builder = new ContiguousMultilineTokensBuilder();

src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,24 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
151151
this._register(disposableTimeout(() => this.promptRecommendations(uri, model), 0));
152152
}
153153

154+
private promptRecommendations(uri: URI, model: ITextModel): void {
155+
if (this.promptImportantRecommendations(uri, model)) {
156+
return;
157+
}
158+
159+
this.promptRecommendedExtensionForFileExtension(uri, extname(uri).toLowerCase());
160+
}
161+
154162
/**
155163
* Prompt the user to either install the recommended extension for the file type in the current editor model
156164
* or prompt to search the marketplace if it has extensions that can support the file type
157165
*/
158-
private promptRecommendations(uri: URI, model: ITextModel, extensionRecommendations?: IStringDictionary<IFileOpenCondition[]>): void {
166+
private promptImportantRecommendations(uri: URI, model: ITextModel, extensionRecommendations?: IStringDictionary<IFileOpenCondition[]>): boolean {
159167
const pattern = extname(uri).toLowerCase();
160168
extensionRecommendations = extensionRecommendations ?? this.recommendationsByPattern.get(pattern) ?? this.fileOpenRecommendations;
161169
const extensionRecommendationEntries = Object.entries(extensionRecommendations);
162170
if (extensionRecommendationEntries.length === 0) {
163-
return;
171+
return false;
164172
}
165173

166174
const processedPathGlobs = new Map<string, boolean>();
@@ -246,10 +254,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
246254
}
247255
}
248256

249-
if (Object.keys(matchedRecommendations).length) {
250-
this.promptFromRecommendations(uri, model, matchedRecommendations);
251-
}
252-
253257
this.recommendationsByPattern.set(pattern, recommendationsByPattern);
254258
if (Object.keys(unmatchedRecommendations).length) {
255259
if (listenOnLanguageChange) {
@@ -258,14 +262,21 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
258262
// re-schedule this bit of the operation to be off the critical path - in case glob-match is slow
259263
disposables.add(disposableTimeout(() => {
260264
if (!disposables.isDisposed) {
261-
this.promptRecommendations(uri, model, unmatchedRecommendations);
265+
this.promptImportantRecommendations(uri, model, unmatchedRecommendations);
262266
disposables.dispose();
263267
}
264268
}, 0));
265269
}));
266270
disposables.add(model.onWillDispose(() => disposables.dispose()));
267271
}
268272
}
273+
274+
if (Object.keys(matchedRecommendations).length) {
275+
this.promptFromRecommendations(uri, model, matchedRecommendations);
276+
return true;
277+
}
278+
279+
return false;
269280
}
270281

271282
private promptFromRecommendations(uri: URI, model: ITextModel, extensionRecommendations: IStringDictionary<IFileOpenCondition[]>): void {
@@ -304,8 +315,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
304315
this.promptRecommendedExtensionForFileType(languageName && isImportantRecommendationForLanguage && language !== PLAINTEXT_LANGUAGE_ID ? localize('languageName', "{0} language", languageName) : basename(uri), language, [...importantRecommendations])) {
305316
return;
306317
}
307-
308-
this.promptRecommendedExtensionForFileExtension(uri, extname(uri).toLowerCase());
309318
}
310319

311320
private promptRecommendedExtensionForFileType(name: string, language: string, recommendations: string[]): boolean {

src/vs/workbench/contrib/interactiveEditor/browser/interactiveEditor.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
.monaco-editor .zone-widget.interactive-editor-widget {
7+
z-index: 3;
8+
}
9+
610
.monaco-editor .interactive-editor {
7-
z-index: 100;
811
color: inherit;
912
padding: 6px;
1013
border-radius: 6px;
@@ -181,6 +184,7 @@
181184
background-color: var(--vscode-button-background);
182185
border-radius: 2px;
183186
padding: 4px 6px;
187+
line-height: 18px;
184188
}
185189

186190
.monaco-editor .interactive-editor .status .monaco-toolbar .action-item.button-item .action-label>.codicon {

src/vs/workbench/contrib/testing/browser/testingExplorerView.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,6 @@ const getActionableElementActions = (
13941394
], [
13951395
TestingContextKeys.supportsContinuousRun.key,
13961396
supportsCr,
1397-
], [
1398-
TestingContextKeys.controllerId.key,
1399-
test.controllerId,
1400-
], [
1401-
TestingContextKeys.testItemExtId.key,
1402-
test.item.extId,
14031397
]);
14041398
}
14051399

0 commit comments

Comments
 (0)