Skip to content

Commit 611bbad

Browse files
committed
Merge branch 'master' into joh/cell-output
2 parents b297be5 + dab1430 commit 611bbad

59 files changed

Lines changed: 332 additions & 220 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/git/src/decorationProvider.ts

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

6-
import { window, workspace, Uri, Disposable, Event, EventEmitter, Decoration, DecorationProvider, ThemeColor } from 'vscode';
6+
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor } from 'vscode';
77
import * as path from 'path';
88
import { Repository, GitResourceGroup } from './repository';
99
import { Model } from './model';
1010
import { debounce } from './decorators';
1111
import { filterEvent, dispose, anyEvent, fireEvent, PromiseSource } from './util';
1212
import { GitErrorCodes, Status } from './api/git';
1313

14-
class GitIgnoreDecorationProvider implements DecorationProvider {
14+
class GitIgnoreDecorationProvider implements FileDecorationProvider {
1515

16-
private static Decoration: Decoration = { priority: 3, color: new ThemeColor('gitDecoration.ignoredResourceForeground') };
16+
private static Decoration: FileDecoration = { color: new ThemeColor('gitDecoration.ignoredResourceForeground') };
1717

18-
readonly onDidChangeDecorations: Event<Uri[]>;
19-
private queue = new Map<string, { repository: Repository; queue: Map<string, PromiseSource<Decoration | undefined>>; }>();
18+
readonly onDidChange: Event<Uri[]>;
19+
private queue = new Map<string, { repository: Repository; queue: Map<string, PromiseSource<FileDecoration | undefined>>; }>();
2020
private disposables: Disposable[] = [];
2121

2222
constructor(private model: Model) {
23-
this.onDidChangeDecorations = fireEvent(anyEvent<any>(
23+
this.onDidChange = fireEvent(anyEvent<any>(
2424
filterEvent(workspace.onDidSaveTextDocument, e => /\.gitignore$|\.git\/info\/exclude$/.test(e.uri.path)),
2525
model.onDidOpenRepository,
2626
model.onDidCloseRepository
@@ -29,7 +29,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
2929
this.disposables.push(window.registerDecorationProvider(this));
3030
}
3131

32-
async provideDecoration(uri: Uri): Promise<Decoration | undefined> {
32+
async provideFileDecoration(uri: Uri): Promise<FileDecoration | undefined> {
3333
const repository = this.model.getRepository(uri);
3434

3535
if (!repository) {
@@ -39,7 +39,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
3939
let queueItem = this.queue.get(repository.root);
4040

4141
if (!queueItem) {
42-
queueItem = { repository, queue: new Map<string, PromiseSource<Decoration | undefined>>() };
42+
queueItem = { repository, queue: new Map<string, PromiseSource<FileDecoration | undefined>>() };
4343
this.queue.set(repository.root, queueItem);
4444
}
4545

@@ -84,19 +84,19 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
8484
}
8585
}
8686

87-
class GitDecorationProvider implements DecorationProvider {
87+
class GitDecorationProvider implements FileDecorationProvider {
8888

89-
private static SubmoduleDecorationData: Decoration = {
90-
title: 'Submodule',
91-
letter: 'S',
89+
private static SubmoduleDecorationData: FileDecoration = {
90+
tooltip: 'Submodule',
91+
badge: 'S',
9292
color: new ThemeColor('gitDecoration.submoduleResourceForeground')
9393
};
9494

9595
private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
96-
readonly onDidChangeDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
96+
readonly onDidChange: Event<Uri[]> = this._onDidChangeDecorations.event;
9797

9898
private disposables: Disposable[] = [];
99-
private decorations = new Map<string, Decoration>();
99+
private decorations = new Map<string, FileDecoration>();
100100

101101
constructor(private repository: Repository) {
102102
this.disposables.push(
@@ -106,7 +106,7 @@ class GitDecorationProvider implements DecorationProvider {
106106
}
107107

108108
private onDidRunGitStatus(): void {
109-
let newDecorations = new Map<string, Decoration>();
109+
let newDecorations = new Map<string, FileDecoration>();
110110

111111
this.collectSubmoduleDecorationData(newDecorations);
112112
this.collectDecorationData(this.repository.indexGroup, newDecorations);
@@ -119,7 +119,7 @@ class GitDecorationProvider implements DecorationProvider {
119119
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
120120
}
121121

122-
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, Decoration>): void {
122+
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, FileDecoration>): void {
123123
for (const r of group.resourceStates) {
124124
const decoration = r.resourceDecoration;
125125

@@ -134,13 +134,13 @@ class GitDecorationProvider implements DecorationProvider {
134134
}
135135
}
136136

137-
private collectSubmoduleDecorationData(bucket: Map<string, Decoration>): void {
137+
private collectSubmoduleDecorationData(bucket: Map<string, FileDecoration>): void {
138138
for (const submodule of this.repository.submodules) {
139139
bucket.set(Uri.file(path.join(this.repository.root, submodule.path)).toString(), GitDecorationProvider.SubmoduleDecorationData);
140140
}
141141
}
142142

143-
provideDecoration(uri: Uri): Decoration | undefined {
143+
provideFileDecoration(uri: Uri): FileDecoration | undefined {
144144
return this.decorations.get(uri.toString());
145145
}
146146

extensions/git/src/repository.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as fs from 'fs';
77
import * as path from 'path';
8-
import { CancellationToken, Command, Disposable, Event, EventEmitter, Memento, OutputChannel, ProgressLocation, ProgressOptions, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, ThemeColor, Uri, window, workspace, WorkspaceEdit, Decoration } from 'vscode';
8+
import { CancellationToken, Command, Disposable, Event, EventEmitter, Memento, OutputChannel, ProgressLocation, ProgressOptions, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, ThemeColor, Uri, window, workspace, WorkspaceEdit, FileDecoration } from 'vscode';
99
import * as nls from 'vscode-nls';
1010
import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status, CommitOptions, BranchQuery } from './api/git';
1111
import { AutoFetcher } from './autofetch';
@@ -253,14 +253,10 @@ export class Resource implements SourceControlResourceState {
253253
}
254254
}
255255

256-
get resourceDecoration(): Decoration {
257-
return {
258-
bubble: this.type !== Status.DELETED && this.type !== Status.INDEX_DELETED,
259-
title: this.tooltip,
260-
letter: this.letter,
261-
color: this.color,
262-
priority: this.priority
263-
};
256+
get resourceDecoration(): FileDecoration {
257+
const res = new FileDecoration(this.letter, this.tooltip, this.color);
258+
res.propagate = this.type !== Status.DELETED && this.type !== Status.INDEX_DELETED;
259+
return res;
264260
}
265261

266262
constructor(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.50.0",
4-
"distro": "20bcc93e22ceef0a6c4464ae78363429f59be797",
4+
"distro": "f4fbb2133880d47be366fb94ea9d149862bddaf3",
55
"author": {
66
"name": "Microsoft Corporation"
77
},

src/bootstrap-amd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const nlsConfig = bootstrap.setupNLS();
1414

1515
// Bootstrap: Loader
1616
loader.config({
17-
baseUrl: bootstrap.fileUriFromPath(__dirname, process.platform === 'win32'),
17+
baseUrl: bootstrap.fileUriFromPath(__dirname, { isWindows: process.platform === 'win32' }),
1818
catchError: true,
1919
nodeRequire: require,
2020
nodeMain: __filename,

src/bootstrap-window.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
window['MonacoEnvironment'] = {};
104104

105105
const loaderConfig = {
106-
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, safeProcess.platform === 'win32')}/out`,
106+
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32' })}/out`,
107107
'vs/nls': nlsConfig
108108
};
109109

@@ -241,7 +241,7 @@
241241
}
242242

243243
/**
244-
* @return {{ fileUriFromPath: (path: string, isWindows: boolean) => string; }}
244+
* @return {{ fileUriFromPath: (path: string, config: { isWindows?: boolean, scheme?: string, fallbackAuthority?: string }) => string; }}
245245
*/
246246
function bootstrap() {
247247
// @ts-ignore (defined in bootstrap.js)

src/bootstrap.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,31 @@
8888

8989
/**
9090
* @param {string} path
91-
* @param {boolean} isWindows
91+
* @param {{ isWindows?: boolean, scheme?: string, fallbackAuthority?: string }} config
9292
* @returns {string}
9393
*/
94-
function fileUriFromPath(path, isWindows) {
94+
function fileUriFromPath(path, config) {
95+
96+
// Since we are building a URI, we normalize any backlsash
97+
// to slashes and we ensure that the path begins with a '/'.
9598
let pathName = path.replace(/\\/g, '/');
9699
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
97100
pathName = `/${pathName}`;
98101
}
99102

100103
/** @type {string} */
101104
let uri;
102-
if (isWindows && pathName.startsWith('//')) { // specially handle Windows UNC paths
103-
uri = encodeURI(`file:${pathName}`);
104-
} else {
105-
uri = encodeURI(`file://${pathName}`);
105+
106+
// Windows: in order to support UNC paths (which start with '//')
107+
// that have their own authority, we do not use the provided authority
108+
// but rather preserve it.
109+
if (config.isWindows && pathName.startsWith('//')) {
110+
uri = encodeURI(`${config.scheme || 'file'}:${pathName}`);
111+
}
112+
113+
// Otherwise we optionally add the provided authority if specified
114+
else {
115+
uri = encodeURI(`${config.scheme || 'file'}://${config.fallbackAuthority || ''}${pathName}`);
106116
}
107117

108118
return uri.replace(/#/g, '%23');

src/typings/require.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ declare const define: {
4141
};
4242

4343
interface NodeRequire {
44+
/**
45+
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
46+
*/
4447
toUrl(path: string): string;
4548
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
4649
config(data: any): any;

src/vs/base/browser/dom.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Emitter, Event } from 'vs/base/common/event';
1313
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
1414
import * as platform from 'vs/base/common/platform';
1515
import { URI } from 'vs/base/common/uri';
16-
import { Schemas, RemoteAuthorities } from 'vs/base/common/network';
16+
import { Schemas, FileAccess, RemoteAuthorities } from 'vs/base/common/network';
1717
import { BrowserFeatures } from 'vs/base/browser/canIUse';
1818

1919
export function clearNode(node: HTMLElement): void {
@@ -1223,10 +1223,12 @@ export function asDomUri(uri: URI): URI {
12231223
if (!uri) {
12241224
return uri;
12251225
}
1226-
if (Schemas.vscodeRemote === uri.scheme) {
1226+
1227+
if (uri.scheme === Schemas.vscodeRemote) {
12271228
return RemoteAuthorities.rewrite(uri);
12281229
}
1229-
return uri;
1230+
1231+
return FileAccess.asBrowserUri(uri);
12301232
}
12311233

12321234
/**

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function asListOptions<T, TFilterData, TRef>(modelProvider: () => ITreeModel<T,
186186
return options.accessibilityProvider!.getWidgetAriaLabel();
187187
},
188188
getWidgetRole: options.accessibilityProvider && options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider!.getWidgetRole!() : () => 'tree',
189-
getAriaLevel(node) {
189+
getAriaLevel: options.accessibilityProvider && options.accessibilityProvider.getAriaLevel ? (node) => options.accessibilityProvider!.getAriaLevel!(node.element) : (node) => {
190190
return node.depth;
191191
},
192192
getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => {

src/vs/base/common/amd.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55

66
import { URI } from 'vs/base/common/uri';
77

8+
/**
9+
* @deprecated use `FileAccess.asFileUri(relativePath, requireFn).fsPath`
10+
*/
811
export function getPathFromAmdModule(requirefn: typeof require, relativePath: string): string {
912
return getUriFromAmdModule(requirefn, relativePath).fsPath;
1013
}
1114

15+
/**
16+
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
17+
*/
1218
export function getUriFromAmdModule(requirefn: typeof require, relativePath: string): URI {
1319
return URI.parse(requirefn.toUrl(relativePath));
1420
}

0 commit comments

Comments
 (0)