Merge branch 'main' into joh/webpack5

This commit is contained in:
Johannes Rieken 2021-07-02 15:02:12 +02:00
commit 3406031e37
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
142 changed files with 871 additions and 599 deletions

View file

@ -32,7 +32,7 @@
{
"kind": 2,
"language": "github-issues",
"value": "$repos $milestone is:closed -assignee:@me label:bug -label:verified -label:*duplicate -author:@me -assignee:@me label:bug -label:verified -author:@me -author:aeschli -author:alexdima -author:alexr00 -author:bpasero -author:chrisdias -author:chrmarti -author:connor4312 -author:dbaeumer -author:deepak1556 -author:eamodio -author:egamma -author:gregvanl -author:isidorn -author:JacksonKearl -author:joaomoreno -author:jrieken -author:lramos15 -author:lszomoru -author:meganrogge -author:misolori -author:mjbvz -author:rebornix -author:RMacfarlane -author:roblourens -author:sana-ajani -author:sandy081 -author:sbatten -author:Tyriar -author:weinand -author:rzhao271 -author:kieferrm -author:TylerLeonhardt -author:bamurtaugh"
"value": "$repos $milestone is:closed -assignee:@me label:bug -label:verified -label:*duplicate -author:@me -assignee:@me label:bug -label:verified -author:@me -author:aeschli -author:alexdima -author:alexr00 -author:bpasero -author:chrisdias -author:chrmarti -author:connor4312 -author:dbaeumer -author:deepak1556 -author:eamodio -author:egamma -author:gregvanl -author:isidorn -author:JacksonKearl -author:joaomoreno -author:jrieken -author:lramos15 -author:lszomoru -author:meganrogge -author:misolori -author:mjbvz -author:rebornix -author:RMacfarlane -author:roblourens -author:sana-ajani -author:sandy081 -author:sbatten -author:Tyriar -author:weinand -author:rzhao271 -author:kieferrm -author:TylerLeonhardt -author:bamurtaugh -author:hediet -author:joyceerhl -author:rchiodo -author:IanMatthewHuff"
},
{
"kind": 1,

View file

@ -52,6 +52,7 @@ steps:
- publish: $(Pipeline.Workspace)/artifacts_processed_$(System.StageAttempt)/artifacts_processed_$(System.StageAttempt).txt
artifact: artifacts_processed_$(System.StageAttempt)
displayName: Publish what artifacts were published for this stage attempt
condition: always()
- pwsh: |
$ErrorActionPreference = 'Stop'

View file

@ -1,3 +1,5 @@
# Markdown Math support
# Markdown Math
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Adds math rendering using [KaTeX](https://katex.org) to VS Code's built-in markdown preview and markdown cells in notebooks.

View file

@ -1,6 +1,6 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown - (comment, string, meta.paragraph.markdown, markup.math.block.markdown)",
"injectionSelector": "L:text.html.markdown - (comment, string, meta.paragraph.markdown, markup.math.block.markdown, markup.fenced_code.block.markdown)",
"patterns": [
{
"include": "#math_block"

View file

@ -1,6 +1,6 @@
{
"fileTypes": [],
"injectionSelector": "L:meta.paragraph.markdown - (comment, string, markup.math.inline.markdown)",
"injectionSelector": "L:meta.paragraph.markdown - (comment, string, markup.math.inline.markdown, markup.fenced_code.block.markdown)",
"patterns": [
{
"include": "#math_inline"

View file

@ -4,7 +4,7 @@
"license": "MIT",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "4.3.4"
"typescript": "4.3.5"
},
"scripts": {
"postinstall": "node ./postinstall"

View file

@ -1,3 +1,6 @@
# Simple Browser files
# Simple Browser
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Provides a very basic browser preview using an iframe embedded in a [webview](). This extension is primarily meant to be used by other extensions for showing simple web content.

View file

@ -659,7 +659,7 @@ namespace CompletionConfiguration {
pathSuggestions: config.get<boolean>(CompletionConfiguration.pathSuggestions, true),
autoImportSuggestions: config.get<boolean>(CompletionConfiguration.autoImportSuggestions, true),
nameSuggestions: config.get<boolean>(CompletionConfiguration.nameSuggestions, true),
importStatementSuggestions: config.get<boolean>(CompletionConfiguration.nameSuggestions, true),
importStatementSuggestions: config.get<boolean>(CompletionConfiguration.importStatementSuggestions, true),
};
}
}

View file

@ -62,3 +62,15 @@ $$
\theta % comment
$$
-->
Should be disabled in fenced code blocks:
```txt
$$
\displaystyle
\left( \sum_{k=1}^n a_k b_k \right)^2
\leq
\left( \sum_{k=1}^n a_k^2 \right)
\left( \sum_{k=1}^n b_k^2 \right)
$$
```

View file

@ -3782,5 +3782,126 @@
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "Should be disabled in fenced code blocks:",
"t": "text.html.markdown meta.paragraph.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "```",
"t": "text.html.markdown markup.fenced_code.block.markdown punctuation.definition.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "txt",
"t": "text.html.markdown markup.fenced_code.block.markdown fenced_code.block.language",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$$",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\displaystyle",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\left( \\sum_{k=1}^n a_k b_k \\right)^2",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\leq",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\left( \\sum_{k=1}^n a_k^2 \\right)",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "\\left( \\sum_{k=1}^n b_k^2 \\right)",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "$$",
"t": "text.html.markdown markup.fenced_code.block.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "```",
"t": "text.html.markdown markup.fenced_code.block.markdown punctuation.definition.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
}
]

View file

@ -24,10 +24,10 @@ fast-plist@0.1.2:
resolved "https://registry.yarnpkg.com/fast-plist/-/fast-plist-0.1.2.tgz#a45aff345196006d406ca6cdcd05f69051ef35b8"
integrity sha1-pFr/NFGWAG1AbKbNzQX2kFHvNbg=
typescript@4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc"
integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==
typescript@4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
vscode-grammar-updater@^1.0.3:
version "1.0.3"

View file

@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.58.0",
"distro": "1afd5b4f39a7a5d420ea4906f5a35f009e2b377c",
"version": "1.59.0",
"distro": "3f0c5cff831c38cf9ef32ba2480a027e14c179e8",
"author": {
"name": "Microsoft Corporation"
},

View file

@ -94,7 +94,7 @@
},
{
"name": "ms-vscode.js-debug",
"version": "1.58.1",
"version": "1.58.2",
"repo": "https://github.com/microsoft/vscode-js-debug",
"metadata": {
"id": "25629058-ddac-4e17-abba-74678e126c5d",

View file

@ -48,7 +48,7 @@ export abstract class AbstractScrollbar extends Widget {
protected _scrollByPage: boolean;
private _lazyRender: boolean;
protected _scrollbarState: ScrollbarState;
private _visibilityController: ScrollbarVisibilityController;
protected _visibilityController: ScrollbarVisibilityController;
private _mouseMoveMonitor: GlobalMouseMoveMonitor<IStandardMouseMoveEventData>;
public domNode: FastDomNode<HTMLElement>;

View file

@ -107,4 +107,11 @@ export class HorizontalScrollbar extends AbstractScrollbar {
public writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {
target.scrollLeft = scrollPosition;
}
public updateOptions(options: ScrollableElementResolvedOptions): void {
this.updateScrollbarSize(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize);
this._scrollbarState.setOppositeScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);
this._visibilityController.setVisibility(options.horizontal);
this._scrollByPage = options.scrollByPage;
}
}

View file

@ -288,8 +288,6 @@ export abstract class AbstractScrollableElement extends Widget {
/**
* Update configuration options for the scrollbar.
* Really this is Editor.IEditorScrollbarOptions, but base shouldn't
* depend on Editor.
*/
public updateOptions(newOptions: ScrollableElementChangeOptions): void {
if (typeof newOptions.handleMouseWheel !== 'undefined') {
@ -305,9 +303,23 @@ export abstract class AbstractScrollableElement extends Widget {
if (typeof newOptions.scrollPredominantAxis !== 'undefined') {
this._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;
}
if (typeof newOptions.horizontalScrollbarSize !== 'undefined') {
this._horizontalScrollbar.updateScrollbarSize(newOptions.horizontalScrollbarSize);
if (typeof newOptions.horizontal !== 'undefined') {
this._options.horizontal = newOptions.horizontal;
}
if (typeof newOptions.vertical !== 'undefined') {
this._options.vertical = newOptions.vertical;
}
if (typeof newOptions.horizontalScrollbarSize !== 'undefined') {
this._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;
}
if (typeof newOptions.verticalScrollbarSize !== 'undefined') {
this._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;
}
if (typeof newOptions.scrollByPage !== 'undefined') {
this._options.scrollByPage = newOptions.scrollByPage;
}
this._horizontalScrollbar.updateOptions(this._options);
this._verticalScrollbar.updateOptions(this._options);
if (!this._options.lazyRender) {
this._render();

View file

@ -131,7 +131,11 @@ export interface ScrollableElementChangeOptions {
mouseWheelScrollSensitivity?: number;
fastScrollSensitivity?: number;
scrollPredominantAxis?: boolean;
horizontal?: ScrollbarVisibility;
horizontalScrollbarSize?: number;
vertical?: ScrollbarVisibility;
verticalScrollbarSize?: number;
scrollByPage?: boolean;
}
export interface ScrollableElementResolvedOptions {

View file

@ -20,7 +20,7 @@ export class ScrollbarState {
* For the vertical scrollbar: the height of the pair horizontal scrollbar.
* For the horizontal scrollbar: the width of the pair vertical scrollbar.
*/
private readonly _oppositeScrollbarSize: number;
private _oppositeScrollbarSize: number;
/**
* For the vertical scrollbar: the height of the scrollbar's arrows.
@ -115,7 +115,11 @@ export class ScrollbarState {
}
public setScrollbarSize(scrollbarSize: number): void {
this._scrollbarSize = scrollbarSize;
this._scrollbarSize = Math.round(scrollbarSize);
}
public setOppositeScrollbarSize(oppositeScrollbarSize: number): void {
this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);
}
private static _computeValues(oppositeScrollbarSize: number, arrowSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {

View file

@ -13,6 +13,7 @@ export class ScrollbarVisibilityController extends Disposable {
private _visibleClassName: string;
private _invisibleClassName: string;
private _domNode: FastDomNode<HTMLElement> | null;
private _rawShouldBeVisible: boolean;
private _shouldBeVisible: boolean;
private _isNeeded: boolean;
private _isVisible: boolean;
@ -26,24 +27,37 @@ export class ScrollbarVisibilityController extends Disposable {
this._domNode = null;
this._isVisible = false;
this._isNeeded = false;
this._rawShouldBeVisible = false;
this._shouldBeVisible = false;
this._revealTimer = this._register(new TimeoutTimer());
}
public setVisibility(visibility: ScrollbarVisibility): void {
if (this._visibility !== visibility) {
this._visibility = visibility;
this._updateShouldBeVisible();
}
}
// ----------------- Hide / Reveal
private applyVisibilitySetting(shouldBeVisible: boolean): boolean {
public setShouldBeVisible(rawShouldBeVisible: boolean): void {
this._rawShouldBeVisible = rawShouldBeVisible;
this._updateShouldBeVisible();
}
private _applyVisibilitySetting(): boolean {
if (this._visibility === ScrollbarVisibility.Hidden) {
return false;
}
if (this._visibility === ScrollbarVisibility.Visible) {
return true;
}
return shouldBeVisible;
return this._rawShouldBeVisible;
}
public setShouldBeVisible(rawShouldBeVisible: boolean): void {
const shouldBeVisible = this.applyVisibilitySetting(rawShouldBeVisible);
private _updateShouldBeVisible(): void {
const shouldBeVisible = this._applyVisibilitySetting();
if (this._shouldBeVisible !== shouldBeVisible) {
this._shouldBeVisible = shouldBeVisible;

View file

@ -107,4 +107,13 @@ export class VerticalScrollbar extends AbstractScrollbar {
public writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {
target.scrollTop = scrollPosition;
}
public updateOptions(options: ScrollableElementResolvedOptions): void {
this.updateScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);
// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom
this._scrollbarState.setOppositeScrollbarSize(0);
this._visibilityController.setVisibility(options.vertical);
this._scrollByPage = options.scrollByPage;
}
}

View file

@ -881,10 +881,6 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
asyncDataTreeNode.children.forEach(node => dfs(node, node => this.nodes.delete(node.element as T)));
asyncDataTreeNode.children.splice(0, asyncDataTreeNode.children.length);
asyncDataTreeNode.stale = true;
if (this.collapseByDefault && !this.collapseByDefault(element)) {
asyncDataTreeNode.collapsedByDefault = false;
childrenToRefresh.push(asyncDataTreeNode);
}
} else {
childrenToRefresh.push(asyncDataTreeNode);
}

View file

@ -589,15 +589,51 @@ export function maxIndex<T>(array: readonly T[], fn: (value: T) => number): numb
return maxIdx;
}
/**
* Returns an array of all elements `e` with `startKey <= keySelector(e) <= endKey`.
* `data` must be sorted in ascending order.
*/
export function filterSortedByKey<T>(data: readonly T[], keySelector: (value: T) => number, startKey: number, endKey = startKey): T[] | null {
const startIdx = findFirstInSorted(data, x => startKey <= keySelector(x));
const endIdx = findFirstInSorted(data, x => endKey < keySelector(x));
if (startIdx === endIdx) {
return null;
export class ArrayQueue<T> {
private firstIdx = 0;
private lastIdx = this.items.length - 1;
/**
* Constructs a queue that is backed by the given array. Runtime is O(1).
*/
constructor(private readonly items: T[]) { }
get length(): number {
return this.lastIdx - this.firstIdx + 1;
}
/**
* Consumes elements from the beginning of the queue as long as the predicate returns true.
* If no elements were consumed, `null` is returned. Has a runtime of O(result.length).
*/
takeWhile(predicate: (value: T) => boolean): T[] | null {
// P(k) := k <= this.lastIdx && predicate(this.items[k])
// Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)
let startIdx = this.firstIdx;
while (startIdx < this.items.length && predicate(this.items[startIdx])) {
startIdx++;
}
const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);
this.firstIdx = startIdx;
return result;
}
/**
* Consumes elements from the end of the queue as long as the predicate returns true.
* If no elements were consumed, `null` is returned.
* The result has the same order as the underlying array!
*/
takeFromEndWhile(predicate: (value: T) => boolean): T[] | null {
// P(k) := this.firstIdx >= k && predicate(this.items[k])
// Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]
let endIdx = this.lastIdx;
while (endIdx >= 0 && predicate(this.items[endIdx])) {
endIdx--;
}
const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);
this.lastIdx = endIdx;
return result;
}
return data.slice(startIdx, endIdx);
}

View file

@ -11,7 +11,7 @@ function roundFloat(number: number, decimalPoints: number): number {
}
export class RGBA {
_rgbaBrand: void;
_rgbaBrand: void = undefined;
/**
* Red: integer in [0-255]
@ -47,7 +47,7 @@ export class RGBA {
export class HSLA {
_hslaBrand: void;
_hslaBrand: void = undefined;
/**
* Hue: integer in [0, 360]
@ -160,7 +160,7 @@ export class HSLA {
export class HSVA {
_hsvaBrand: void;
_hsvaBrand: void = undefined;
/**
* Hue: integer in [0, 360]

View file

@ -41,7 +41,7 @@ export interface ScrollEvent {
}
export class ScrollState implements IScrollDimensions, IScrollPosition {
_scrollStateBrand: void;
_scrollStateBrand: void = undefined;
public readonly rawScrollLeft: number;
public readonly rawScrollTop: number;
@ -204,7 +204,7 @@ export interface INewScrollPosition {
export class Scrollable extends Disposable {
_scrollableBrand: void;
_scrollableBrand: void = undefined;
private _smoothScrollDuration: number;
private readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;

View file

@ -435,45 +435,4 @@ suite('AsyncDataTree', function () {
assert.deepStrictEqual(Array.from(container.querySelectorAll('.monaco-list-row')).map(e => e.textContent), ['a', 'b2']);
});
test('issue #127035 - tree should react to collapseByDefault toggles', async () => {
const container = document.createElement('div');
const model = new Model({
id: 'root',
children: [{
id: 'a'
}]
});
let collapseByDefault = () => true;
const tree = new AsyncDataTree<Element, Element>('test', container, new VirtualDelegate(), [new Renderer()], new DataSource(), {
identityProvider: new IdentityProvider(),
collapseByDefault: _ => collapseByDefault()
});
tree.layout(200);
await tree.setInput(model.root);
assert.strictEqual(container.querySelectorAll('.monaco-list-row').length, 1);
let twistie = container.querySelector('.monaco-list-row:first-child .monaco-tl-twistie') as HTMLElement;
assert(!twistie.classList.contains('collapsible'));
assert(!twistie.classList.contains('collapsed'));
collapseByDefault = () => false;
model.get('a').children = [{ id: 'aa' }];
await tree.updateChildren(model.root, true);
const rows = container.querySelectorAll('.monaco-list-row');
assert.strictEqual(rows.length, 2);
const aTwistie = rows.item(0).querySelector('.monaco-tl-twistie') as HTMLElement;
assert(aTwistie.classList.contains('collapsible'));
assert(!aTwistie.classList.contains('collapsed'));
const aaTwistie = rows.item(1).querySelector('.monaco-tl-twistie') as HTMLElement;
assert(!aaTwistie.classList.contains('collapsible'));
assert(!aaTwistie.classList.contains('collapsed'));
tree.dispose();
});
});

View file

@ -312,12 +312,63 @@ suite('Arrays', () => {
assert.strictEqual(arrays.maxIndex(array, value => value === 'b' ? 5 : 0), 1);
});
test('filterSortedByKey', () => {
const array = [1, 2, 5, 5, 7, 8];
suite('ArrayQueue', () => {
suite('takeWhile/takeFromEndWhile', () => {
test('TakeWhile 1', () => {
const queue1 = new arrays.ArrayQueue([9, 8, 1, 7, 6]);
assert.deepStrictEqual(queue1.takeWhile(x => x > 5), [9, 8]);
assert.deepStrictEqual(queue1.takeWhile(x => x < 7), [1]);
assert.deepStrictEqual(queue1.takeWhile(x => true), [7, 6]);
});
assert.deepStrictEqual(arrays.filterSortedByKey(array, i => i, 3, 5), [5, 5]);
assert.deepStrictEqual(arrays.filterSortedByKey(array, i => i, 5, 5), [5, 5]);
assert.deepStrictEqual(arrays.filterSortedByKey(array, i => i, 6, 6), null);
assert.deepStrictEqual(arrays.filterSortedByKey(array, i => i, 8, 8), [8]);
test('TakeWhile 1', () => {
const queue1 = new arrays.ArrayQueue([9, 8, 1, 7, 6]);
assert.deepStrictEqual(queue1.takeFromEndWhile(x => x > 5), [7, 6]);
assert.deepStrictEqual(queue1.takeFromEndWhile(x => x < 2), [1]);
assert.deepStrictEqual(queue1.takeFromEndWhile(x => true), [9, 8]);
});
});
suite('takeWhile/takeFromEndWhile monotonous', () => {
function testMonotonous(array: number[], predicate: (a: number) => boolean) {
function normalize(arr: number[]): number[] | null {
if (arr.length === 0) {
return null;
}
return arr;
}
const negatedPredicate = (a: number) => !predicate(a);
{
const queue1 = new arrays.ArrayQueue(array);
assert.deepStrictEqual(queue1.takeWhile(predicate), normalize(array.filter(predicate)));
assert.deepStrictEqual(queue1.length, array.length - array.filter(predicate).length);
assert.deepStrictEqual(queue1.takeWhile(() => true), normalize(array.filter(negatedPredicate)));
}
{
const queue3 = new arrays.ArrayQueue(array);
assert.deepStrictEqual(queue3.takeFromEndWhile(negatedPredicate), normalize(array.filter(negatedPredicate)));
assert.deepStrictEqual(queue3.length, array.length - array.filter(negatedPredicate).length);
assert.deepStrictEqual(queue3.takeFromEndWhile(() => true), normalize(array.filter(predicate)));
}
}
const array = [1, 1, 1, 2, 5, 5, 7, 8, 8];
test('TakeWhile 1', () => testMonotonous(array, value => value <= 1));
test('TakeWhile 2', () => testMonotonous(array, value => value < 5));
test('TakeWhile 3', () => testMonotonous(array, value => value <= 5));
test('TakeWhile 4', () => testMonotonous(array, value => true));
test('TakeWhile 5', () => testMonotonous(array, value => false));
const array2 = [1, 1, 1, 2, 5, 5, 7, 8, 8, 9, 9, 9, 9, 10, 10];
test('TakeWhile 6', () => testMonotonous(array2, value => value < 10));
test('TakeWhile 7', () => testMonotonous(array2, value => value < 7));
test('TakeWhile 8', () => testMonotonous(array2, value => value < 5));
test('TakeWhile Empty', () => testMonotonous([], value => value <= 5));
});
});
});

View file

@ -37,7 +37,7 @@ export interface ITextAreaHandlerHelper {
}
class VisibleTextAreaData {
_visibleTextAreaBrand: void;
_visibleTextAreaBrand: void = undefined;
public readonly top: number;
public readonly left: number;

View file

@ -12,7 +12,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
* Coordinates relative to the whole document (e.g. mouse event's pageX and pageY)
*/
export class PageCoordinates {
_pageCoordinatesBrand: void;
_pageCoordinatesBrand: void = undefined;
constructor(
public readonly x: number,
@ -32,7 +32,7 @@ export class PageCoordinates {
* of whether the page is scrolled horizontally.
*/
export class ClientCoordinates {
_clientCoordinatesBrand: void;
_clientCoordinatesBrand: void = undefined;
constructor(
public readonly clientX: number,
@ -48,7 +48,7 @@ export class ClientCoordinates {
* The position of the editor in the page.
*/
export class EditorPagePosition {
_editorPagePositionBrand: void;
_editorPagePositionBrand: void = undefined;
constructor(
public readonly x: number,
@ -64,7 +64,7 @@ export function createEditorPagePosition(editorViewDomNode: HTMLElement): Editor
}
export class EditorMouseEvent extends StandardMouseEvent {
_editorMouseEventBrand: void;
_editorMouseEventBrand: void = undefined;
/**
* Coordinates relative to the whole document.

View file

@ -42,11 +42,27 @@ export class DOMLineBreaksComputerFactory implements ILineBreaksComputerFactory
}
}
function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: number, firstLineBreakColumn: number, wrappingIndent: WrappingIndent, injectedTexts: (LineInjectedText[] | null)[]): (LineBreakData | null)[] {
function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: number, firstLineBreakColumn: number, wrappingIndent: WrappingIndent, injectedTextsPerLine: (LineInjectedText[] | null)[]): (LineBreakData | null)[] {
function createEmptyLineBreakWithPossiblyInjectedText(requestIdx: number): LineBreakData | null {
const injectedTexts = injectedTextsPerLine[requestIdx];
if (injectedTexts) {
const lineText = LineInjectedText.applyInjectedText(requests[requestIdx], injectedTexts);
const injectionTexts = injectedTexts.map(t => t.text);
const injectionOffsets = injectedTexts.map(text => text.column - 1);
// creating a `LineBreakData` with an invalid `breakOffsetsVisibleColumn` is OK
// because `breakOffsetsVisibleColumn` will never be used because it contains injected text
return new LineBreakData([lineText.length], [], 0, injectionTexts, injectionOffsets);
} else {
return null;
}
}
if (firstLineBreakColumn === -1) {
const result: null[] = [];
const result: (LineBreakData | null)[] = [];
for (let i = 0, len = requests.length; i < len; i++) {
result[i] = null;
result[i] = createEmptyLineBreakWithPossiblyInjectedText(i);
}
return result;
}
@ -69,7 +85,7 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
const allCharOffsets: number[][] = [];
const allVisibleColumns: number[][] = [];
for (let i = 0; i < requests.length; i++) {
const lineContent = LineInjectedText.applyInjectedText(requests[i], injectedTexts[i]);
const lineContent = LineInjectedText.applyInjectedText(requests[i], injectedTextsPerLine[i]);
let firstNonWhitespaceIndex = 0;
let wrappedTextIndentLength = 0;
@ -130,7 +146,7 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
const lineDomNode = lineDomNodes[i];
const breakOffsets: number[] | null = readLineBreaks(range, lineDomNode, renderLineContents[i], allCharOffsets[i]);
if (breakOffsets === null) {
result[i] = null;
result[i] = createEmptyLineBreakWithPossiblyInjectedText(i);
continue;
}
@ -152,7 +168,7 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
let injectionTexts: string[] | null;
let injectionOffsets: number[] | null;
const curInjectedTexts = injectedTexts[i];
const curInjectedTexts = injectedTextsPerLine[i];
if (curInjectedTexts) {
injectionTexts = curInjectedTexts.map(t => t.text);
injectionOffsets = curInjectedTexts.map(text => text.column - 1);

View file

@ -18,7 +18,7 @@ import { IDimension } from 'vs/editor/common/editorCommon';
class Coordinate {
_coordinateBrand: void;
_coordinateBrand: void = undefined;
public readonly top: number;
public readonly left: number;

View file

@ -145,6 +145,11 @@ export class EditorScrollbar extends ViewPart {
const fastScrollSensitivity = options.get(EditorOption.fastScrollSensitivity);
const scrollPredominantAxis = options.get(EditorOption.scrollPredominantAxis);
const newOpts: ScrollableElementChangeOptions = {
vertical: scrollbar.vertical,
horizontal: scrollbar.horizontal,
verticalScrollbarSize: scrollbar.verticalScrollbarSize,
horizontalScrollbarSize: scrollbar.horizontalScrollbarSize,
scrollByPage: scrollbar.scrollByPage,
handleMouseWheel: scrollbar.handleMouseWheel,
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity,
fastScrollSensitivity: fastScrollSensitivity,

View file

@ -12,7 +12,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export class DecorationToRender {
_decorationToRenderBrand: void;
_decorationToRenderBrand: void = undefined;
public startLineNumber: number;
public endLineNumber: number;

View file

@ -7,7 +7,7 @@ import { Constants } from 'vs/base/common/uint';
import { HorizontalRange } from 'vs/editor/common/view/renderingContext';
class FloatHorizontalRange {
_floatHorizontalRangeBrand: void;
_floatHorizontalRangeBrand: void = undefined;
public readonly left: number;
public readonly width: number;

View file

@ -8,7 +8,7 @@ import { Constants, getCharIndex } from './minimapCharSheet';
import { toUint8 } from 'vs/base/common/uint';
export class MinimapCharRenderer {
_minimapCharRendererBrand: void;
_minimapCharRendererBrand: void = undefined;
private readonly charDataNormal: Uint8ClampedArray;
private readonly charDataLight: Uint8ClampedArray;

View file

@ -2484,7 +2484,7 @@ class EditorLineHeight extends EditorFloatOption<EditorOption.lineHeight> {
EditorOption.lineHeight, 'lineHeight',
EDITOR_FONT_DEFAULTS.lineHeight,
x => EditorFloatOption.clamp(x, 0, 150),
{ markdownDescription: nls.localize('lineHeight', "Controls the line height. \n - Use 0 to automatically compute the line height from the font size.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than 8 will be used as effective values.") }
{ markdownDescription: nls.localize('lineHeight', "Controls the line height. \n - Use 0 to automatically compute the line height from the font size.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values.") }
);
}
@ -3007,6 +3007,7 @@ export interface IEditorScrollbarOptions {
/**
* The size of arrows (if displayed).
* Defaults to 11.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
arrowSize?: number;
/**
@ -3022,16 +3023,19 @@ export interface IEditorScrollbarOptions {
/**
* Cast horizontal and vertical shadows when the content is scrolled.
* Defaults to true.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
useShadows?: boolean;
/**
* Render arrows at the top and bottom of the vertical scrollbar.
* Defaults to false.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
verticalHasArrows?: boolean;
/**
* Render arrows at the left and right of the horizontal scrollbar.
* Defaults to false.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
horizontalHasArrows?: boolean;
/**
@ -3042,6 +3046,7 @@ export interface IEditorScrollbarOptions {
/**
* Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).
* Defaults to true.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
alwaysConsumeMouseWheel?: boolean;
/**
@ -3057,11 +3062,13 @@ export interface IEditorScrollbarOptions {
/**
* Width in pixels for the vertical slider.
* Defaults to `verticalScrollbarSize`.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
verticalSliderSize?: number;
/**
* Height in pixels for the horizontal slider.
* Defaults to `horizontalScrollbarSize`.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
horizontalSliderSize?: number;
/**
@ -3101,22 +3108,61 @@ function _scrollbarVisibilityFromString(visibility: string | undefined, defaultV
class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, InternalEditorScrollbarOptions> {
constructor() {
const defaults: InternalEditorScrollbarOptions = {
vertical: ScrollbarVisibility.Auto,
horizontal: ScrollbarVisibility.Auto,
arrowSize: 11,
useShadows: true,
verticalHasArrows: false,
horizontalHasArrows: false,
horizontalScrollbarSize: 12,
horizontalSliderSize: 12,
verticalScrollbarSize: 14,
verticalSliderSize: 14,
handleMouseWheel: true,
alwaysConsumeMouseWheel: true,
scrollByPage: false
};
super(
EditorOption.scrollbar, 'scrollbar',
EditorOption.scrollbar, 'scrollbar', defaults,
{
vertical: ScrollbarVisibility.Auto,
horizontal: ScrollbarVisibility.Auto,
arrowSize: 11,
useShadows: true,
verticalHasArrows: false,
horizontalHasArrows: false,
horizontalScrollbarSize: 12,
horizontalSliderSize: 12,
verticalScrollbarSize: 14,
verticalSliderSize: 14,
handleMouseWheel: true,
alwaysConsumeMouseWheel: true,
scrollByPage: false
'editor.scrollbar.vertical': {
type: 'string',
enum: ['auto', 'visible', 'hidden'],
enumDescriptions: [
nls.localize('scrollbar.vertical.auto', "The vertical scrollbar will be visible only when necessary."),
nls.localize('scrollbar.vertical.visible', "The vertical scrollbar will always be visible."),
nls.localize('scrollbar.vertical.fit', "The vertical scrollbar will always be hidden."),
],
default: 'auto',
description: nls.localize('scrollbar.vertical', "Controls the visibility of the vertical scrollbar.")
},
'editor.scrollbar.horizontal': {
type: 'string',
enum: ['auto', 'visible', 'hidden'],
enumDescriptions: [
nls.localize('scrollbar.horizontal.auto', "The horizontal scrollbar will be visible only when necessary."),
nls.localize('scrollbar.horizontal.visible', "The horizontal scrollbar will always be visible."),
nls.localize('scrollbar.horizontal.fit', "The horizontal scrollbar will always be hidden."),
],
default: 'auto',
description: nls.localize('scrollbar.horizontal', "Controls the visibility of the horizontal scrollbar.")
},
'editor.scrollbar.verticalScrollbarSize': {
type: 'number',
default: defaults.verticalScrollbarSize,
description: nls.localize('scrollbar.verticalScrollbarSize', "The width of the vertical scrollbar.")
},
'editor.scrollbar.horizontalScrollbarSize': {
type: 'number',
default: defaults.horizontalScrollbarSize,
description: nls.localize('scrollbar.horizontalScrollbarSize', "The height of the horizontal scrollbar.")
},
'editor.scrollbar.scrollByPage': {
type: 'boolean',
default: defaults.scrollByPage,
description: nls.localize('scrollbar.scrollByPage', "Controls whether clicks scroll by page or jump to click position.")
}
}
);
}

View file

@ -19,7 +19,7 @@ const GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;
const MINIMUM_LINE_HEIGHT = 8;
export class BareFontInfo {
readonly _bareFontInfoBrand: void;
readonly _bareFontInfoBrand: void = undefined;
/**
* @internal
@ -140,7 +140,7 @@ export class BareFontInfo {
export const SERIALIZED_FONT_INFO_VERSION = 1;
export class FontInfo extends BareFontInfo {
readonly _editorStylingBrand: void;
readonly _editorStylingBrand: void = undefined;
readonly version: number = SERIALIZED_FONT_INFO_VERSION;
readonly isTrusted: boolean;

View file

@ -58,7 +58,7 @@ const autoCloseNever = () => false;
const autoCloseBeforeWhitespace = (chr: string) => (chr === ' ' || chr === '\t');
export class CursorConfiguration {
_cursorMoveConfigurationBrand: void;
_cursorMoveConfigurationBrand: void = undefined;
public readonly readOnly: boolean;
public readonly tabSize: number;
@ -233,7 +233,7 @@ export interface ICursorSimpleModel {
* Represents the cursor state on either the model or on the view model.
*/
export class SingleCursorState {
_singleCursorStateBrand: void;
_singleCursorStateBrand: void = undefined;
// --- selection can start as a range (think double click and drag)
public readonly selectionStart: Range;
@ -318,7 +318,7 @@ export class SingleCursorState {
}
export class CursorContext {
_cursorContextBrand: void;
_cursorContextBrand: void = undefined;
public readonly model: ITextModel;
public readonly coordinatesConverter: ICoordinatesConverter;
@ -354,7 +354,7 @@ export class PartialViewCursorState {
export type PartialCursorState = CursorState | PartialModelCursorState | PartialViewCursorState;
export class CursorState {
_cursorStateBrand: void;
_cursorStateBrand: void = undefined;
public static fromModelState(modelState: SingleCursorState): PartialModelCursorState {
return new PartialModelCursorState(modelState);
@ -398,7 +398,7 @@ export class CursorState {
}
export class EditOperationResult {
_editOperationResultBrand: void;
_editOperationResultBrand: void = undefined;
readonly type: EditOperationType;
readonly commands: Array<ICommand | null>;

View file

@ -12,7 +12,7 @@ import { AtomicTabMoveOperations, Direction } from 'vs/editor/common/controller/
import { PositionNormalizationAffinity } from 'vs/editor/common/model';
export class CursorPosition {
_cursorPositionBrand: void;
_cursorPositionBrand: void = undefined;
public readonly lineNumber: number;
public readonly column: number;

View file

@ -16,7 +16,7 @@ export interface IViewLineTokens {
}
export class LineTokens implements IViewLineTokens {
_lineTokensBrand: void;
_lineTokensBrand: void = undefined;
private readonly _tokens: Uint32Array;
private readonly _tokensCount: number;

View file

@ -8,7 +8,7 @@
* Please don't touch unless you take a look at the IR.
*/
export class RGBA8 {
_rgba8Brand: void;
_rgba8Brand: void = undefined;
static readonly Empty = new RGBA8(0, 0, 0, 0);

View file

@ -6,7 +6,7 @@
import { IState } from 'vs/editor/common/modes';
export class Token {
_tokenBrand: void;
_tokenBrand: void = undefined;
public readonly offset: number;
public readonly type: string;
@ -24,7 +24,7 @@ export class Token {
}
export class TokenizationResult {
_tokenizationResultBrand: void;
_tokenizationResultBrand: void = undefined;
public readonly tokens: Token[];
public readonly endState: IState;
@ -36,7 +36,7 @@ export class TokenizationResult {
}
export class TokenizationResult2 {
_tokenizationResult2Brand: void;
_tokenizationResult2Brand: void = undefined;
/**
* The tokens in binary format. Each token occupies two array indices. For token i:

View file

@ -419,7 +419,7 @@ export interface ICursorStateComputer {
}
export class TextModelResolvedOptions {
_textModelResolvedOptionsBrand: void;
_textModelResolvedOptionsBrand: void = undefined;
readonly tabSize: number;
readonly indentSize: number;
@ -492,7 +492,7 @@ export interface ITextModelUpdateOptions {
}
export class FindMatch {
_findMatchBrand: void;
_findMatchBrand: void = undefined;
public readonly range: Range;
public readonly matches: string[] | null;

View file

@ -39,7 +39,7 @@ import { TextChange } from 'vs/editor/common/model/textChange';
import { Constants } from 'vs/base/common/uint';
import { PieceTreeTextBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
import { listenStream } from 'vs/base/common/stream';
import { filterSortedByKey } from 'vs/base/common/arrays';
import { ArrayQueue } from 'vs/base/common/arrays';
function createTextBufferBuilder() {
return new PieceTreeTextBufferBuilder();
@ -1470,17 +1470,23 @@ export class TextModel extends Disposable implements model.ITextModel {
0,
this._versionId
));
const injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);
const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);
for (let j = editingLinesCnt; j >= 0; j--) {
const editLineNumber = startLineNumber + j;
const currentEditLineNumber = currentEditStartLineNumber + j;
injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);
const decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);
rawContentChanges.push(
new ModelRawLineChanged(
editLineNumber,
this.getLineContent(currentEditLineNumber),
filterSortedByKey(injectedTextInEditedRange, i => i.lineNumber, currentEditLineNumber)
decorationsInCurrentLine
));
}
@ -1491,6 +1497,7 @@ export class TextModel extends Disposable implements model.ITextModel {
}
if (editingLinesCnt < insertingLinesCnt) {
const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);
// Must insert some lines
const spliceLineNumber = startLineNumber + editingLinesCnt;
const cnt = insertingLinesCnt - editingLinesCnt;
@ -1500,7 +1507,9 @@ export class TextModel extends Disposable implements model.ITextModel {
for (let i = 0; i < cnt; i++) {
let lineNumber = fromLineNumber + i;
newLines[i] = this.getLineContent(lineNumber);
injectedTexts[i] = filterSortedByKey(injectedTextInEditedRange, i => i.lineNumber, lineNumber);
injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);
injectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);
}
rawContentChanges.push(

View file

@ -254,7 +254,7 @@ export interface CompleteEnterAction {
* @internal
*/
export class StandardAutoClosingPairConditional {
_standardAutoClosingPairConditionalBrand: void;
_standardAutoClosingPairConditionalBrand: void = undefined;
readonly open: string;
readonly close: string;

View file

@ -32,7 +32,7 @@ export function createScopedLineTokens(context: LineTokens, offset: number): Sco
}
export class ScopedLineTokens {
_scopedLineTokensBrand: void;
_scopedLineTokensBrand: void = undefined;
public readonly languageId: modes.LanguageId;
private readonly _actual: LineTokens;

View file

@ -15,7 +15,7 @@ interface InternalBracket {
}
export class RichEditBracket {
_richEditBracketBrand: void;
_richEditBracketBrand: void = undefined;
readonly languageIdentifier: LanguageIdentifier;
readonly index: number;
@ -113,7 +113,7 @@ function groupFuzzyBrackets(brackets: CharacterPair[]): InternalBracket[] {
}
export class RichEditBrackets {
_richEditBracketsBrand: void;
_richEditBracketsBrand: void = undefined;
public readonly brackets: RichEditBracket[];
public readonly forwardRegex: RegExp;

View file

@ -14,7 +14,7 @@ export interface ITokenThemeRule {
}
export class ParsedTokenThemeRule {
_parsedThemeRuleBrand: void;
_parsedThemeRuleBrand: void = undefined;
readonly token: string;
readonly index: number;
@ -270,7 +270,7 @@ export function strcmp(a: string, b: string): number {
}
export class ThemeTrieElementRule {
_themeTrieElementRuleBrand: void;
_themeTrieElementRuleBrand: void = undefined;
private _fontStyle: FontStyle;
private _foreground: ColorId;
@ -332,7 +332,7 @@ export class ExternalThemeTrieElement {
}
export class ThemeTrieElement {
_themeTrieElementBrand: void;
_themeTrieElementBrand: void = undefined;
private readonly _mainRule: ThemeTrieElementRule;
private readonly _children: Map<string, ThemeTrieElement>;

View file

@ -8,7 +8,7 @@ const enum Constants {
}
export class ColorZone {
_colorZoneBrand: void;
_colorZoneBrand: void = undefined;
public readonly from: number;
public readonly to: number;
@ -35,7 +35,7 @@ export class ColorZone {
* A zone in the overview ruler
*/
export class OverviewRulerZone {
_overviewRulerZoneBrand: void;
_overviewRulerZoneBrand: void = undefined;
public readonly startLineNumber: number;
public readonly endLineNumber: number;

View file

@ -14,7 +14,7 @@ export interface IViewLines {
}
export abstract class RestrictedRenderingContext {
_restrictedRenderingContextBrand: void;
_restrictedRenderingContextBrand: void = undefined;
public readonly viewportData: ViewportData;
@ -64,7 +64,7 @@ export abstract class RestrictedRenderingContext {
}
export class RenderingContext extends RestrictedRenderingContext {
_renderingContextBrand: void;
_renderingContextBrand: void = undefined;
private readonly _viewLines: IViewLines;

View file

@ -9,7 +9,7 @@ import { InlineDecoration, InlineDecorationType } from 'vs/editor/common/viewMod
import { LinePartMetadata } from 'vs/editor/common/viewLayout/viewLineRenderer';
export class LineDecoration {
_lineDecorationBrand: void;
_lineDecorationBrand: void = undefined;
constructor(
public readonly startColumn: number,

View file

@ -29,7 +29,7 @@ export const enum LinePartMetadata {
}
class LinePart {
_linePartBrand: void;
_linePartBrand: void = undefined;
/**
* last char index of this token (not inclusive).
@ -357,7 +357,7 @@ export const enum ForeignElementType {
}
export class RenderLineOutput {
_renderLineOutputBrand: void;
_renderLineOutputBrand: void = undefined;
readonly characterMapping: CharacterMapping;
readonly containsRTL: boolean;

View file

@ -6,7 +6,7 @@
import { toUint32 } from 'vs/base/common/uint';
export class PrefixSumIndexOfResult {
_prefixSumIndexOfResultBrand: void;
_prefixSumIndexOfResultBrand: void = undefined;
index: number;
remainder: number;

View file

@ -27,7 +27,7 @@ export interface IViewWhitespaceViewportData {
}
export class Viewport {
readonly _viewportBrand: void;
readonly _viewportBrand: void = undefined;
readonly top: number;
readonly left: number;
@ -280,7 +280,7 @@ export class MinimapLinesRenderingData {
}
export class ViewLineData {
_viewLineDataBrand: void;
_viewLineDataBrand: void = undefined;
/**
* The content at this view line.
@ -424,7 +424,7 @@ export class InlineDecoration {
}
export class ViewModelDecoration {
_viewModelDecorationBrand: void;
_viewModelDecorationBrand: void = undefined;
public readonly range: Range;
public readonly options: IModelDecorationOptions;

View file

@ -21,4 +21,5 @@
.monaco-editor .ghost-text-hidden {
opacity: 0;
font-size: 0;
}

View file

@ -10,7 +10,7 @@ import { ColorId, TokenMetadata } from 'vs/editor/common/modes';
* A token on a line.
*/
export class ViewLineToken {
_viewLineTokenBrand: void;
_viewLineTokenBrand: void = undefined;
/**
* last char index of this token (not inclusive).

View file

@ -20,7 +20,7 @@ const MAX_CHANGE_CNT = 20;
suite('IntervalTree', () => {
class Interval {
_intervalBrand: void;
_intervalBrand: void = undefined;
public start: number;
public end: number;

7
src/vs/monaco.d.ts vendored
View file

@ -3756,6 +3756,7 @@ declare namespace monaco.editor {
/**
* The size of arrows (if displayed).
* Defaults to 11.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
arrowSize?: number;
/**
@ -3771,16 +3772,19 @@ declare namespace monaco.editor {
/**
* Cast horizontal and vertical shadows when the content is scrolled.
* Defaults to true.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
useShadows?: boolean;
/**
* Render arrows at the top and bottom of the vertical scrollbar.
* Defaults to false.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
verticalHasArrows?: boolean;
/**
* Render arrows at the left and right of the horizontal scrollbar.
* Defaults to false.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
horizontalHasArrows?: boolean;
/**
@ -3791,6 +3795,7 @@ declare namespace monaco.editor {
/**
* Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).
* Defaults to true.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
alwaysConsumeMouseWheel?: boolean;
/**
@ -3806,11 +3811,13 @@ declare namespace monaco.editor {
/**
* Width in pixels for the vertical slider.
* Defaults to `verticalScrollbarSize`.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
verticalSliderSize?: number;
/**
* Height in pixels for the horizontal slider.
* Defaults to `horizontalScrollbarSize`.
* **NOTE**: This option cannot be updated using `updateOptions()`
*/
horizontalSliderSize?: number;
/**

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { basename, join, } from 'vs/base/common/path';
import { join } from 'vs/base/common/path';
import { IProductService } from 'vs/platform/product/common/productService';
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { env } from 'vs/base/common/process';
@ -130,13 +130,13 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
for (const extensionId of installed) {
const tip = importantExeBasedRecommendations.get(extensionId);
if (tip) {
this.telemetryService.publicLog2<{ exeName: string, extensionId: string }, ExeExtensionRecommendationsClassification>('exeExtensionRecommendations:alreadyInstalled', { extensionId, exeName: basename(tip.windowsPath!) });
this.telemetryService.publicLog2<{ exeName: string, extensionId: string }, ExeExtensionRecommendationsClassification>('exeExtensionRecommendations:alreadyInstalled', { extensionId, exeName: tip.exeName });
}
}
for (const extensionId of recommendations) {
const tip = importantExeBasedRecommendations.get(extensionId);
if (tip) {
this.telemetryService.publicLog2<{ exeName: string, extensionId: string }, ExeExtensionRecommendationsClassification>('exeExtensionRecommendations:notInstalled', { extensionId, exeName: basename(tip.windowsPath!) });
this.telemetryService.publicLog2<{ exeName: string, extensionId: string }, ExeExtensionRecommendationsClassification>('exeExtensionRecommendations:notInstalled', { extensionId, exeName: tip.exeName });
}
}

View file

@ -167,7 +167,7 @@ export interface IExtensionContributions {
}
export interface IExtensionCapabilities {
readonly virtualWorkspaces?: ExtensionVirtualWorkpaceSupport;
readonly virtualWorkspaces?: ExtensionVirtualWorkspaceSupport;
readonly untrustedWorkspaces?: ExtensionUntrustedWorkspaceSupport;
}
@ -175,14 +175,14 @@ export interface IExtensionCapabilities {
export type ExtensionKind = 'ui' | 'workspace' | 'web';
export type LimitedWorkpaceSupportType = 'limited';
export type ExtensionUntrustedWorkpaceSupportType = boolean | LimitedWorkpaceSupportType;
export type ExtensionUntrustedWorkspaceSupport = { supported: true; } | { supported: false, description: string } | { supported: LimitedWorkpaceSupportType, description: string, restrictedConfigurations?: string[] };
export type LimitedWorkspaceSupportType = 'limited';
export type ExtensionUntrustedWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;
export type ExtensionUntrustedWorkspaceSupport = { supported: true; } | { supported: false, description: string } | { supported: LimitedWorkspaceSupportType, description: string, restrictedConfigurations?: string[] };
export type ExtensionVirtualWorkpaceSupportType = boolean | LimitedWorkpaceSupportType;
export type ExtensionVirtualWorkpaceSupport = boolean | { supported: true; } | { supported: false | LimitedWorkpaceSupportType, description: string };
export type ExtensionVirtualWorkspaceSupportType = boolean | LimitedWorkspaceSupportType;
export type ExtensionVirtualWorkspaceSupport = boolean | { supported: true; } | { supported: false | LimitedWorkspaceSupportType, description: string };
export function getWorkpaceSupportTypeMessage(supportType: ExtensionUntrustedWorkspaceSupport | ExtensionVirtualWorkpaceSupport | undefined): string | undefined {
export function getWorkspaceSupportTypeMessage(supportType: ExtensionUntrustedWorkspaceSupport | ExtensionVirtualWorkspaceSupport | undefined): string | undefined {
if (typeof supportType === 'object' && supportType !== null) {
if (supportType.supported !== true) {
return supportType.description;

View file

@ -8,7 +8,7 @@ import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
export class ResolvedKeybindingItem {
_resolvedKeybindingItemBrand: void;
_resolvedKeybindingItemBrand: void = undefined;
public readonly resolvedKeybinding: ResolvedKeybinding | undefined;
public readonly keypressParts: string[];

View file

@ -54,7 +54,7 @@ else {
// Running out of sources
if (Object.keys(product).length === 0) {
Object.assign(product, {
version: '1.58.0-dev',
version: '1.59.0-dev',
nameShort: isWeb ? 'Code Web - OSS Dev' : 'Code - OSS Dev',
nameLong: isWeb ? 'Code Web - OSS Dev' : 'Code - OSS Dev',
applicationName: 'code-oss',

View file

@ -437,6 +437,7 @@ export interface ICreateTerminalOptions {
export interface ICreateContributedTerminalProfileOptions {
isSplitTerminal: boolean;
target?: TerminalLocation;
icon?: string;
}
export const enum TerminalLocation {

View file

@ -345,7 +345,7 @@ export function registerTerminalDefaultProfileConfiguration(detectedProfiles?: {
properties: {
[TerminalSettingId.DefaultProfileLinux]: {
restricted: true,
markdownDescription: localize('terminal.integrated.defaultProfile.linux', "The default profile used on Linux. This setting will currently be ignored if either {0} or {1} are set.", '`#terminal.integrated.shell.linux#`', '`#terminal.integrated.shellArgs.linux#`'),
markdownDescription: localize('terminal.integrated.defaultProfile.linux', "The default profile used on Linux. This setting will currently be ignored if either {0} or {1} are set.", '`terminal.integrated.shell.linux`', '`terminal.integrated.shellArgs.linux`'),
type: ['string', 'null'],
default: null,
enum: detectedProfiles?.os === OperatingSystem.Linux ? enumValues : undefined,
@ -353,7 +353,7 @@ export function registerTerminalDefaultProfileConfiguration(detectedProfiles?: {
},
[TerminalSettingId.DefaultProfileMacOs]: {
restricted: true,
markdownDescription: localize('terminal.integrated.defaultProfile.osx', "The default profile used on macOS. This setting will currently be ignored if either {0} or {1} are set.", '`#terminal.integrated.shell.osx#`', '`#terminal.integrated.shellArgs.osx#`'),
markdownDescription: localize('terminal.integrated.defaultProfile.osx', "The default profile used on macOS. This setting will currently be ignored if either {0} or {1} are set.", '`terminal.integrated.shell.osx`', '`terminal.integrated.shellArgs.osx`'),
type: ['string', 'null'],
default: null,
enum: detectedProfiles?.os === OperatingSystem.Macintosh ? enumValues : undefined,
@ -361,7 +361,7 @@ export function registerTerminalDefaultProfileConfiguration(detectedProfiles?: {
},
[TerminalSettingId.DefaultProfileWindows]: {
restricted: true,
markdownDescription: localize('terminal.integrated.defaultProfile.windows', "The default profile used on Windows. This setting will currently be ignored if either {0} or {1} are set.", '`#terminal.integrated.shell.windows#`', '`#terminal.integrated.shellArgs.windows#`'),
markdownDescription: localize('terminal.integrated.defaultProfile.windows', "The default profile used on Windows. This setting will currently be ignored if either {0} or {1} are set.", '`terminal.integrated.shell.windows`', '`terminal.integrated.shellArgs.windows`'),
type: ['string', 'null'],
default: null,
enum: detectedProfiles?.os === OperatingSystem.Windows ? enumValues : undefined,

View file

@ -45,7 +45,7 @@ export interface IWorkspaceTrustManagementService {
readonly workspaceTrustInitialized: Promise<void>;
acceptsOutOfWorkspaceFiles: boolean;
isWorkpaceTrusted(): boolean;
isWorkspaceTrusted(): boolean;
isWorkspaceTrustForced(): boolean;
canSetParentFolderTrust(): boolean;

12
src/vs/vscode.d.ts vendored
View file

@ -3976,25 +3976,25 @@ declare module 'vscode' {
}
/**
* Represents a structured label for completion items.
* A structured label for a {@link CompletionItem completion item}.
*/
export interface CompletionItemLabel {
/**
* The label of this completion item. By default
* this is also the text that is inserted when selecting
* this completion.
* The label of this completion item.
*
* By default this is also the text that is inserted when this completion is selected.
*/
label: string;
/**
* An optional string which is rendered less prominent and directly after {@link CompletionItemLabel.label label},
* An optional string which is rendered less prominently directly after {@link CompletionItemLabel.label label},
* without any spacing. Should be used for function signatures or type annotations.
*/
detail?: string;
/**
* An optional string which is rendered less prominent and after {@link CompletionItemLabel.detail}. Should be used
* An optional string which is rendered less prominently after {@link CompletionItemLabel.detail}. Should be used
* for fully qualified names or file path.
*/
description?: string;

View file

@ -214,7 +214,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
}
private isWorkspaceTrusted(): boolean {
return this._workspaceTrustManagementService.isWorkpaceTrusted();
return this._workspaceTrustManagementService.isWorkspaceTrusted();
}
private _onDidGrantWorkspaceTrust(): void {

View file

@ -602,8 +602,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return pathsToEditors(initialFilesToOpen.filesToDiff, fileService).then(filesToDiff => {
if (filesToDiff.length === 2) {
const diffEditorInput: IResourceDiffEditorInput[] = [{
originalInput: { resource: filesToDiff[0].resource },
modifiedInput: { resource: filesToDiff[1].resource },
original: { resource: filesToDiff[0].resource },
modified: { resource: filesToDiff[1].resource },
options: { pinned: true },
forceFile: true
}];

View file

@ -460,8 +460,8 @@ function registerOpenEditorAPICommands(): void {
const [options, column] = mixinContext(context, optionsArg, columnArg);
await editorService.openEditor({
originalInput: { resource: URI.revive(originalResource) },
modifiedInput: { resource: URI.revive(modifiedResource) },
original: { resource: URI.revive(originalResource) },
modified: { resource: URI.revive(modifiedResource) },
label,
options
}, viewColumnToEditorGroup(editorGroupService, column));

View file

@ -93,7 +93,7 @@ export class EditorControl extends Disposable {
}
private getEditorDescriptor(editor: EditorInput): IEditorDescriptor {
if (editor.hasCapability(EditorInputCapabilities.RequiresTrust) && !this.workspaceTrustService.isWorkpaceTrusted()) {
if (editor.hasCapability(EditorInputCapabilities.RequiresTrust) && !this.workspaceTrustService.isWorkspaceTrusted()) {
// Workspace trust: if an editor signals it needs workspace trust
// but the current workspace is untrusted, we fallback to a generic
// editor descriptor to indicate this an do NOT load the registered

View file

@ -49,6 +49,7 @@ import { coalesce, insert } from 'vs/base/common/arrays';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { isSafari } from 'vs/base/browser/browser';
import { equals } from 'vs/base/common/objects';
import { EditorActivation } from 'vs/platform/editor/common/editor';
interface IEditorInputLabel {
name?: string;
@ -666,11 +667,8 @@ export class TabsTitleControl extends TitleControl {
// Open tabs editor
const input = this.group.getEditorByIndex(index);
if (input) {
this.group.openEditor(input, { preserveFocus });
if (preserveFocus) {
// Even if focus is preserved make sure to activate the group. If focus is passed group will auto activate.
this.editorGroupService.activateGroup(this.group);
}
// Even if focus is preserved make sure to activate the group.
this.group.openEditor(input, { preserveFocus, activation: EditorActivation.ACTIVATE });
}
return undefined;

View file

@ -76,7 +76,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
}
private onDidChangeFileSystemProvider(scheme: string): void {
if (this.input instanceof DiffEditorInput && (this.input.originalInput.resource?.scheme === scheme || this.input.modifiedInput.resource?.scheme === scheme)) {
if (this.input instanceof DiffEditorInput && (this.input.original.resource?.scheme === scheme || this.input.modified.resource?.scheme === scheme)) {
this.updateReadonly(this.input);
}
}
@ -91,8 +91,8 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
const control = this.getControl();
if (control) {
control.updateOptions({
readOnly: input.modifiedInput.hasCapability(EditorInputCapabilities.Readonly),
originalEditable: !input.originalInput.hasCapability(EditorInputCapabilities.Readonly)
readOnly: input.modified.hasCapability(EditorInputCapabilities.Readonly),
originalEditable: !input.original.hasCapability(EditorInputCapabilities.Readonly)
});
}
}
@ -204,19 +204,19 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
}
private openAsBinary(input: DiffEditorInput, options: ITextEditorOptions | undefined): void {
const originalInput = input.originalInput;
const modifiedInput = input.modifiedInput;
const original = input.original;
const modified = input.modified;
const binaryDiffInput = this.instantiationService.createInstance(DiffEditorInput, input.getName(), input.getDescription(), originalInput, modifiedInput, true);
const binaryDiffInput = this.instantiationService.createInstance(DiffEditorInput, input.getName(), input.getDescription(), original, modified, true);
// Forward binary flag to input if supported
const fileEditorInputFactory = Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).getFileEditorInputFactory();
if (fileEditorInputFactory.isFileEditorInput(originalInput)) {
originalInput.setForceOpenAsBinary();
if (fileEditorInputFactory.isFileEditorInput(original)) {
original.setForceOpenAsBinary();
}
if (fileEditorInputFactory.isFileEditorInput(modifiedInput)) {
modifiedInput.setForceOpenAsBinary();
if (fileEditorInputFactory.isFileEditorInput(modified)) {
modified.setForceOpenAsBinary();
}
// Replace this editor with the binary one
@ -260,8 +260,8 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
protected override getConfigurationOverrides(): ICodeEditorOptions {
const options: IDiffEditorOptions = super.getConfigurationOverrides();
options.readOnly = this.input instanceof DiffEditorInput && this.input.modifiedInput.hasCapability(EditorInputCapabilities.Readonly);
options.originalEditable = this.input instanceof DiffEditorInput && !this.input.originalInput.hasCapability(EditorInputCapabilities.Readonly);
options.readOnly = this.input instanceof DiffEditorInput && this.input.modified.hasCapability(EditorInputCapabilities.Readonly);
options.originalEditable = this.input instanceof DiffEditorInput && !this.input.original.hasCapability(EditorInputCapabilities.Readonly);
options.lineDecorationsWidth = '2ch';
return options;
@ -369,8 +369,8 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
let modified: URI | undefined;
if (modelOrInput instanceof DiffEditorInput) {
original = modelOrInput.originalInput.resource;
modified = modelOrInput.modifiedInput.resource;
original = modelOrInput.original.resource;
modified = modelOrInput.modified.resource;
} else {
original = modelOrInput.original.uri;
modified = modelOrInput.modified.uri;

View file

@ -214,8 +214,8 @@ class BrowserMain extends Disposable {
serviceCollection.set(IWorkspaceTrustManagementService, workspaceTrustManagementService);
// Update workspace trust so that configuration is updated accordingly
configurationService.updateWorkspaceTrust(workspaceTrustManagementService.isWorkpaceTrusted());
this._register(workspaceTrustManagementService.onDidChangeTrust(() => configurationService.updateWorkspaceTrust(workspaceTrustManagementService.isWorkpaceTrusted())));
configurationService.updateWorkspaceTrust(workspaceTrustManagementService.isWorkspaceTrusted());
this._register(workspaceTrustManagementService.onDidChangeTrust(() => configurationService.updateWorkspaceTrust(workspaceTrustManagementService.isWorkspaceTrusted())));
// Request Service
const requestService = new BrowserRequestService(remoteAgentService, configurationService, logService);

View file

@ -300,18 +300,18 @@ export interface IResourceDiffEditorInput extends IBaseResourceEditorInput {
/**
* The left hand side editor to open inside a diff editor.
*/
readonly originalInput: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
readonly original: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
/**
* The right hand side editor to open inside a diff editor.
*/
readonly modifiedInput: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
readonly modified: IResourceEditorInput | ITextResourceEditorInput | IUntitledTextResourceEditorInput;
}
export function isResourceDiffEditorInput(editor: IUntypedEditorInput): editor is IResourceDiffEditorInput {
const candidate = editor as IResourceDiffEditorInput;
return candidate.originalInput !== undefined && candidate.modifiedInput !== undefined;
return candidate.original !== undefined && candidate.modified !== undefined;
}
export function isUntitledResourceEditorInput(editor: IUntypedEditorInput): editor is IUntitledTextResourceEditorInput {
@ -893,8 +893,8 @@ class EditorResourceAccessorImpl {
}
// Optionally support side-by-side editors
const primaryEditor = isSideBySideEditorInput(editor) ? editor.primary : isResourceDiffEditorInput(editor) ? editor.modifiedInput : undefined;
const secondaryEditor = isSideBySideEditorInput(editor) ? editor.secondary : isResourceDiffEditorInput(editor) ? editor.originalInput : undefined;
const primaryEditor = isSideBySideEditorInput(editor) ? editor.primary : isResourceDiffEditorInput(editor) ? editor.modified : undefined;
const secondaryEditor = isSideBySideEditorInput(editor) ? editor.secondary : isResourceDiffEditorInput(editor) ? editor.original : undefined;
if (options?.supportSideBySide && primaryEditor && secondaryEditor) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {
@ -941,8 +941,8 @@ class EditorResourceAccessorImpl {
}
// Optionally support side-by-side editors
const primaryEditor = isSideBySideEditorInput(editor) ? editor.primary : isResourceDiffEditorInput(editor) ? editor.modifiedInput : undefined;
const secondaryEditor = isSideBySideEditorInput(editor) ? editor.secondary : isResourceDiffEditorInput(editor) ? editor.originalInput : undefined;
const primaryEditor = isSideBySideEditorInput(editor) ? editor.primary : isResourceDiffEditorInput(editor) ? editor.modified : undefined;
const secondaryEditor = isSideBySideEditorInput(editor) ? editor.secondary : isResourceDiffEditorInput(editor) ? editor.original : undefined;
if (options?.supportSideBySide && primaryEditor && secondaryEditor) {
if (options?.supportSideBySide === SideBySideEditor.BOTH) {
return {

View file

@ -40,13 +40,13 @@ export class DiffEditorInput extends SideBySideEditorInput {
constructor(
name: string | undefined,
description: string | undefined,
readonly originalInput: EditorInput,
readonly modifiedInput: EditorInput,
readonly original: EditorInput,
readonly modified: EditorInput,
private readonly forceOpenAsBinary: boolean | undefined,
@ILabelService private readonly labelService: ILabelService,
@IFileService private readonly fileService: IFileService
) {
super(name, description, originalInput, modifiedInput);
super(name, description, original, modified);
}
override getName(): string {
@ -60,7 +60,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
return `${this.labelService.getUriLabel(fileResources.original, { relative: true })} ↔ ${this.labelService.getUriLabel(fileResources.modified, { relative: true })}`;
}
return localize('sideBySideLabels', "{0} ↔ {1}", this.originalInput.getName(), this.modifiedInput.getName());
return localize('sideBySideLabels', "{0} ↔ {1}", this.original.getName(), this.modified.getName());
}
return this.name;
@ -73,7 +73,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
// and modified input have the same parent and we compare file resources.
const fileResources = this.asFileResources();
if (fileResources && dirname(fileResources.original).path === dirname(fileResources.modified).path) {
return this.modifiedInput.getDescription(verbosity);
return this.modified.getDescription(verbosity);
}
}
@ -82,14 +82,14 @@ export class DiffEditorInput extends SideBySideEditorInput {
private asFileResources(): { original: URI, modified: URI } | undefined {
if (
this.originalInput instanceof AbstractTextResourceEditorInput &&
this.modifiedInput instanceof AbstractTextResourceEditorInput &&
this.fileService.canHandleResource(this.originalInput.preferredResource) &&
this.fileService.canHandleResource(this.modifiedInput.preferredResource)
this.original instanceof AbstractTextResourceEditorInput &&
this.modified instanceof AbstractTextResourceEditorInput &&
this.fileService.canHandleResource(this.original.preferredResource) &&
this.fileService.canHandleResource(this.modified.preferredResource)
) {
return {
original: this.originalInput.preferredResource,
modified: this.modifiedInput.preferredResource
original: this.original.preferredResource,
modified: this.modified.preferredResource
};
}
@ -124,8 +124,8 @@ export class DiffEditorInput extends SideBySideEditorInput {
// Join resolve call over two inputs and build diff editor model
const [originalEditorModel, modifiedEditorModel] = await Promise.all([
this.originalInput.resolve(),
this.modifiedInput.resolve()
this.original.resolve(),
this.modified.resolve()
]);
// If both are text models, return textdiffeditor model
@ -145,8 +145,8 @@ export class DiffEditorInput extends SideBySideEditorInput {
return {
label: this.name,
description: this.description,
originalInput: originalResourceEditorInput,
modifiedInput: modifiedResourceEditorInput
original: originalResourceEditorInput,
modified: modifiedResourceEditorInput
};
}
@ -155,7 +155,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
override matches(otherInput: IEditorInput | IUntypedEditorInput): boolean {
if (isResourceDiffEditorInput(otherInput)) {
return this.modifiedInput.matches(otherInput.modifiedInput) && this.originalInput.matches(otherInput.originalInput);
return this.modified.matches(otherInput.modified) && this.original.matches(otherInput.original);
}
if (!super.matches(otherInput)) {

View file

@ -133,7 +133,7 @@ export class SideBySideEditorInput extends EditorInput implements ISideBySideEdi
}
if (isResourceDiffEditorInput(otherInput)) {
return this.primary.matches(otherInput.modifiedInput) && this.secondary.matches(otherInput.originalInput);
return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original);
}
if (otherInput instanceof SideBySideEditorInput) {

View file

@ -353,8 +353,8 @@ export class BulkEditPane extends ViewPane {
}
this._editorService.openEditor({
originalInput: { resource: leftResource },
modifiedInput: { resource: previewUri },
original: { resource: leftResource },
modified: { resource: previewUri },
label,
description: this._labelService.getUriLabel(dirname(leftResource), { relative: true }),
options

View file

@ -153,8 +153,8 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
return input instanceof EditorInput ? input : undefined;
};
const modifiedOverride = createEditorForSubInput(editor.modifiedInput, editorID, 'modified') ?? this.editorService.createEditorInput(editor.modifiedInput);
const originalOverride = createEditorForSubInput(editor.originalInput, editorID, 'original') ?? this.editorService.createEditorInput(editor.originalInput);
const modifiedOverride = createEditorForSubInput(editor.modified, editorID, 'modified') ?? this.editorService.createEditorInput(editor.modified);
const originalOverride = createEditorForSubInput(editor.original, editorID, 'original') ?? this.editorService.createEditorInput(editor.original);
return this.instantiationService.createInstance(DiffEditorInput, undefined, undefined, originalOverride, modifiedOverride, true);
}

View file

@ -273,7 +273,7 @@ export class AdapterManager implements IAdapterManager {
let languageLabel: string | null = null;
let model: IEditorModel | null = null;
if (isCodeEditor(activeTextEditorControl)) {
const model = activeTextEditorControl.getModel();
model = activeTextEditorControl.getModel();
const language = model ? model.getLanguageIdentifier().language : undefined;
if (language) {
languageLabel = this.modeService.getLanguageName(language);

View file

@ -115,6 +115,8 @@ export class DebugHoverWidget implements IContentWidget {
horizontalScrolling: true,
useShadows: false,
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression) => e.name },
filterOnType: false,
simpleKeyboardNavigation: true,
overrideStyles: {
listBackground: editorHoverBackground
}

View file

@ -43,7 +43,7 @@
.monaco-editor .debug-top-stack-frame-column.start-of-line::before {
position: absolute;
top: 2px;
transform: translateX(-16px);
transform: translateX(-17px);
}
.monaco-editor .debug-top-stack-frame-column {

View file

@ -6,7 +6,6 @@
import { IExtensionTipsService, IExecutableBasedExtensionTip } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionRecommendations, ExtensionRecommendation } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
import { localize } from 'vs/nls';
import { basename } from 'vs/base/common/path';
import { ExtensionRecommendationReason } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
export class ExeBasedRecommendations extends ExtensionRecommendations {
@ -62,7 +61,7 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
extensionId: tip.extensionId.toLowerCase(),
reason: {
reasonId: ExtensionRecommendationReason.Executable,
reasonText: localize('exeBasedRecommendation', "This extension is recommended because you have {0} installed.", tip.exeFriendlyName || basename(tip.windowsPath!))
reasonText: localize('exeBasedRecommendation', "This extension is recommended because you have {0} installed.", tip.exeFriendlyName)
}
};
}

View file

@ -231,23 +231,13 @@ export class ExtensionEditor extends EditorPane {
const subtitle = append(details, $('.subtitle'));
const publisher = append(append(subtitle, $('.subtitle-entry')), $('span.publisher.clickable', { title: localize('publisher', "Publisher name"), tabIndex: 0 }));
const installCount = append(append(subtitle, $('.subtitle-entry')), $('span.install', { title: localize('install count', "Install count"), tabIndex: 0 }));
const rating = append(append(subtitle, $('.subtitle-entry')), $('span.rating.clickable', { title: localize('rating', "Rating"), tabIndex: 0 }));
const repository = append(append(subtitle, $('.subtitle-entry')), $('span.repository.clickable'));
const repository = append(append(subtitle, $('.subtitle-entry')), $('span.repository.clickable', { tabIndex: 0 }));
repository.textContent = localize('repository', 'Repository');
repository.style.display = 'none';
repository.tabIndex = 0;
const license = append(append(subtitle, $('.subtitle-entry')), $('span.license.clickable'));
const license = append(append(subtitle, $('.subtitle-entry')), $('span.license.clickable', { tabIndex: 0 }));
license.textContent = localize('license', 'License');
license.style.display = 'none';
license.tabIndex = 0;
const version = append(append(subtitle, $('.subtitle-entry')), $('span.version'));
version.textContent = localize('version', 'Version');
const version = append(append(subtitle, $('.subtitle-entry')), $('span.version', { title: localize('version', 'Version'), tabIndex: 0 }));
const description = append(details, $('.description'));
@ -356,8 +346,6 @@ export class ExtensionEditor extends EditorPane {
template.preview.style.display = extension.preview ? 'inherit' : 'none';
template.builtin.style.display = extension.isBuiltin ? 'inherit' : 'none';
template.publisher.textContent = extension.publisherDisplayName;
template.version.textContent = `v${extension.version}`;
template.description.textContent = extension.description;
const extRecommendations = this.extensionRecommendationsService.getAllRecommendationsWithReason();
@ -377,8 +365,24 @@ export class ExtensionEditor extends EditorPane {
this.telemetryService.publicLog('extensionGallery:openExtension', { ...extension.telemetryData, ...recommendationsData });
template.name.classList.toggle('clickable', !!extension.url);
// subtitle
template.publisher.textContent = extension.publisherDisplayName;
template.publisher.classList.toggle('clickable', !!extension.url);
template.installCount.parentElement?.classList.toggle('hide', !extension.url);
template.rating.parentElement?.classList.toggle('hide', !extension.url);
template.rating.classList.toggle('clickable', !!extension.url);
template.repository.parentElement?.classList.toggle('hide', !extension.repository);
if (extension.repository) {
this.transientDisposables.add(this.onClick(template.repository, () => this.openerService.open(URI.parse(extension.repository!))));
}
template.license.parentElement?.classList.toggle('hide', !extension.url || !extension.licenseUrl);
template.version.textContent = `v${extension.version}`;
if (extension.url) {
this.transientDisposables.add(this.onClick(template.name, () => this.openerService.open(URI.parse(extension.url!))));
this.transientDisposables.add(this.onClick(template.rating, () => this.openerService.open(URI.parse(`${extension.url}#review-details`))));
@ -387,23 +391,9 @@ export class ExtensionEditor extends EditorPane {
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => viewlet.search(`publisher:"${extension.publisherDisplayName}"`));
}));
if (extension.licenseUrl) {
this.transientDisposables.add(this.onClick(template.license, () => this.openerService.open(URI.parse(extension.licenseUrl!))));
template.license.style.display = 'initial';
} else {
template.license.style.display = 'none';
}
} else {
template.license.style.display = 'none';
}
if (extension.repository) {
this.transientDisposables.add(this.onClick(template.repository, () => this.openerService.open(URI.parse(extension.repository!))));
template.repository.style.display = 'initial';
}
else {
template.repository.style.display = 'none';
}
const widgets = [

View file

@ -197,7 +197,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
[WORKSPACE_TRUST_EXTENSION_SUPPORT]: {
type: 'object',
scope: ConfigurationScope.APPLICATION,
markdownDescription: localize('extensions.supportUntrustedWorkspaces', "Override the untrusted workpace support of an extension. Extensions using `true` will always be enabled. Extensions using `limited` will always be enabled, and the extension will hide functionality that requires trust. Extensions using `false` will only be enabled only when the workspace is trusted."),
markdownDescription: localize('extensions.supportUntrustedWorkspaces', "Override the untrusted workspace support of an extension. Extensions using `true` will always be enabled. Extensions using `limited` will always be enabled, and the extension will hide functionality that requires trust. Extensions using `false` will only be enabled only when the workspace is trusted."),
patternProperties: {
'([a-z0-9A-Z][a-z0-9\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\-A-Z]*)$': {
type: 'object',

View file

@ -18,7 +18,7 @@ import { IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, I
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IWorkbenchExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionRecommendationReason, IExtensionIgnoredRecommendationsService, IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension, getWorkpaceSupportTypeMessage } from 'vs/platform/extensions/common/extensions';
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension, getWorkspaceSupportTypeMessage } from 'vs/platform/extensions/common/extensions';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IFileService, IFileContent } from 'vs/platform/files/common/files';
@ -457,8 +457,6 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
private readonly canInstallAnyWhere: boolean,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService protected readonly extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService private readonly extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(id, InstallInOtherServerAction.INSTALL_LABEL, InstallInOtherServerAction.Class, false);
@ -494,7 +492,7 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
|| !this.extension.local
|| this.extension.state !== ExtensionState.Installed
|| this.extension.type !== ExtensionType.User
|| this.extension.enablementState === EnablementState.DisabledByEnvironment
|| this.extension.enablementState === EnablementState.DisabledByEnvironment || this.extension.enablementState === EnablementState.DisabledByTrustRequirement || this.extension.enablementState === EnablementState.DisabledByVirtualWorkspace
) {
return false;
}
@ -558,11 +556,9 @@ export class RemoteInstallAction extends InstallInOtherServerAction {
canInstallAnyWhere: boolean,
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.remoteinstall`, extensionManagementServerService.remoteExtensionManagementServer, canInstallAnyWhere, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
super(`extensions.remoteinstall`, extensionManagementServerService.remoteExtensionManagementServer, canInstallAnyWhere, extensionsWorkbenchService, extensionManagementServerService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
@ -578,11 +574,9 @@ export class LocalInstallAction extends InstallInOtherServerAction {
constructor(
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.localinstall`, extensionManagementServerService.localExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
super(`extensions.localinstall`, extensionManagementServerService.localExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
@ -596,11 +590,9 @@ export class WebInstallAction extends InstallInOtherServerAction {
constructor(
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.webInstall`, extensionManagementServerService.webExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
super(`extensions.webInstall`, extensionManagementServerService.webExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
@ -2118,7 +2110,7 @@ export class SystemDisabledWarningAction extends ExtensionAction {
}
const virtualSupportType = this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(this.extension.local.manifest);
const details = getWorkpaceSupportTypeMessage(this.extension.local.manifest.capabilities?.virtualWorkspaces);
const details = getWorkspaceSupportTypeMessage(this.extension.local.manifest.capabilities?.virtualWorkspaces);
if (virtualSupportType === 'limited' || details) {
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
this.tooltip = localize('extension limited because of virtual workspace', "This extension has limited features because the current workspace is virtual.");
@ -2176,9 +2168,9 @@ export class SystemDisabledWarningAction extends ExtensionAction {
}
}
if (this.workspaceTrustService.workspaceTrustEnabled && !this.workspaceTrustService.isWorkpaceTrusted() && this.extension.enablementState === EnablementState.DisabledByTrustRequirement) {
if (this.workspaceTrustService.workspaceTrustEnabled && !this.workspaceTrustService.isWorkspaceTrusted() && this.extension.enablementState === EnablementState.DisabledByTrustRequirement) {
const untrustedSupportType = this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(this.extension.local.manifest);
const untrustedDetails = getWorkpaceSupportTypeMessage(this.extension.local.manifest.capabilities?.untrustedWorkspaces);
const untrustedDetails = getWorkspaceSupportTypeMessage(this.extension.local.manifest.capabilities?.untrustedWorkspaces);
this.enabled = true;
this.class = `${SystemDisabledWarningAction.TRUST_CLASS}`;

View file

@ -37,7 +37,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria';
import { IListContextMenuEvent } from 'vs/base/browser/ui/list/list';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IAction, Action, Separator, ActionRunner } from 'vs/base/common/actions';
import { ExtensionIdentifier, ExtensionUntrustedWorkpaceSupportType, ExtensionVirtualWorkpaceSupportType, IExtensionDescription, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
import { ExtensionIdentifier, ExtensionUntrustedWorkspaceSupportType, ExtensionVirtualWorkspaceSupportType, IExtensionDescription, isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
import { IProductService } from 'vs/platform/product/common/productService';
import { SeverityIcon } from 'vs/platform/severityIcon/common/severityIcon';
@ -569,8 +569,8 @@ export class ExtensionsListView extends ViewPane {
local = local.filter(extension => extension.name.toLowerCase().indexOf(nameFilter) > -1 || extension.displayName.toLowerCase().indexOf(nameFilter) > -1);
}
const hasVirtualSupportType = (extension: IExtension, supportType: ExtensionVirtualWorkpaceSupportType) => extension.local && this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(extension.local.manifest) === supportType;
const hasRestrictedSupportType = (extension: IExtension, supportType: ExtensionUntrustedWorkpaceSupportType) => {
const hasVirtualSupportType = (extension: IExtension, supportType: ExtensionVirtualWorkspaceSupportType) => extension.local && this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(extension.local.manifest) === supportType;
const hasRestrictedSupportType = (extension: IExtension, supportType: ExtensionUntrustedWorkspaceSupportType) => {
if (!extension.local) {
return false;
}
@ -588,7 +588,7 @@ export class ExtensionsListView extends ViewPane {
};
const inVirtualWorkspace = isVirtualWorkspace(this.workspaceService.getWorkspace());
const inRestrictedWorkspace = !this.workspaceTrustManagementService.isWorkpaceTrusted();
const inRestrictedWorkspace = !this.workspaceTrustManagementService.isWorkspaceTrusted();
if (type === 'virtual') {
// show limited and disabled extensions unless disabled because of a untrusted workspace

View file

@ -112,6 +112,10 @@
line-height: 20px;
}
.extension-editor > .header > .details > .subtitle .hide {
display: none;
}
.extension-editor > .header > .details > .subtitle .publisher {
font-size: 18px;
}

View file

@ -8,9 +8,10 @@ import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { EditorInputCapabilities, IEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IExtension } from 'vs/workbench/contrib/extensions/common/extensions';
import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { join } from 'vs/base/common/path';
export class ExtensionsInput extends EditorInput {
static readonly ID = 'workbench.extensions.input2';
@ -26,18 +27,26 @@ export class ExtensionsInput extends EditorInput {
override get resource() {
return URI.from({
scheme: Schemas.extension,
path: join(this.extension.identifier.id, 'extension')
path: join(this._extension.identifier.id, 'extension')
});
}
constructor(
public readonly extension: IExtension
private _extension: IExtension,
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService
) {
super();
this._register(extensionsWorkbenchService.onChange(extension => {
if (extension && areSameExtensions(this._extension.identifier, extension.identifier)) {
this._extension = extension;
}
}));
}
get extension(): IExtension { return this._extension; }
override getName(): string {
return localize('extensionsInputName', "Extension: {0}", this.extension.displayName);
return localize('extensionsInputName', "Extension: {0}", this._extension.displayName);
}
override matches(other: IEditorInput | IUntypedEditorInput): boolean {
@ -45,6 +54,6 @@ export class ExtensionsInput extends EditorInput {
return true;
}
return other instanceof ExtensionsInput && areSameExtensions(this.extension.identifier, other.extension.identifier);
return other instanceof ExtensionsInput && areSameExtensions(this._extension.identifier, other._extension.identifier);
}
}

View file

@ -78,10 +78,10 @@ export class TextFileSaveErrorHandler extends Disposable implements ISaveErrorHa
const activeInput = this.editorService.activeEditor;
if (activeInput instanceof DiffEditorInput) {
const resource = activeInput.originalInput.resource;
const resource = activeInput.original.resource;
if (resource?.scheme === CONFLICT_RESOLUTION_SCHEME) {
isActiveEditorSaveConflictResolution = true;
activeConflictResolutionResource = activeInput.modifiedInput.resource;
activeConflictResolutionResource = activeInput.modified.resource;
}
}

View file

@ -454,8 +454,8 @@ export class GlobalCompareResourcesAction extends Action {
const resource = (picks[0] as unknown as { resource: unknown }).resource;
if (URI.isUri(resource) && this.textModelService.canHandleResource(resource)) {
this.editorService.openEditor({
originalInput: { resource: activeResource },
modifiedInput: { resource: resource },
original: { resource: activeResource },
modified: { resource: resource },
options: { pinned: true }
});
}
@ -730,8 +730,8 @@ export class CompareWithClipboardAction extends Action {
const editorLabel = nls.localize('clipboardComparisonLabel', "Clipboard ↔ {0}", name);
await this.editorService.openEditor({
originalInput: { resource: resource.with({ scheme }) },
modifiedInput: { resource: resource },
original: { resource: resource.with({ scheme }) },
modified: { resource: resource },
label: editorLabel,
options: { pinned: true }
}).finally(() => {

View file

@ -244,8 +244,8 @@ CommandsRegistry.registerCommand({
if (resources.length === 2) {
return editorService.openEditor({
originalInput: { resource: resources[0] },
modifiedInput: { resource: resources[1] },
original: { resource: resources[0] },
modified: { resource: resources[1] },
options: { pinned: true }
});
}
@ -263,8 +263,8 @@ CommandsRegistry.registerCommand({
const rightResource = getResourceForCommand(resource, listService, editorService);
if (globalResourceToCompare && rightResource) {
editorService.openEditor({
originalInput: { resource: globalResourceToCompare },
modifiedInput: { resource: rightResource },
original: { resource: globalResourceToCompare },
modified: { resource: rightResource },
options: { pinned: true }
});
}

View file

@ -132,8 +132,8 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
static async open(resource: URI, scheme: string, label: string, editorService: IEditorService, options?: ITextEditorOptions): Promise<void> {
await editorService.openEditor({
originalInput: { resource: TextFileContentProvider.resourceToTextFile(scheme, resource) },
modifiedInput: { resource },
original: { resource: TextFileContentProvider.resourceToTextFile(scheme, resource) },
modified: { resource },
label,
options
});

View file

@ -83,7 +83,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
if (!this.galleryService.isEnabled()) {
return;
}
if (!language || !locale || language === 'en' || language.indexOf('en-') === 0) {
if (!language || !locale || locale === 'en' || locale.indexOf('en-') === 0) {
return;
}
if (language === locale || languagePackSuggestionIgnoreList.indexOf(language) > -1) {

View file

@ -7,13 +7,11 @@
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { ResourceMap } from 'vs/base/common/map';
import { isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { IDebugService, IThread } from 'vs/workbench/contrib/debug/common/debug';
import { Thread } from 'vs/workbench/contrib/debug/common/debugModel';
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { CellEditType, CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
@ -99,67 +97,3 @@ class NotebookBreakpoints extends Disposable implements IWorkbenchContribution {
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NotebookBreakpoints, LifecyclePhase.Restored);
class NotebookCellPausing extends Disposable implements IWorkbenchContribution {
private readonly _pausedCells = new Set<string>();
constructor(
@IDebugService private readonly _debugService: IDebugService,
@INotebookService private readonly _notebookService: INotebookService
) {
super();
this._register(_debugService.getModel().onDidChangeCallStack(this.onDidChangeCallStack, this));
}
private async onDidChangeCallStack(): Promise<void> {
const newPausedCells = new Set<string>();
const updateForThread = (thread: IThread): void => {
thread.getCallStack().forEach(sf => {
const parsed = CellUri.parse(sf.source.uri);
if (parsed) {
newPausedCells.add(sf.source.uri.toString());
this.editIsPaused(sf.source.uri, true);
}
});
};
const promises: Promise<void>[] = [];
for (const session of this._debugService.getModel().getSessions()) {
for (const thread of session.getAllThreads()) {
const callStack = thread.getCallStack();
if (callStack.length) {
updateForThread(thread);
} else {
promises.push(
(thread as Thread).fetchCallStack().then(() => updateForThread(thread)));
}
}
}
await Promise.all(promises);
for (const uri of this._pausedCells) {
if (!newPausedCells.has(uri)) {
this.editIsPaused(URI.parse(uri), false);
this._pausedCells.delete(uri);
}
}
newPausedCells.forEach(cell => this._pausedCells.add(cell));
}
private editIsPaused(cellUri: URI, isPaused: boolean) {
const parsed = CellUri.parse(cellUri);
if (parsed) {
const notebookModel = this._notebookService.getNotebookTextModel(parsed.notebook);
notebookModel?.applyEdits([{
editType: CellEditType.PartialInternalMetadata,
handle: parsed.handle,
internalMetadata: { isPaused },
}], true, undefined, () => undefined, undefined);
}
}
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NotebookCellPausing, LifecyclePhase.Restored);

View file

@ -23,7 +23,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { IAction } from 'vs/base/common/actions';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Delayer } from 'vs/base/common/async';
import { CodiconActionViewItem } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellActionView';
import { collapsedIcon, expandedIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons';
import { OutputContainer } from 'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs';
@ -1515,24 +1514,8 @@ export class ModifiedElement extends AbstractElementRenderer {
const textModel = originalRef.object.textEditorModel;
const modifiedTextModel = modifiedRef.object.textEditorModel;
this._register({
dispose: () => {
const delayer = new Delayer<void>(5000);
delayer.trigger(() => {
originalRef.dispose();
delayer.dispose();
});
}
});
this._register({
dispose: () => {
const delayer = new Delayer<void>(5000);
delayer.trigger(() => {
modifiedRef.dispose();
delayer.dispose();
});
}
});
this._register(originalRef);
this._register(modifiedRef);
this._editor!.setModel({
original: textModel,

View file

@ -48,8 +48,8 @@ registerAction2(class extends Action2 {
await editorService.openEditor(
{
originalInput: { resource: diffEditorInput.originalInput.resource },
modifiedInput: { resource: diffEditorInput.resource },
original: { resource: diffEditorInput.original.resource },
modified: { resource: diffEditorInput.resource },
label: diffEditorInput.getName(),
options: {
preserveFocus: false,

View file

@ -123,9 +123,9 @@ class NotebookDiffEditorSerializer implements IEditorInputSerializer {
assertType(input instanceof NotebookDiffEditorInput);
return JSON.stringify({
resource: input.resource,
originalResource: input.originalInput.resource,
originalResource: input.original.resource,
name: input.getName(),
originalName: input.originalInput.getName(),
originalName: input.original.getName(),
textDiffName: input.getName(),
viewType: input.viewType,
});

View file

@ -25,9 +25,9 @@ class NotebookDiffEditorModel extends EditorModel implements INotebookDiffEditor
export class NotebookDiffEditorInput extends DiffEditorInput {
static create(instantiationService: IInstantiationService, resource: URI, name: string | undefined, description: string | undefined, originalResource: URI, viewType: string) {
const originalInput = NotebookEditorInput.create(instantiationService, originalResource, viewType);
const modifiedInput = NotebookEditorInput.create(instantiationService, resource, viewType);
return instantiationService.createInstance(NotebookDiffEditorInput, name, description, originalInput, modifiedInput, viewType);
const original = NotebookEditorInput.create(instantiationService, originalResource, viewType);
const modified = NotebookEditorInput.create(instantiationService, resource, viewType);
return instantiationService.createInstance(NotebookDiffEditorInput, name, description, original, modified, viewType);
}
static override readonly ID: string = 'workbench.input.diffNotebookInput';
@ -36,7 +36,7 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
private _originalTextModel: IResolvedNotebookEditorModel | null = null;
override get resource() {
return this.modifiedInput.resource;
return this.modified.resource;
}
override get editorId() {
@ -48,8 +48,8 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
constructor(
name: string | undefined,
description: string | undefined,
override readonly originalInput: NotebookEditorInput,
override readonly modifiedInput: NotebookEditorInput,
override readonly original: NotebookEditorInput,
override readonly modified: NotebookEditorInput,
public readonly viewType: string,
@IFileService fileService: IFileService,
@ILabelService labelService: ILabelService,
@ -57,8 +57,8 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
super(
name,
description,
originalInput,
modifiedInput,
original,
modified,
undefined,
labelService,
fileService
@ -71,19 +71,19 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
override async resolve(): Promise<NotebookDiffEditorModel> {
const [originalEditorModel, modifiedEditorModel] = await Promise.all([
this.originalInput.resolve(),
this.modifiedInput.resolve(),
this.original.resolve(),
this.modified.resolve(),
]);
this._cachedModel?.dispose();
// TODO@rebornix check how we restore the editor in text diff editor
if (!modifiedEditorModel) {
throw new Error(`Fail to resolve modified editor model for resource ${this.modifiedInput.resource} with notebookType ${this.viewType}`);
throw new Error(`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`);
}
if (!originalEditorModel) {
throw new Error(`Fail to resolve original editor model for resource ${this.originalInput.resource} with notebookType ${this.viewType}`);
throw new Error(`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`);
}
this._originalTextModel = originalEditorModel;
@ -94,8 +94,8 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
override toUntyped(group: GroupIdentifier | undefined, context: UntypedEditorContext): IResourceDiffEditorInput {
return {
originalInput: { resource: this.originalInput.resource },
modifiedInput: { resource: this.resource },
original: { resource: this.original.resource },
modified: { resource: this.resource },
options: {
override: this.viewType
}
@ -108,7 +108,7 @@ export class NotebookDiffEditorInput extends DiffEditorInput {
}
if (isResourceDiffEditorInput(otherInput)) {
return this.primary.matches(otherInput.modifiedInput) && this.secondary.matches(otherInput.originalInput) && this.editorId !== undefined && this.editorId === otherInput.options?.override;
return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original) && this.editorId !== undefined && this.editorId === otherInput.options?.override;
}
if (otherInput instanceof NotebookDiffEditorInput) {

View file

@ -178,10 +178,8 @@ export class NotebookProviderInfoStore extends Disposable {
}
return { editor: NotebookEditorInput.create(this._instantiationService, resource.with({ scheme: Schemas.untitled }), notebookProviderInfo.id), options };
};
const notebookDiffEditorInputFactory: DiffEditorInputFactoryFunction = diffEditorInput => {
const modifiedInput = diffEditorInput.modifiedInput;
const originalInput = diffEditorInput.originalInput;
return { editor: NotebookDiffEditorInput.create(this._instantiationService, modifiedInput.resource!, undefined, undefined, originalInput.resource!, notebookProviderInfo.id) };
const notebookDiffEditorInputFactory: DiffEditorInputFactoryFunction = ({ modified, original }) => {
return { editor: NotebookDiffEditorInput.create(this._instantiationService, modified.resource!, undefined, undefined, original.resource!, notebookProviderInfo.id) };
};
// Register the notebook editor
disposables.add(this._editorOverrideService.registerEditor(
@ -613,7 +611,7 @@ export class NotebookService extends Disposable implements INotebookService {
orderMimeTypes.push({
mimeType: mimeType,
rendererId: BUILTIN_RENDERER_ID,
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || this.workspaceTrustManagementService.isWorkpaceTrusted()
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || this.workspaceTrustManagementService.isWorkspaceTrusted()
});
}
} else {
@ -621,7 +619,7 @@ export class NotebookService extends Disposable implements INotebookService {
orderMimeTypes.push({
mimeType: mimeType,
rendererId: BUILTIN_RENDERER_ID,
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || this.workspaceTrustManagementService.isWorkpaceTrusted()
isTrusted: mimeTypeIsAlwaysSecure(mimeType) || this.workspaceTrustManagementService.isWorkspaceTrusted()
});
} else {
orderMimeTypes.push({

View file

@ -1413,8 +1413,9 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
updateDrag(e: DragEvent, cellId: string) {
if (cellId !== this.currentDrag?.cellId) {
this.currentDrag = undefined;
} else {
this.currentDrag = { cellId, clientY: e.clientY };
}
this.currentDrag = { cellId, clientY: e.clientY };
}
endDrag(e: DragEvent, cellId: string) {

View file

@ -89,7 +89,7 @@ export class StartupTimings implements IWorkbenchContribution {
if (this._lifecycleService.startupKind !== StartupKind.NewWindow) {
return StartupKindToString(this._lifecycleService.startupKind);
}
if (!this._workspaceTrustService.isWorkpaceTrusted()) {
if (!this._workspaceTrustService.isWorkspaceTrusted()) {
return 'Workspace not trusted';
}
const windowCount = await this._nativeHostService.getWindowCount();

Some files were not shown because too many files have changed in this diff Show more