mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Merge branch 'master' into joh/cell-output
This commit is contained in:
commit
611bbad868
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { window, workspace, Uri, Disposable, Event, EventEmitter, Decoration, DecorationProvider, ThemeColor } from 'vscode';
|
||||
import { window, workspace, Uri, Disposable, Event, EventEmitter, FileDecoration, FileDecorationProvider, ThemeColor } from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { Repository, GitResourceGroup } from './repository';
|
||||
import { Model } from './model';
|
||||
|
@ -11,16 +11,16 @@ import { debounce } from './decorators';
|
|||
import { filterEvent, dispose, anyEvent, fireEvent, PromiseSource } from './util';
|
||||
import { GitErrorCodes, Status } from './api/git';
|
||||
|
||||
class GitIgnoreDecorationProvider implements DecorationProvider {
|
||||
class GitIgnoreDecorationProvider implements FileDecorationProvider {
|
||||
|
||||
private static Decoration: Decoration = { priority: 3, color: new ThemeColor('gitDecoration.ignoredResourceForeground') };
|
||||
private static Decoration: FileDecoration = { color: new ThemeColor('gitDecoration.ignoredResourceForeground') };
|
||||
|
||||
readonly onDidChangeDecorations: Event<Uri[]>;
|
||||
private queue = new Map<string, { repository: Repository; queue: Map<string, PromiseSource<Decoration | undefined>>; }>();
|
||||
readonly onDidChange: Event<Uri[]>;
|
||||
private queue = new Map<string, { repository: Repository; queue: Map<string, PromiseSource<FileDecoration | undefined>>; }>();
|
||||
private disposables: Disposable[] = [];
|
||||
|
||||
constructor(private model: Model) {
|
||||
this.onDidChangeDecorations = fireEvent(anyEvent<any>(
|
||||
this.onDidChange = fireEvent(anyEvent<any>(
|
||||
filterEvent(workspace.onDidSaveTextDocument, e => /\.gitignore$|\.git\/info\/exclude$/.test(e.uri.path)),
|
||||
model.onDidOpenRepository,
|
||||
model.onDidCloseRepository
|
||||
|
@ -29,7 +29,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
|
|||
this.disposables.push(window.registerDecorationProvider(this));
|
||||
}
|
||||
|
||||
async provideDecoration(uri: Uri): Promise<Decoration | undefined> {
|
||||
async provideFileDecoration(uri: Uri): Promise<FileDecoration | undefined> {
|
||||
const repository = this.model.getRepository(uri);
|
||||
|
||||
if (!repository) {
|
||||
|
@ -39,7 +39,7 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
|
|||
let queueItem = this.queue.get(repository.root);
|
||||
|
||||
if (!queueItem) {
|
||||
queueItem = { repository, queue: new Map<string, PromiseSource<Decoration | undefined>>() };
|
||||
queueItem = { repository, queue: new Map<string, PromiseSource<FileDecoration | undefined>>() };
|
||||
this.queue.set(repository.root, queueItem);
|
||||
}
|
||||
|
||||
|
@ -84,19 +84,19 @@ class GitIgnoreDecorationProvider implements DecorationProvider {
|
|||
}
|
||||
}
|
||||
|
||||
class GitDecorationProvider implements DecorationProvider {
|
||||
class GitDecorationProvider implements FileDecorationProvider {
|
||||
|
||||
private static SubmoduleDecorationData: Decoration = {
|
||||
title: 'Submodule',
|
||||
letter: 'S',
|
||||
private static SubmoduleDecorationData: FileDecoration = {
|
||||
tooltip: 'Submodule',
|
||||
badge: 'S',
|
||||
color: new ThemeColor('gitDecoration.submoduleResourceForeground')
|
||||
};
|
||||
|
||||
private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
|
||||
readonly onDidChangeDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
|
||||
readonly onDidChange: Event<Uri[]> = this._onDidChangeDecorations.event;
|
||||
|
||||
private disposables: Disposable[] = [];
|
||||
private decorations = new Map<string, Decoration>();
|
||||
private decorations = new Map<string, FileDecoration>();
|
||||
|
||||
constructor(private repository: Repository) {
|
||||
this.disposables.push(
|
||||
|
@ -106,7 +106,7 @@ class GitDecorationProvider implements DecorationProvider {
|
|||
}
|
||||
|
||||
private onDidRunGitStatus(): void {
|
||||
let newDecorations = new Map<string, Decoration>();
|
||||
let newDecorations = new Map<string, FileDecoration>();
|
||||
|
||||
this.collectSubmoduleDecorationData(newDecorations);
|
||||
this.collectDecorationData(this.repository.indexGroup, newDecorations);
|
||||
|
@ -119,7 +119,7 @@ class GitDecorationProvider implements DecorationProvider {
|
|||
this._onDidChangeDecorations.fire([...uris.values()].map(value => Uri.parse(value, true)));
|
||||
}
|
||||
|
||||
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, Decoration>): void {
|
||||
private collectDecorationData(group: GitResourceGroup, bucket: Map<string, FileDecoration>): void {
|
||||
for (const r of group.resourceStates) {
|
||||
const decoration = r.resourceDecoration;
|
||||
|
||||
|
@ -134,13 +134,13 @@ class GitDecorationProvider implements DecorationProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private collectSubmoduleDecorationData(bucket: Map<string, Decoration>): void {
|
||||
private collectSubmoduleDecorationData(bucket: Map<string, FileDecoration>): void {
|
||||
for (const submodule of this.repository.submodules) {
|
||||
bucket.set(Uri.file(path.join(this.repository.root, submodule.path)).toString(), GitDecorationProvider.SubmoduleDecorationData);
|
||||
}
|
||||
}
|
||||
|
||||
provideDecoration(uri: Uri): Decoration | undefined {
|
||||
provideFileDecoration(uri: Uri): FileDecoration | undefined {
|
||||
return this.decorations.get(uri.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
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';
|
||||
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';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status, CommitOptions, BranchQuery } from './api/git';
|
||||
import { AutoFetcher } from './autofetch';
|
||||
|
@ -253,14 +253,10 @@ export class Resource implements SourceControlResourceState {
|
|||
}
|
||||
}
|
||||
|
||||
get resourceDecoration(): Decoration {
|
||||
return {
|
||||
bubble: this.type !== Status.DELETED && this.type !== Status.INDEX_DELETED,
|
||||
title: this.tooltip,
|
||||
letter: this.letter,
|
||||
color: this.color,
|
||||
priority: this.priority
|
||||
};
|
||||
get resourceDecoration(): FileDecoration {
|
||||
const res = new FileDecoration(this.letter, this.tooltip, this.color);
|
||||
res.propagate = this.type !== Status.DELETED && this.type !== Status.INDEX_DELETED;
|
||||
return res;
|
||||
}
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.50.0",
|
||||
"distro": "20bcc93e22ceef0a6c4464ae78363429f59be797",
|
||||
"distro": "f4fbb2133880d47be366fb94ea9d149862bddaf3",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
2
src/bootstrap-amd.js
vendored
2
src/bootstrap-amd.js
vendored
|
@ -14,7 +14,7 @@ const nlsConfig = bootstrap.setupNLS();
|
|||
|
||||
// Bootstrap: Loader
|
||||
loader.config({
|
||||
baseUrl: bootstrap.fileUriFromPath(__dirname, process.platform === 'win32'),
|
||||
baseUrl: bootstrap.fileUriFromPath(__dirname, { isWindows: process.platform === 'win32' }),
|
||||
catchError: true,
|
||||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
|
|
4
src/bootstrap-window.js
vendored
4
src/bootstrap-window.js
vendored
|
@ -103,7 +103,7 @@
|
|||
window['MonacoEnvironment'] = {};
|
||||
|
||||
const loaderConfig = {
|
||||
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, safeProcess.platform === 'win32')}/out`,
|
||||
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32' })}/out`,
|
||||
'vs/nls': nlsConfig
|
||||
};
|
||||
|
||||
|
@ -241,7 +241,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {{ fileUriFromPath: (path: string, isWindows: boolean) => string; }}
|
||||
* @return {{ fileUriFromPath: (path: string, config: { isWindows?: boolean, scheme?: string, fallbackAuthority?: string }) => string; }}
|
||||
*/
|
||||
function bootstrap() {
|
||||
// @ts-ignore (defined in bootstrap.js)
|
||||
|
|
22
src/bootstrap.js
vendored
22
src/bootstrap.js
vendored
|
@ -88,10 +88,13 @@
|
|||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {boolean} isWindows
|
||||
* @param {{ isWindows?: boolean, scheme?: string, fallbackAuthority?: string }} config
|
||||
* @returns {string}
|
||||
*/
|
||||
function fileUriFromPath(path, isWindows) {
|
||||
function fileUriFromPath(path, config) {
|
||||
|
||||
// Since we are building a URI, we normalize any backlsash
|
||||
// to slashes and we ensure that the path begins with a '/'.
|
||||
let pathName = path.replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = `/${pathName}`;
|
||||
|
@ -99,10 +102,17 @@
|
|||
|
||||
/** @type {string} */
|
||||
let uri;
|
||||
if (isWindows && pathName.startsWith('//')) { // specially handle Windows UNC paths
|
||||
uri = encodeURI(`file:${pathName}`);
|
||||
} else {
|
||||
uri = encodeURI(`file://${pathName}`);
|
||||
|
||||
// Windows: in order to support UNC paths (which start with '//')
|
||||
// that have their own authority, we do not use the provided authority
|
||||
// but rather preserve it.
|
||||
if (config.isWindows && pathName.startsWith('//')) {
|
||||
uri = encodeURI(`${config.scheme || 'file'}:${pathName}`);
|
||||
}
|
||||
|
||||
// Otherwise we optionally add the provided authority if specified
|
||||
else {
|
||||
uri = encodeURI(`${config.scheme || 'file'}://${config.fallbackAuthority || ''}${pathName}`);
|
||||
}
|
||||
|
||||
return uri.replace(/#/g, '%23');
|
||||
|
|
3
src/typings/require.d.ts
vendored
3
src/typings/require.d.ts
vendored
|
@ -41,6 +41,9 @@ declare const define: {
|
|||
};
|
||||
|
||||
interface NodeRequire {
|
||||
/**
|
||||
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
|
||||
*/
|
||||
toUrl(path: string): string;
|
||||
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
|
||||
config(data: any): any;
|
||||
|
|
|
@ -13,7 +13,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
|||
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas, RemoteAuthorities } from 'vs/base/common/network';
|
||||
import { Schemas, FileAccess, RemoteAuthorities } from 'vs/base/common/network';
|
||||
import { BrowserFeatures } from 'vs/base/browser/canIUse';
|
||||
|
||||
export function clearNode(node: HTMLElement): void {
|
||||
|
@ -1223,10 +1223,12 @@ export function asDomUri(uri: URI): URI {
|
|||
if (!uri) {
|
||||
return uri;
|
||||
}
|
||||
if (Schemas.vscodeRemote === uri.scheme) {
|
||||
|
||||
if (uri.scheme === Schemas.vscodeRemote) {
|
||||
return RemoteAuthorities.rewrite(uri);
|
||||
}
|
||||
return uri;
|
||||
|
||||
return FileAccess.asBrowserUri(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -186,7 +186,7 @@ function asListOptions<T, TFilterData, TRef>(modelProvider: () => ITreeModel<T,
|
|||
return options.accessibilityProvider!.getWidgetAriaLabel();
|
||||
},
|
||||
getWidgetRole: options.accessibilityProvider && options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider!.getWidgetRole!() : () => 'tree',
|
||||
getAriaLevel(node) {
|
||||
getAriaLevel: options.accessibilityProvider && options.accessibilityProvider.getAriaLevel ? (node) => options.accessibilityProvider!.getAriaLevel!(node.element) : (node) => {
|
||||
return node.depth;
|
||||
},
|
||||
getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => {
|
||||
|
|
|
@ -5,10 +5,16 @@
|
|||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
/**
|
||||
* @deprecated use `FileAccess.asFileUri(relativePath, requireFn).fsPath`
|
||||
*/
|
||||
export function getPathFromAmdModule(requirefn: typeof require, relativePath: string): string {
|
||||
return getUriFromAmdModule(requirefn, relativePath).fsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
|
||||
*/
|
||||
export function getUriFromAmdModule(requirefn: typeof require, relativePath: string): URI {
|
||||
return URI.parse(requirefn.toUrl(relativePath));
|
||||
}
|
||||
|
|
|
@ -129,3 +129,40 @@ class RemoteAuthoritiesImpl {
|
|||
}
|
||||
|
||||
export const RemoteAuthorities = new RemoteAuthoritiesImpl();
|
||||
|
||||
class FileAccessImpl {
|
||||
|
||||
/**
|
||||
* Returns a URI to use in contexts where the browser is responsible
|
||||
* for loading (e.g. fetch()) or when used within the DOM.
|
||||
*/
|
||||
asBrowserUri(uri: URI): URI;
|
||||
asBrowserUri(moduleId: string, moduleIdToUrl: { toUrl(moduleId: string): string }): URI;
|
||||
asBrowserUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
|
||||
const uri = this.toUri(uriOrModule, moduleIdToUrl);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the `file` URI to use in contexts where node.js
|
||||
* is responsible for loading.
|
||||
*/
|
||||
asFileUri(uri: URI): URI;
|
||||
asFileUri(moduleId: string, moduleIdToUrl: { toUrl(moduleId: string): string }): URI;
|
||||
asFileUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
|
||||
const uri = this.toUri(uriOrModule, moduleIdToUrl);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
private toUri(uriOrModule: URI | string, moduleIdToUrl?: { toUrl(moduleId: string): string }): URI {
|
||||
if (URI.isUri(uriOrModule)) {
|
||||
return uriOrModule;
|
||||
}
|
||||
|
||||
return URI.parse(moduleIdToUrl!.toUrl(uriOrModule));
|
||||
}
|
||||
}
|
||||
|
||||
export const FileAccess = new FileAccessImpl();
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
interface IPaths {
|
||||
getAppDataPath(platform: string): string;
|
||||
getDefaultUserDataPath(platform: string): string;
|
||||
}
|
||||
|
||||
const pathsPath = getPathFromAmdModule(require, 'paths');
|
||||
const pathsPath = FileAccess.asFileUri('paths', require).fsPath;
|
||||
const paths = require.__$__nodeRequire<IPaths>(pathsPath);
|
||||
export const getAppDataPath = paths.getAppDataPath;
|
||||
export const getDefaultUserDataPath = paths.getDefaultUserDataPath;
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as extpath from 'vs/base/common/extpath';
|
|||
import * as Platform from 'vs/base/common/platform';
|
||||
import { LineDecoder } from 'vs/base/node/decoder';
|
||||
import { CommandOptions, ForkOptions, SuccessData, Source, TerminateResponse, TerminateResponseCode, Executable } from 'vs/base/common/processes';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
export { CommandOptions, ForkOptions, SuccessData, Source, TerminateResponse, TerminateResponseCode };
|
||||
|
||||
export type ValueCallback<T> = (value: T | Promise<T>) => void;
|
||||
|
@ -67,7 +67,7 @@ function terminateProcess(process: cp.ChildProcess, cwd?: string): Promise<Termi
|
|||
}
|
||||
} else if (Platform.isLinux || Platform.isMacintosh) {
|
||||
try {
|
||||
const cmd = getPathFromAmdModule(require, 'vs/base/node/terminateProcess.sh');
|
||||
const cmd = FileAccess.asFileUri('vs/base/node/terminateProcess.sh', require).fsPath;
|
||||
return new Promise((resolve, reject) => {
|
||||
cp.execFile(cmd, [process.pid.toString()], { encoding: 'utf8', shell: true } as cp.ExecFileOptions, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { exec } from 'child_process';
|
||||
import { ProcessItem } from 'vs/base/common/processes';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export function listProcesses(rootPid: number): Promise<ProcessItem> {
|
||||
|
||||
|
@ -180,7 +180,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
|
|||
// The cpu usage value reported on Linux is the average over the process lifetime,
|
||||
// recalculate the usage over a one second interval
|
||||
// JSON.stringify is needed to escape spaces, https://github.com/nodejs/node/issues/6803
|
||||
let cmd = JSON.stringify(getPathFromAmdModule(require, 'vs/base/node/cpuUsage.sh'));
|
||||
let cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/cpuUsage.sh', require).fsPath);
|
||||
cmd += ' ' + pids.join(' ');
|
||||
|
||||
exec(cmd, {}, (err, stdout, stderr) => {
|
||||
|
@ -208,7 +208,7 @@ export function listProcesses(rootPid: number): Promise<ProcessItem> {
|
|||
if (process.platform !== 'linux') {
|
||||
reject(err || new Error(stderr.toString()));
|
||||
} else {
|
||||
const cmd = JSON.stringify(getPathFromAmdModule(require, 'vs/base/node/ps.sh'));
|
||||
const cmd = JSON.stringify(FileAccess.asFileUri('vs/base/node/ps.sh', require).fsPath);
|
||||
exec(cmd, {}, (err, stdout, stderr) => {
|
||||
if (err || stderr) {
|
||||
reject(err || new Error(stderr.toString()));
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
import { localize } from 'vs/nls';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { BrowserWindow, BrowserWindowConstructorOptions, app, AuthInfo, WebContents, Event as ElectronEvent } from 'electron';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
|
||||
type LoginEvent = {
|
||||
event: ElectronEvent;
|
||||
|
@ -59,7 +59,7 @@ export class ProxyAuthHandler extends Disposable {
|
|||
show: true,
|
||||
title: 'VS Code',
|
||||
webPreferences: {
|
||||
preload: getPathFromAmdModule(require, 'vs/base/parts/sandbox/electron-browser/preload.js'),
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
sandbox: true,
|
||||
contextIsolation: true,
|
||||
enableWebSQL: false,
|
||||
|
@ -76,7 +76,7 @@ export class ProxyAuthHandler extends Disposable {
|
|||
}
|
||||
|
||||
const win = new BrowserWindow(opts);
|
||||
const url = require.toUrl('vs/code/electron-sandbox/proxy/auth.html');
|
||||
const windowUrl = FileAccess.asBrowserUri('vs/code/electron-sandbox/proxy/auth.html', require);
|
||||
const proxyUrl = `${authInfo.host}:${authInfo.port}`;
|
||||
const title = localize('authRequire', "Proxy Authentication Required");
|
||||
const message = localize('proxyauth', "The proxy {0} requires authentication.", proxyUrl);
|
||||
|
@ -97,6 +97,6 @@ export class ProxyAuthHandler extends Disposable {
|
|||
win.close();
|
||||
}
|
||||
});
|
||||
win.loadURL(url);
|
||||
win.loadURL(windowUrl.toString(true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec
|
|||
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
|
||||
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class SharedProcess implements ISharedProcess {
|
||||
|
||||
|
@ -41,7 +41,7 @@ export class SharedProcess implements ISharedProcess {
|
|||
show: false,
|
||||
backgroundColor: this.themeMainService.getBackgroundColor(),
|
||||
webPreferences: {
|
||||
preload: getPathFromAmdModule(require, 'vs/base/parts/sandbox/electron-browser/preload.js'),
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
nodeIntegration: true,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
|
@ -60,8 +60,10 @@ export class SharedProcess implements ISharedProcess {
|
|||
windowId: this.window.id
|
||||
};
|
||||
|
||||
const url = `${require.toUrl('vs/code/electron-browser/sharedProcess/sharedProcess.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
|
||||
this.window.loadURL(url);
|
||||
const windowUrl = FileAccess
|
||||
.asBrowserUri('vs/code/electron-browser/sharedProcess/sharedProcess.html', require)
|
||||
.with({ query: `config=${encodeURIComponent(JSON.stringify(config))}` });
|
||||
this.window.loadURL(windowUrl.toString(true));
|
||||
|
||||
// Prevent the window from dying
|
||||
const onClose = (e: ElectronEvent) => {
|
||||
|
|
|
@ -34,9 +34,8 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
|||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IStorageMainService } from 'vs/platform/storage/node/storageMainService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
export interface IWindowCreationOptions {
|
||||
state: IWindowState;
|
||||
|
@ -168,7 +167,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
show: !isFullscreenOrMaximized,
|
||||
title: product.nameLong,
|
||||
webPreferences: {
|
||||
preload: getPathFromAmdModule(require, 'vs/base/parts/sandbox/electron-browser/preload.js'),
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
|
@ -837,7 +836,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
workbench = 'vs/code/electron-browser/workbench/workbench.html';
|
||||
}
|
||||
|
||||
return `${require.toUrl(workbench)}?config=${encodeURIComponent(JSON.stringify(config))}`;
|
||||
return FileAccess
|
||||
.asBrowserUri(workbench, require)
|
||||
.with({ query: `config=${encodeURIComponent(JSON.stringify(config))}` })
|
||||
.toString(true);
|
||||
}
|
||||
|
||||
serializeWindowState(): IWindowState {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { memoize } from 'vs/base/common/decorators';
|
|||
import product from 'vs/platform/product/common/product';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { isWindows, Platform, platform } from 'vs/base/common/platform';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export class NativeEnvironmentService implements INativeEnvironmentService {
|
||||
|
@ -24,7 +24,7 @@ export class NativeEnvironmentService implements INativeEnvironmentService {
|
|||
get args(): NativeParsedArgs { return this._args; }
|
||||
|
||||
@memoize
|
||||
get appRoot(): string { return path.dirname(getPathFromAmdModule(require, '')); }
|
||||
get appRoot(): string { return path.dirname(FileAccess.asFileUri('', require).fsPath); }
|
||||
|
||||
readonly logsPath: string;
|
||||
|
||||
|
@ -111,7 +111,7 @@ export class NativeEnvironmentService implements INativeEnvironmentService {
|
|||
if (fromArgs) {
|
||||
return fromArgs;
|
||||
} else {
|
||||
return path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions'));
|
||||
return path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', 'extensions'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IExtensionManifest, IExtension, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export const EXTENSION_IDENTIFIER_PATTERN = '^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$';
|
||||
export const EXTENSION_IDENTIFIER_REGEX = new RegExp(EXTENSION_IDENTIFIER_PATTERN);
|
||||
|
@ -260,7 +261,7 @@ export interface IExtensionTipsService {
|
|||
}
|
||||
|
||||
|
||||
export const DefaultIconPath = require.toUrl('./media/defaultIcon.png');
|
||||
export const DefaultIconPath = FileAccess.asBrowserUri('./media/defaultIcon.png', require).toString(true);
|
||||
export const ExtensionsLabel = localize('extensions', "Extensions");
|
||||
export const ExtensionsLocalizedLabel = { value: ExtensionsLabel, original: 'Extensions' };
|
||||
export const ExtensionsChannelId = 'extensions';
|
||||
|
|
|
@ -14,7 +14,6 @@ import { areSameExtensions, ExtensionIdentifierWithVersion, groupByExtension, ge
|
|||
import { Limiter, Queue } from 'vs/base/common/async';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
@ -23,6 +22,7 @@ import { extract, ExtractError } from 'vs/base/node/zip';
|
|||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { flatten } from 'vs/base/common/arrays';
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
const ERROR_SCANNING_SYS_EXTENSIONS = 'scanningSystem';
|
||||
const ERROR_SCANNING_USER_EXTENSIONS = 'scanningUser';
|
||||
|
@ -336,7 +336,7 @@ export class ExtensionsScanner extends Disposable {
|
|||
private _devSystemExtensionsPath: string | null = null;
|
||||
private get devSystemExtensionsPath(): string {
|
||||
if (!this._devSystemExtensionsPath) {
|
||||
this._devSystemExtensionsPath = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', '.build', 'builtInExtensions'));
|
||||
this._devSystemExtensionsPath = path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', '.build', 'builtInExtensions'));
|
||||
}
|
||||
return this._devSystemExtensionsPath;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Client } from 'vs/base/parts/ipc/node/ipc.cp';
|
|||
import { IDiskFileChange, ILogMessage } from 'vs/platform/files/node/watcher/watcher';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IWatcherRequest, IWatcherService } from 'vs/platform/files/node/watcher/nsfw/watcher';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class FileWatcher extends Disposable {
|
||||
|
||||
|
@ -34,7 +34,7 @@ export class FileWatcher extends Disposable {
|
|||
|
||||
private startWatching(): void {
|
||||
const client = this._register(new Client(
|
||||
getPathFromAmdModule(require, 'bootstrap-fork'),
|
||||
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
|
||||
{
|
||||
serverName: 'File Watcher (nsfw)',
|
||||
args: ['--type=watcherService'],
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Client } from 'vs/base/parts/ipc/node/ipc.cp';
|
|||
import { IDiskFileChange, ILogMessage } from 'vs/platform/files/node/watcher/watcher';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IWatcherRequest, IWatcherOptions, IWatcherService } from 'vs/platform/files/node/watcher/unix/watcher';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class FileWatcher extends Disposable {
|
||||
|
||||
|
@ -35,7 +35,7 @@ export class FileWatcher extends Disposable {
|
|||
|
||||
private startWatching(): void {
|
||||
const client = this._register(new Client(
|
||||
getPathFromAmdModule(require, 'bootstrap-fork'),
|
||||
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
|
||||
{
|
||||
serverName: 'File Watcher (chokidar)',
|
||||
args: ['--type=watcherService'],
|
||||
|
|
|
@ -8,7 +8,7 @@ import { FileChangeType } from 'vs/platform/files/common/files';
|
|||
import * as decoder from 'vs/base/node/decoder';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { IDiskFileChange, ILogMessage } from 'vs/platform/files/node/watcher/watcher';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class OutOfProcessWin32FolderWatcher {
|
||||
|
||||
|
@ -50,7 +50,7 @@ export class OutOfProcessWin32FolderWatcher {
|
|||
args.push('-verbose');
|
||||
}
|
||||
|
||||
this.handle = cp.spawn(getPathFromAmdModule(require, 'vs/platform/files/node/watcher/win32/CodeHelper.exe'), args);
|
||||
this.handle = cp.spawn(FileAccess.asFileUri('vs/platform/files/node/watcher/win32/CodeHelper.exe', require).fsPath, args);
|
||||
|
||||
const stdoutLineDecoder = new decoder.LineDecoder();
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||
import { IWindowState } from 'vs/platform/windows/electron-main/windows';
|
||||
import { listProcesses } from 'vs/base/node/ps';
|
||||
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
const DEFAULT_BACKGROUND_COLOR = '#1E1E1E';
|
||||
|
||||
|
@ -195,7 +195,7 @@ export class IssueMainService implements ICommonIssueService {
|
|||
title: localize('issueReporter', "Issue Reporter"),
|
||||
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR,
|
||||
webPreferences: {
|
||||
preload: getPathFromAmdModule(require, 'vs/base/parts/sandbox/electron-browser/preload.js'),
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
|
@ -261,7 +261,7 @@ export class IssueMainService implements ICommonIssueService {
|
|||
backgroundColor: data.styles.backgroundColor,
|
||||
title: localize('processExplorer', "Process Explorer"),
|
||||
webPreferences: {
|
||||
preload: getPathFromAmdModule(require, 'vs/base/parts/sandbox/electron-browser/preload.js'),
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
|
@ -294,7 +294,7 @@ export class IssueMainService implements ICommonIssueService {
|
|||
};
|
||||
|
||||
this._processExplorerWindow.loadURL(
|
||||
toLauchUrl('vs/code/electron-sandbox/processExplorer/processExplorer.html', windowConfiguration));
|
||||
toWindowUrl('vs/code/electron-sandbox/processExplorer/processExplorer.html', windowConfiguration));
|
||||
|
||||
this._processExplorerWindow.on('close', () => this._processExplorerWindow = null);
|
||||
|
||||
|
@ -435,11 +435,11 @@ export class IssueMainService implements ICommonIssueService {
|
|||
}
|
||||
};
|
||||
|
||||
return toLauchUrl('vs/code/electron-sandbox/issue/issueReporter.html', windowConfiguration);
|
||||
return toWindowUrl('vs/code/electron-sandbox/issue/issueReporter.html', windowConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
function toLauchUrl<T>(pathToHtml: string, windowConfiguration: T): string {
|
||||
function toWindowUrl<T>(modulePathToHtml: string, windowConfiguration: T): string {
|
||||
const environment = parseArgs(process.argv, OPTIONS);
|
||||
const config = Object.assign(environment, windowConfiguration);
|
||||
for (const keyValue of Object.keys(config)) {
|
||||
|
@ -449,5 +449,8 @@ function toLauchUrl<T>(pathToHtml: string, windowConfiguration: T): string {
|
|||
}
|
||||
}
|
||||
|
||||
return `${require.toUrl(pathToHtml)}?config=${encodeURIComponent(JSON.stringify(config))}`;
|
||||
return FileAccess
|
||||
.asBrowserUri(modulePathToHtml, require)
|
||||
.with({ query: `config=${encodeURIComponent(JSON.stringify(config))}` })
|
||||
.toString(true);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import { IProductConfiguration } from 'vs/platform/product/common/productService';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { env } from 'vs/base/common/process';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { dirname, joinPath } from 'vs/base/common/resources';
|
||||
|
||||
let product: IProductConfiguration;
|
||||
|
||||
|
@ -43,10 +43,10 @@ if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire !
|
|||
else {
|
||||
|
||||
// Obtain values from product.json and package.json
|
||||
const rootPath = path.dirname(getPathFromAmdModule(require, ''));
|
||||
const rootPath = dirname(FileAccess.asFileUri('', require));
|
||||
|
||||
product = require.__$__nodeRequire(path.join(rootPath, 'product.json'));
|
||||
const pkg = require.__$__nodeRequire(path.join(rootPath, 'package.json')) as { version: string; };
|
||||
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
||||
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
|
||||
|
||||
// Running out of sources
|
||||
if (env['VSCODE_DEV']) {
|
||||
|
|
41
src/vs/vscode.proposed.d.ts
vendored
41
src/vs/vscode.proposed.d.ts
vendored
|
@ -717,76 +717,65 @@ declare module 'vscode' {
|
|||
|
||||
//#region file-decorations: https://github.com/microsoft/vscode/issues/54938
|
||||
|
||||
// TODO@jrieken FileDecoration, FileDecorationProvider etc.
|
||||
// TODO@jrieken Add selector notion to limit decorations to a view.
|
||||
// TODO@jrieken Rename `Decoration.letter` to `short` so that it could be used for coverage et al.
|
||||
// TODO@jrieken priority -> DecorationSeverity.INFO,WARN,ERROR
|
||||
// TODO@jrieken title -> tooltip
|
||||
// TODO@jrieken bubble -> propagte
|
||||
export class Decoration {
|
||||
|
||||
export class FileDecoration {
|
||||
|
||||
/**
|
||||
* A letter that represents this decoration.
|
||||
* A very short string that represents this decoration.
|
||||
*/
|
||||
letter?: string;
|
||||
badge?: string;
|
||||
|
||||
/**
|
||||
* The human-readable title for this decoration.
|
||||
* A human-readable tooltip for this decoration.
|
||||
*/
|
||||
title?: string;
|
||||
tooltip?: string;
|
||||
|
||||
/**
|
||||
* The color of this decoration.
|
||||
*/
|
||||
color?: ThemeColor;
|
||||
|
||||
/**
|
||||
* The priority of this decoration.
|
||||
*/
|
||||
priority?: number;
|
||||
|
||||
/**
|
||||
* A flag expressing that this decoration should be
|
||||
* propagted to its parents.
|
||||
* propagated to its parents.
|
||||
*/
|
||||
bubble?: boolean;
|
||||
propagate?: boolean;
|
||||
|
||||
/**
|
||||
* Creates a new decoration.
|
||||
*
|
||||
* @param letter A letter that represents the decoration.
|
||||
* @param title The title of the decoration.
|
||||
* @param badge A letter that represents the decoration.
|
||||
* @param tooltip The tooltip of the decoration.
|
||||
* @param color The color of the decoration.
|
||||
*/
|
||||
constructor(letter?: string, title?: string, color?: ThemeColor);
|
||||
constructor(badge?: string, tooltip?: string, color?: ThemeColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* The decoration provider interfaces defines the contract between extensions and
|
||||
* file decorations.
|
||||
*/
|
||||
export interface DecorationProvider {
|
||||
export interface FileDecorationProvider {
|
||||
|
||||
/**
|
||||
* An event to signal decorations for one or many files have changed.
|
||||
*
|
||||
* @see [EventEmitter](#EventEmitter
|
||||
*/
|
||||
onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
|
||||
onDidChange: Event<undefined | Uri | Uri[]>;
|
||||
|
||||
/**
|
||||
* Provide decorations for a given uri.
|
||||
*
|
||||
*
|
||||
* @param uri The uri of the file to provide a decoration for.
|
||||
* @param token A cancellation token.
|
||||
* @returns A decoration or a thenable that resolves to such.
|
||||
*/
|
||||
provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
|
||||
provideFileDecoration(uri: Uri, token: CancellationToken): ProviderResult<FileDecoration>;
|
||||
}
|
||||
|
||||
export namespace window {
|
||||
export function registerDecorationProvider(provider: DecorationProvider): Disposable;
|
||||
export function registerDecorationProvider(provider: FileDecorationProvider): Disposable;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
|
|
@ -92,9 +92,9 @@ export class MainThreadDecorations implements MainThreadDecorationsShape {
|
|||
if (!data) {
|
||||
return undefined;
|
||||
}
|
||||
const [weight, bubble, tooltip, letter, themeColor] = data;
|
||||
const [bubble, tooltip, letter, themeColor] = data;
|
||||
return <IDecorationData>{
|
||||
weight: weight ?? 0,
|
||||
weight: 10,
|
||||
bubble: bubble ?? false,
|
||||
color: themeColor?.id,
|
||||
tooltip,
|
||||
|
|
|
@ -50,7 +50,7 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
|
|||
$activateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void> {
|
||||
return this._extensionService._activateById(extensionId, reason);
|
||||
}
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): void {
|
||||
async $onWillActivateExtension(extensionId: ExtensionIdentifier): Promise<void> {
|
||||
this._extensionService._onWillActivateExtension(extensionId);
|
||||
}
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationReason: ExtensionActivationReason): void {
|
||||
|
|
|
@ -605,7 +605,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
registerCustomEditorProvider: (viewType: string, provider: vscode.CustomTextEditorProvider | vscode.CustomReadonlyEditorProvider, options: { webviewOptions?: vscode.WebviewPanelOptions, supportsMultipleEditorsPerDocument?: boolean } = {}) => {
|
||||
return extHostCustomEditors.registerCustomEditorProvider(extension, viewType, provider, options);
|
||||
},
|
||||
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
||||
registerDecorationProvider(provider: vscode.FileDecorationProvider) {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostDecorations.registerDecorationProvider(provider, extension.identifier);
|
||||
},
|
||||
|
@ -1138,7 +1138,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
CallHierarchyItem: extHostTypes.CallHierarchyItem,
|
||||
DebugConsoleMode: extHostTypes.DebugConsoleMode,
|
||||
DebugConfigurationProviderTriggerKind: extHostTypes.DebugConfigurationProviderTriggerKind,
|
||||
Decoration: extHostTypes.Decoration,
|
||||
FileDecoration: extHostTypes.FileDecoration,
|
||||
UIKind: UIKind,
|
||||
ColorThemeKind: extHostTypes.ColorThemeKind,
|
||||
TimelineItem: extHostTypes.TimelineItem,
|
||||
|
|
|
@ -830,7 +830,7 @@ export interface MainThreadTaskShape extends IDisposable {
|
|||
|
||||
export interface MainThreadExtensionServiceShape extends IDisposable {
|
||||
$activateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void>;
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): void;
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): Promise<void>;
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationReason: ExtensionActivationReason): void;
|
||||
$onExtensionActivationError(extensionId: ExtensionIdentifier, error: ExtensionActivationError): Promise<void>;
|
||||
$onExtensionRuntimeError(extensionId: ExtensionIdentifier, error: SerializedError): void;
|
||||
|
@ -1605,7 +1605,7 @@ export interface DecorationRequest {
|
|||
readonly uri: UriComponents;
|
||||
}
|
||||
|
||||
export type DecorationData = [number, boolean, string, string, ThemeColor];
|
||||
export type DecorationData = [boolean, string, string, ThemeColor];
|
||||
export type DecorationReply = { [id: number]: DecorationData; };
|
||||
|
||||
export interface ExtHostDecorationsShape {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import type * as vscode from 'vscode';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { MainContext, ExtHostDecorationsShape, MainThreadDecorationsShape, DecorationData, DecorationRequest, DecorationReply } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Disposable, Decoration } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { Disposable, FileDecoration } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||
import { asArray } from 'vs/base/common/arrays';
|
||||
|
||||
interface ProviderData {
|
||||
provider: vscode.DecorationProvider;
|
||||
provider: vscode.FileDecorationProvider;
|
||||
extensionId: ExtensionIdentifier;
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
|
|||
this._proxy = extHostRpc.getProxy(MainContext.MainThreadDecorations);
|
||||
}
|
||||
|
||||
registerDecorationProvider(provider: vscode.DecorationProvider, extensionId: ExtensionIdentifier): vscode.Disposable {
|
||||
registerDecorationProvider(provider: vscode.FileDecorationProvider, extensionId: ExtensionIdentifier): vscode.Disposable {
|
||||
const handle = ExtHostDecorations._handlePool++;
|
||||
this._provider.set(handle, { provider, extensionId });
|
||||
this._proxy.$registerDecorationProvider(handle, extensionId.value);
|
||||
|
||||
const listener = provider.onDidChangeDecorations(e => {
|
||||
const listener = provider.onDidChange(e => {
|
||||
this._proxy.$onDidChange(handle, !e || (Array.isArray(e) && e.length > 250)
|
||||
? null
|
||||
: asArray(e));
|
||||
|
@ -65,13 +65,13 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
|
|||
await Promise.all(requests.map(async request => {
|
||||
try {
|
||||
const { uri, id } = request;
|
||||
const data = await Promise.resolve(provider.provideDecoration(URI.revive(uri), token));
|
||||
const data = await Promise.resolve(provider.provideFileDecoration(URI.revive(uri), token));
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Decoration.validate(data);
|
||||
result[id] = <DecorationData>[data.priority, data.bubble, data.title, data.letter, data.color];
|
||||
FileDecoration.validate(data);
|
||||
result[id] = <DecorationData>[data.propagate, data.tooltip, data.badge, data.color];
|
||||
} catch (e) {
|
||||
this._logService.warn(`INVALID decoration from extension '${extensionId.value}': ${e}`);
|
||||
}
|
||||
|
|
|
@ -303,8 +303,15 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
|||
|
||||
// --- impl
|
||||
|
||||
private _activateExtension(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): Promise<ActivatedExtension> {
|
||||
this._mainThreadExtensionsProxy.$onWillActivateExtension(extensionDescription.identifier);
|
||||
private async _activateExtension(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): Promise<ActivatedExtension> {
|
||||
if (!this._initData.remote.isRemote) {
|
||||
// local extension host process
|
||||
await this._mainThreadExtensionsProxy.$onWillActivateExtension(extensionDescription.identifier);
|
||||
} else {
|
||||
// remote extension host process
|
||||
// do not wait for renderer confirmation
|
||||
this._mainThreadExtensionsProxy.$onWillActivateExtension(extensionDescription.identifier);
|
||||
}
|
||||
return this._doActivateExtension(extensionDescription, reason).then((activatedExtension) => {
|
||||
const activationTimes = activatedExtension.activationTimes;
|
||||
this._mainThreadExtensionsProxy.$onDidActivateExtension(extensionDescription.identifier, activationTimes.codeLoadingTime, activationTimes.activateCallTime, activationTimes.activateResolvedTime, reason);
|
||||
|
|
|
@ -13,7 +13,7 @@ import { ITerminalChildProcess, ITerminalDimensions, EXT_HOST_CREATION_DELAY, IT
|
|||
import { timeout } from 'vs/base/common/async';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { TerminalDataBufferer } from 'vs/workbench/contrib/terminal/common/terminalDataBuffering';
|
||||
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable as VSCodeDisposable, EnvironmentVariableMutatorType } from './extHostTypes';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable';
|
||||
|
@ -22,7 +22,7 @@ import { NotSupportedError } from 'vs/base/common/errors';
|
|||
import { serializeEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableShared';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
|
||||
export interface IExtHostTerminalService extends ExtHostTerminalServiceShape {
|
||||
export interface IExtHostTerminalService extends ExtHostTerminalServiceShape, IDisposable {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
|
@ -306,14 +306,14 @@ interface ICachedLinkEntry {
|
|||
link: vscode.TerminalLink;
|
||||
}
|
||||
|
||||
export abstract class BaseExtHostTerminalService implements IExtHostTerminalService, ExtHostTerminalServiceShape {
|
||||
export abstract class BaseExtHostTerminalService extends Disposable implements IExtHostTerminalService, ExtHostTerminalServiceShape {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
protected _proxy: MainThreadTerminalServiceShape;
|
||||
protected _activeTerminal: ExtHostTerminal | undefined;
|
||||
protected _terminals: ExtHostTerminal[] = [];
|
||||
protected _terminalProcesses: { [id: number]: ITerminalChildProcess } = {};
|
||||
protected _terminalProcesses: Map<number, ITerminalChildProcess> = new Map();
|
||||
protected _terminalProcessDisposables: { [id: number]: IDisposable } = {};
|
||||
protected _extensionTerminalAwaitingStart: { [id: number]: { initialDimensions: ITerminalDimensionsDto | undefined } | undefined } = {};
|
||||
protected _getTerminalPromises: { [id: number]: Promise<ExtHostTerminal | undefined> } = {};
|
||||
|
@ -342,6 +342,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
supportsProcesses: boolean,
|
||||
@IExtHostRpcService extHostRpc: IExtHostRpcService
|
||||
) {
|
||||
super();
|
||||
this._proxy = extHostRpc.getProxy(MainContext.MainThreadTerminalService);
|
||||
this._bufferer = new TerminalDataBufferer(this._proxy.$sendProcessData);
|
||||
this._onDidWriteTerminalData = new Emitter<vscode.TerminalDataWriteEvent>({
|
||||
|
@ -349,6 +350,13 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
onLastListenerRemove: () => this._proxy.$stopSendingDataEvents()
|
||||
});
|
||||
this._proxy.$registerProcessSupport(supportsProcesses);
|
||||
this._register({
|
||||
dispose: () => {
|
||||
for (const [_, terminalProcess] of this._terminalProcesses) {
|
||||
terminalProcess.shutdown(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal;
|
||||
|
@ -421,11 +429,9 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
public async $acceptTerminalMaximumDimensions(id: number, cols: number, rows: number): Promise<void> {
|
||||
await this._getTerminalByIdEventually(id);
|
||||
|
||||
if (this._terminalProcesses[id]) {
|
||||
// Extension pty terminal only - when virtual process resize fires it means that the
|
||||
// terminal's maximum dimensions changed
|
||||
this._terminalProcesses[id]?.resize(cols, rows);
|
||||
}
|
||||
// Extension pty terminal only - when virtual process resize fires it means that the
|
||||
// terminal's maximum dimensions changed
|
||||
this._terminalProcesses.get(id)?.resize(cols, rows);
|
||||
}
|
||||
|
||||
public async $acceptTerminalTitleChange(id: number, name: string): Promise<void> {
|
||||
|
@ -497,8 +503,9 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
});
|
||||
}
|
||||
|
||||
if (this._terminalProcesses[id]) {
|
||||
(this._terminalProcesses[id] as ExtHostPseudoterminal).startSendingEvents(initialDimensions);
|
||||
const terminalProcess = this._terminalProcesses.get(id);
|
||||
if (terminalProcess) {
|
||||
(terminalProcess as ExtHostPseudoterminal).startSendingEvents(initialDimensions);
|
||||
} else {
|
||||
// Defer startSendingEvents call to when _setupExtHostProcessListeners is called
|
||||
this._extensionTerminalAwaitingStart[id] = { initialDimensions };
|
||||
|
@ -520,7 +527,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
if (p.onProcessOverrideDimensions) {
|
||||
disposables.add(p.onProcessOverrideDimensions(e => this._proxy.$sendOverrideDimensions(id, e)));
|
||||
}
|
||||
this._terminalProcesses[id] = p;
|
||||
this._terminalProcesses.set(id, p);
|
||||
|
||||
const awaitingStart = this._extensionTerminalAwaitingStart[id];
|
||||
if (awaitingStart && p instanceof ExtHostPseudoterminal) {
|
||||
|
@ -532,12 +539,12 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
}
|
||||
|
||||
public $acceptProcessInput(id: number, data: string): void {
|
||||
this._terminalProcesses[id]?.input(data);
|
||||
this._terminalProcesses.get(id)?.input(data);
|
||||
}
|
||||
|
||||
public $acceptProcessResize(id: number, cols: number, rows: number): void {
|
||||
try {
|
||||
this._terminalProcesses[id]?.resize(cols, rows);
|
||||
this._terminalProcesses.get(id)?.resize(cols, rows);
|
||||
} catch (error) {
|
||||
// We tried to write to a closed pipe / channel.
|
||||
if (error.code !== 'EPIPE' && error.code !== 'ERR_IPC_CHANNEL_CLOSED') {
|
||||
|
@ -547,15 +554,15 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
}
|
||||
|
||||
public $acceptProcessShutdown(id: number, immediate: boolean): void {
|
||||
this._terminalProcesses[id]?.shutdown(immediate);
|
||||
this._terminalProcesses.get(id)?.shutdown(immediate);
|
||||
}
|
||||
|
||||
public $acceptProcessRequestInitialCwd(id: number): void {
|
||||
this._terminalProcesses[id]?.getInitialCwd().then(initialCwd => this._proxy.$sendProcessInitialCwd(id, initialCwd));
|
||||
this._terminalProcesses.get(id)?.getInitialCwd().then(initialCwd => this._proxy.$sendProcessInitialCwd(id, initialCwd));
|
||||
}
|
||||
|
||||
public $acceptProcessRequestCwd(id: number): void {
|
||||
this._terminalProcesses[id]?.getCwd().then(cwd => this._proxy.$sendProcessCwd(id, cwd));
|
||||
this._terminalProcesses.get(id)?.getCwd().then(cwd => this._proxy.$sendProcessCwd(id, cwd));
|
||||
}
|
||||
|
||||
public $acceptProcessRequestLatency(id: number): number {
|
||||
|
@ -648,7 +655,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
|
|||
this._bufferer.stopBuffering(id);
|
||||
|
||||
// Remove process reference
|
||||
delete this._terminalProcesses[id];
|
||||
this._terminalProcesses.delete(id);
|
||||
delete this._extensionTerminalAwaitingStart[id];
|
||||
|
||||
// Clean up process disposables
|
||||
|
|
|
@ -2729,22 +2729,29 @@ export enum ExtensionKind {
|
|||
Workspace = 2
|
||||
}
|
||||
|
||||
export class Decoration {
|
||||
export class FileDecoration {
|
||||
|
||||
static validate(d: Decoration): void {
|
||||
if (d.letter && d.letter.length !== 1) {
|
||||
static validate(d: FileDecoration): void {
|
||||
if (d.badge && d.badge.length !== 1) {
|
||||
throw new Error(`The 'letter'-property must be undefined or a single character`);
|
||||
}
|
||||
if (!d.bubble && !d.color && !d.letter && !d.priority && !d.title) {
|
||||
if (!d.color && !d.badge && !d.tooltip) {
|
||||
throw new Error(`The decoration is empty`);
|
||||
}
|
||||
}
|
||||
|
||||
letter?: string;
|
||||
title?: string;
|
||||
badge?: string;
|
||||
tooltip?: string;
|
||||
color?: vscode.ThemeColor;
|
||||
priority?: number;
|
||||
bubble?: boolean;
|
||||
propagate?: boolean;
|
||||
|
||||
|
||||
constructor(badge?: string, tooltip?: string, color?: ThemeColor) {
|
||||
this.badge = badge;
|
||||
this.tooltip = tooltip;
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
//#region Theming
|
||||
|
|
|
@ -54,7 +54,7 @@ import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
|
|||
import { IQuickAccessRegistry, Extensions as QuickAccessExtensions } from 'vs/platform/quickinput/common/quickAccess';
|
||||
import { ActiveGroupEditorsByMostRecentlyUsedQuickAccess, AllEditorsByAppearanceQuickAccess, AllEditorsByMostRecentlyUsedQuickAccess } from 'vs/workbench/browser/parts/editor/editorQuickAccess';
|
||||
import { IPathService } from 'vs/workbench/services/path/common/pathService';
|
||||
import { getUriFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
// Register String Editor
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
|
||||
|
@ -423,13 +423,13 @@ editorCommands.setup();
|
|||
// Touch Bar
|
||||
if (isMacintosh) {
|
||||
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
|
||||
command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: { dark: getUriFromAmdModule(require, 'vs/workbench/browser/parts/editor/media/back-tb.png') } },
|
||||
command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/back-tb.png', require) } },
|
||||
group: 'navigation',
|
||||
order: 0
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
|
||||
command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: { dark: getUriFromAmdModule(require, 'vs/workbench/browser/parts/editor/media/forward-tb.png') } },
|
||||
command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: { dark: FileAccess.asFileUri('vs/workbench/browser/parts/editor/media/forward-tb.png', require) } },
|
||||
group: 'navigation',
|
||||
order: 1
|
||||
});
|
||||
|
|
|
@ -46,13 +46,12 @@ import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
|
|||
import { hash } from 'vs/base/common/hash';
|
||||
import { guessMimeTypes } from 'vs/base/common/mime';
|
||||
import { extname } from 'vs/base/common/resources';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import { EditorActivation, EditorOpenContext } from 'vs/platform/editor/common/editor';
|
||||
import { IDialogService, IFileDialogService, ConfirmResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
|
||||
export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
|
||||
|
@ -1781,7 +1780,7 @@ registerThemingParticipant((theme, collector, environment) => {
|
|||
const letterpress = `./media/letterpress${theme.type === 'dark' ? '-dark' : theme.type === 'hc' ? '-hc' : ''}.svg`;
|
||||
collector.addRule(`
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.empty .editor-group-letterpress {
|
||||
background-image: url('${getPathFromAmdModule(require, letterpress)}')
|
||||
background-image: url('${FileAccess.asBrowserUri(letterpress, require).fsPath}')
|
||||
}
|
||||
`);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
|||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
function ignore<T>(code: string, value: T): (err: any) => Promise<T> {
|
||||
|
@ -29,7 +29,7 @@ function ignore<T>(code: string, value: T): (err: any) => Promise<T> {
|
|||
let _source: string | null = null;
|
||||
function getSource(): string {
|
||||
if (!_source) {
|
||||
const root = getPathFromAmdModule(require, '');
|
||||
const root = FileAccess.asFileUri('', require).fsPath;
|
||||
_source = path.resolve(root, '..', 'bin', 'code');
|
||||
}
|
||||
return _source;
|
||||
|
|
|
@ -52,7 +52,7 @@ import { DebugTitleContribution } from 'vs/workbench/contrib/debug/browser/debug
|
|||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { registerColors } from 'vs/workbench/contrib/debug/browser/debugColors';
|
||||
import { DebugEditorContribution } from 'vs/workbench/contrib/debug/browser/debugEditorContribution';
|
||||
import { getUriFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionRegistryExtensions.WorkbenchActions);
|
||||
const debugCategory = nls.localize('debugCategory', "Debug");
|
||||
|
@ -210,15 +210,15 @@ function registerCommandsAndActions(): void {
|
|||
});
|
||||
};
|
||||
|
||||
registerTouchBarEntry(StartAction.ID, StartAction.LABEL, 0, CONTEXT_IN_DEBUG_MODE.toNegated(), getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/continue-tb.png'));
|
||||
registerTouchBarEntry(RunAction.ID, RunAction.LABEL, 1, CONTEXT_IN_DEBUG_MODE.toNegated(), getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/continue-without-debugging-tb.png'));
|
||||
registerTouchBarEntry(CONTINUE_ID, CONTINUE_LABEL, 0, CONTEXT_DEBUG_STATE.isEqualTo('stopped'), getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/continue-tb.png'));
|
||||
registerTouchBarEntry(PAUSE_ID, PAUSE_LABEL, 1, ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.notEquals('debugState', 'stopped')), getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/pause-tb.png'));
|
||||
registerTouchBarEntry(STEP_OVER_ID, STEP_OVER_LABEL, 2, CONTEXT_IN_DEBUG_MODE, getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/stepover-tb.png'));
|
||||
registerTouchBarEntry(STEP_INTO_ID, STEP_INTO_LABEL, 3, CONTEXT_IN_DEBUG_MODE, getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/stepinto-tb.png'));
|
||||
registerTouchBarEntry(STEP_OUT_ID, STEP_OUT_LABEL, 4, CONTEXT_IN_DEBUG_MODE, getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/stepout-tb.png'));
|
||||
registerTouchBarEntry(RESTART_SESSION_ID, RESTART_LABEL, 5, CONTEXT_IN_DEBUG_MODE, getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/restart-tb.png'));
|
||||
registerTouchBarEntry(STOP_ID, STOP_LABEL, 6, CONTEXT_IN_DEBUG_MODE, getUriFromAmdModule(require, 'vs/workbench/contrib/debug/browser/media/stop-tb.png'));
|
||||
registerTouchBarEntry(StartAction.ID, StartAction.LABEL, 0, CONTEXT_IN_DEBUG_MODE.toNegated(), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/continue-tb.png', require));
|
||||
registerTouchBarEntry(RunAction.ID, RunAction.LABEL, 1, CONTEXT_IN_DEBUG_MODE.toNegated(), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/continue-without-debugging-tb.png', require));
|
||||
registerTouchBarEntry(CONTINUE_ID, CONTINUE_LABEL, 0, CONTEXT_DEBUG_STATE.isEqualTo('stopped'), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/continue-tb.png', require));
|
||||
registerTouchBarEntry(PAUSE_ID, PAUSE_LABEL, 1, ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, ContextKeyExpr.notEquals('debugState', 'stopped')), FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/pause-tb.png', require));
|
||||
registerTouchBarEntry(STEP_OVER_ID, STEP_OVER_LABEL, 2, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepover-tb.png', require));
|
||||
registerTouchBarEntry(STEP_INTO_ID, STEP_INTO_LABEL, 3, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepinto-tb.png', require));
|
||||
registerTouchBarEntry(STEP_OUT_ID, STEP_OUT_LABEL, 4, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stepout-tb.png', require));
|
||||
registerTouchBarEntry(RESTART_SESSION_ID, RESTART_LABEL, 5, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/restart-tb.png', require));
|
||||
registerTouchBarEntry(STOP_ID, STOP_LABEL, 6, CONTEXT_IN_DEBUG_MODE, FileAccess.asFileUri('vs/workbench/contrib/debug/browser/media/stop-tb.png', require));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { Client as TelemetryClient } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
@ -24,7 +24,7 @@ export class NodeDebugHelperService implements IDebugHelperService {
|
|||
createTelemetryService(configurationService: IConfigurationService, args: string[]): TelemetryService | undefined {
|
||||
|
||||
const client = new TelemetryClient(
|
||||
getPathFromAmdModule(require, 'bootstrap-fork'),
|
||||
FileAccess.asFileUri('bootstrap-fork', require).fsPath,
|
||||
{
|
||||
serverName: 'Debug Telemetry',
|
||||
timeout: 1000 * 60 * 5,
|
||||
|
|
|
@ -40,6 +40,7 @@ import { asDomUri } from 'vs/base/browser/dom';
|
|||
import { getIgnoredExtensions } from 'vs/platform/userDataSync/common/extensionsMerge';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
import { getExtensionKind } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
interface IExtensionStateProvider<T> {
|
||||
(extension: Extension): T;
|
||||
|
@ -151,10 +152,10 @@ class Extension implements IExtension {
|
|||
if (this.type === ExtensionType.System && this.local) {
|
||||
if (this.local.manifest && this.local.manifest.contributes) {
|
||||
if (Array.isArray(this.local.manifest.contributes.themes) && this.local.manifest.contributes.themes.length) {
|
||||
return require.toUrl('./media/theme-icon.png');
|
||||
return FileAccess.asBrowserUri('./media/theme-icon.png', require).toString(true);
|
||||
}
|
||||
if (Array.isArray(this.local.manifest.contributes.grammars) && this.local.manifest.contributes.grammars.length) {
|
||||
return require.toUrl('./media/language-icon.svg');
|
||||
return FileAccess.asBrowserUri('./media/language-icon.svg', require).toString(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ import * as pfs from 'vs/base/node/pfs';
|
|||
import * as env from 'vs/base/common/platform';
|
||||
import { IExternalTerminalService, IExternalTerminalConfiguration, IExternalTerminalSettings } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { DEFAULT_TERMINAL_OSX } from 'vs/workbench/contrib/externalTerminal/node/externalTerminal';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console");
|
||||
|
||||
|
@ -144,7 +144,7 @@ export class MacExternalTerminalService implements IExternalTerminalService {
|
|||
// and then launches the program inside that window.
|
||||
|
||||
const script = terminalApp === DEFAULT_TERMINAL_OSX ? 'TerminalHelper' : 'iTermHelper';
|
||||
const scriptpath = getPathFromAmdModule(require, `vs/workbench/contrib/externalTerminal/node/${script}.scpt`);
|
||||
const scriptpath = FileAccess.asFileUri(`vs/workbench/contrib/externalTerminal/node/${script}.scpt`, require).fsPath;
|
||||
|
||||
const osaArgs = [
|
||||
scriptpath,
|
||||
|
|
|
@ -163,10 +163,12 @@ export class CompressedNavigationController implements ICompressedNavigationCont
|
|||
|
||||
private updateLabels(templateData: IFileTemplateData): void {
|
||||
this._labels = Array.from(templateData.container.querySelectorAll('.label-name')) as HTMLElement[];
|
||||
|
||||
let parents = '';
|
||||
for (let i = 0; i < this.labels.length; i++) {
|
||||
this.labels[i].setAttribute('aria-label', this.items[i].name);
|
||||
const ariaLabel = parents.length ? `${this.items[i].name}, compact, ${parents}` : this.items[i].name;
|
||||
this.labels[i].setAttribute('aria-label', ariaLabel);
|
||||
this.labels[i].setAttribute('aria-level', `${this.depth + i}`);
|
||||
parents = parents.length ? `${this.items[i].name} ${parents}` : this.items[i].name;
|
||||
}
|
||||
this.updateCollapsed(this.collapsed);
|
||||
|
||||
|
@ -255,7 +257,8 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
|||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExplorerService private readonly explorerService: IExplorerService,
|
||||
@ILabelService private readonly labelService: ILabelService
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
|
||||
) {
|
||||
this.config = this.configurationService.getValue<IFilesConfiguration>();
|
||||
this.configListener = this.configurationService.onDidChangeConfiguration(e => {
|
||||
|
@ -491,6 +494,22 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
|||
return element.name;
|
||||
}
|
||||
|
||||
getAriaLevel(element: ExplorerItem): number {
|
||||
// We need to comput aria level on our own since children of compact folders will otherwise have an incorrect level #107235
|
||||
let depth = 0;
|
||||
let parent = element.parent;
|
||||
while (parent) {
|
||||
parent = parent.parent;
|
||||
depth++;
|
||||
}
|
||||
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
|
||||
depth = depth + 1;
|
||||
}
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
getActiveDescendantId(stat: ExplorerItem): string | undefined {
|
||||
const compressedNavigationController = this.compressedNavigationControllers.get(stat);
|
||||
return compressedNavigationController?.currentId;
|
||||
|
|
|
@ -841,6 +841,8 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
|||
}
|
||||
|
||||
class AutomaticPortForwarding extends Disposable implements IWorkbenchContribution {
|
||||
private contextServiceListener: IDisposable;
|
||||
|
||||
constructor(
|
||||
@ITerminalService private readonly terminalService: ITerminalService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
|
@ -854,12 +856,20 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
|
|||
if (this.environmentService.configuration.remoteAuthority) {
|
||||
this.startUrlFinder();
|
||||
}
|
||||
this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => {
|
||||
if (e.affectsSome(new Set(forwardedPortsViewEnabled.keys()))) {
|
||||
this.startUrlFinder();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private isStarted = false;
|
||||
private startUrlFinder() {
|
||||
if (!forwardedPortsViewEnabled.getValue(this.contextKeyService)) {
|
||||
if (!this.isStarted && !forwardedPortsViewEnabled.getValue(this.contextKeyService)) {
|
||||
return;
|
||||
}
|
||||
this.contextServiceListener.dispose();
|
||||
this.isStarted = true;
|
||||
const urlFinder = this._register(new UrlFinder(this.terminalService));
|
||||
this._register(urlFinder.onDidMatchLocalUrl(async (localUrl) => {
|
||||
const forwarded = await this.remoteExplorerService.forward(localUrl);
|
||||
|
|
|
@ -63,6 +63,10 @@ export class UrlFinder extends Disposable {
|
|||
if (host !== '0.0.0.0' && host !== '127.0.0.1') {
|
||||
host = 'localhost';
|
||||
}
|
||||
// Exclude node inspect, except when using defualt port
|
||||
if (port !== 9229 && data.startsWith('Debugger listening on')) {
|
||||
return;
|
||||
}
|
||||
this._onDidMatchLocalUrl.fire({ port, host });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ThrottledDelayer } from 'vs/base/common/async';
|
|||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { once } from 'vs/base/common/functional';
|
||||
import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createChannelSender } from 'vs/base/parts/ipc/common/ipc';
|
||||
|
@ -206,7 +206,10 @@ export class ElectronWebviewBasedWebview extends BaseWebview<WebviewTag> impleme
|
|||
this.styledFindWidget();
|
||||
}
|
||||
|
||||
this.element!.preload = require.toUrl('./pre/electron-index.js');
|
||||
// We must ensure to put a `file:` URI as the preload attribute
|
||||
// and not the `vscode-file` URI because preload scripts are loaded
|
||||
// via node.js from the main side and only allow `file:` protocol
|
||||
this.element!.preload = FileAccess.asFileUri('./pre/electron-index.js', require).toString(true);
|
||||
this.element!.src = `${Schemas.vscodeWebview}://${this.id}/electron-browser/index.html?platform=electron`;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
|
|||
import { localize } from 'vs/nls';
|
||||
import { Action, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification } from 'vs/base/common/actions';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { getInstalledExtensions, IExtensionStatus, onExtensionChanged, isKeymapExtension } from 'vs/workbench/contrib/extensions/common/extensionsUtils';
|
||||
import { IExtensionManagementService, IExtensionGalleryService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
|
@ -47,7 +47,6 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
|||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { getUriFromAmdModule } from 'vs/base/common/amd';
|
||||
|
||||
const configurationKey = 'workbench.startupEditor';
|
||||
const oldConfigurationKey = 'workbench.welcome.enabled';
|
||||
|
@ -300,7 +299,7 @@ class WelcomePage extends Disposable {
|
|||
|
||||
const recentlyOpened = this.workspacesService.getRecentlyOpened();
|
||||
const installedExtensions = this.instantiationService.invokeFunction(getInstalledExtensions);
|
||||
const resource = getUriFromAmdModule(require, './vs_code_welcome_page')
|
||||
const resource = FileAccess.asBrowserUri('./vs_code_welcome_page', require)
|
||||
.with({
|
||||
scheme: Schemas.walkThrough,
|
||||
query: JSON.stringify({ moduleId: 'vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page' })
|
||||
|
|
|
@ -8,16 +8,15 @@ import { localize } from 'vs/nls';
|
|||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { getUriFromAmdModule } from 'vs/base/common/amd';
|
||||
import { WalkThroughInput, WalkThroughInputOptions } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import { IEditorInputFactory, EditorInput } from 'vs/workbench/common/editor';
|
||||
|
||||
const typeId = 'workbench.editors.walkThroughInput';
|
||||
const inputOptions: WalkThroughInputOptions = {
|
||||
typeId,
|
||||
name: localize('editorWalkThrough.title', "Interactive Playground"),
|
||||
resource: getUriFromAmdModule(require, './vs_code_editor_walkthrough.md')
|
||||
resource: FileAccess.asBrowserUri('./vs_code_editor_walkthrough.md', require)
|
||||
.with({
|
||||
scheme: Schemas.walkThrough,
|
||||
query: JSON.stringify({ moduleId: 'vs/workbench/contrib/welcome/walkThrough/browser/editor/vs_code_editor_walkthrough' })
|
||||
|
|
|
@ -29,6 +29,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
|||
import { canceled, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { WEB_WORKER_IFRAME } from 'vs/workbench/services/extensions/common/webWorkerIframe';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export interface IWebWorkerExtensionHostInitData {
|
||||
readonly autoStart: boolean;
|
||||
|
@ -92,7 +93,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
|
|||
iframe.style.display = 'none';
|
||||
|
||||
const vscodeWebWorkerExtHostId = generateUuid();
|
||||
const workerUrl = require.toUrl('../worker/extensionHostWorkerMain.js');
|
||||
const workerUrl = FileAccess.asBrowserUri('../worker/extensionHostWorkerMain.js', require).toString(true);
|
||||
const workerSrc = getWorkerBootstrapUrl(workerUrl, 'WorkerExtensionHost', true);
|
||||
const escapeAttribute = (value: string): string => {
|
||||
return value.replace(/"/g, '"');
|
||||
|
@ -173,7 +174,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
|
|||
private async _startOutsideIframe(): Promise<IMessagePassingProtocol> {
|
||||
const emitter = new Emitter<VSBuffer>();
|
||||
|
||||
const url = getWorkerBootstrapUrl(require.toUrl('../worker/extensionHostWorkerMain.js'), 'WorkerExtensionHost');
|
||||
const url = getWorkerBootstrapUrl(FileAccess.asBrowserUri('../worker/extensionHostWorkerMain.js', require).toString(true), 'WorkerExtensionHost');
|
||||
const worker = new Worker(url, { name: 'WorkerExtensionHost' });
|
||||
|
||||
const barrier = new Barrier();
|
||||
|
|
|
@ -21,6 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
|||
import { IExtHostRpcService, ExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { IURITransformerService, URITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
|
||||
import { IExtHostExtensionService, IHostUtils } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService';
|
||||
|
||||
export interface IExitFn {
|
||||
(code?: number): any;
|
||||
|
@ -61,6 +62,9 @@ export class ExtensionHostMain {
|
|||
|
||||
// todo@joh
|
||||
// ugly self - inject
|
||||
const terminalService = instaService.invokeFunction(accessor => accessor.get(IExtHostTerminalService));
|
||||
this._disposables.add(terminalService);
|
||||
|
||||
const logService = instaService.invokeFunction(accessor => accessor.get(ILogService));
|
||||
this._disposables.add(logService);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import { Schemas } from 'vs/base/common/network';
|
|||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { PersistentProtocol } from 'vs/base/parts/ipc/common/ipc.net';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
@ -205,8 +205,15 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
|
|||
const [telemetryInfo, remoteInitData] = await Promise.all([this._telemetryService.getTelemetryInfo(), this._initDataProvider.getInitData()]);
|
||||
|
||||
// Collect all identifiers for extension ids which can be considered "resolved"
|
||||
const remoteExtensions = new Set<string>();
|
||||
remoteInitData.extensions.forEach((extension) => remoteExtensions.add(ExtensionIdentifier.toKey(extension.identifier.value)));
|
||||
|
||||
const resolvedExtensions = remoteInitData.allExtensions.filter(extension => !extension.main && !extension.browser).map(extension => extension.identifier);
|
||||
const hostExtensions = remoteInitData.allExtensions.filter(extension => (extension.main || extension.browser) && extension.api === 'none').map(extension => extension.identifier);
|
||||
const hostExtensions = (
|
||||
remoteInitData.allExtensions
|
||||
.filter(extension => !remoteExtensions.has(ExtensionIdentifier.toKey(extension.identifier.value)))
|
||||
.filter(extension => (extension.main || extension.browser) && extension.api === 'none').map(extension => extension.identifier)
|
||||
);
|
||||
const workspace = this._contextService.getWorkspace();
|
||||
return {
|
||||
commit: this._productService.commit,
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { joinPath, originalFSPath } from 'vs/base/common/resources';
|
||||
|
@ -30,7 +29,7 @@ interface IExtensionCacheData {
|
|||
let _SystemExtensionsRoot: string | null = null;
|
||||
function getSystemExtensionsRoot(): string {
|
||||
if (!_SystemExtensionsRoot) {
|
||||
_SystemExtensionsRoot = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions'));
|
||||
_SystemExtensionsRoot = path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', 'extensions'));
|
||||
}
|
||||
return _SystemExtensionsRoot;
|
||||
}
|
||||
|
@ -38,7 +37,7 @@ function getSystemExtensionsRoot(): string {
|
|||
let _ExtraDevSystemExtensionsRoot: string | null = null;
|
||||
function getExtraDevSystemExtensionsRoot(): string {
|
||||
if (!_ExtraDevSystemExtensionsRoot) {
|
||||
_ExtraDevSystemExtensionsRoot = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', '.build', 'builtInExtensions'));
|
||||
_ExtraDevSystemExtensionsRoot = path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', '.build', 'builtInExtensions'));
|
||||
}
|
||||
return _ExtraDevSystemExtensionsRoot;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
|
|||
import { ChildProcess, fork } from 'child_process';
|
||||
import { Server, Socket, createServer } from 'net';
|
||||
import { CrashReporterStartOptions } from 'vs/base/parts/sandbox/electron-sandbox/electronTypes';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
|
@ -215,7 +215,7 @@ export class LocalProcessExtensionHost implements IExtensionHost {
|
|||
}
|
||||
|
||||
// Run Extension Host as fork of current process
|
||||
this._extensionHostProcess = fork(getPathFromAmdModule(require, 'bootstrap-fork'), ['--type=extensionHost'], opts);
|
||||
this._extensionHostProcess = fork(FileAccess.asFileUri('bootstrap-fork', require).fsPath, ['--type=extensionHost'], opts);
|
||||
|
||||
// Catch all output coming from the extension host process
|
||||
type Output = { data: string, format: string[] };
|
||||
|
|
|
@ -15,7 +15,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
|||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { getUriFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
interface IStorageData {
|
||||
dontShowPrompt: boolean;
|
||||
|
@ -142,7 +142,7 @@ export class IntegrityServiceImpl implements IIntegrityService {
|
|||
}
|
||||
|
||||
private _resolve(filename: string, expected: string): Promise<ChecksumPair> {
|
||||
const fileUri = getUriFromAmdModule(require, filename);
|
||||
const fileUri = FileAccess.asFileUri(filename, require);
|
||||
return new Promise<ChecksumPair>((resolve, reject) => {
|
||||
fs.readFile(fileUri.fsPath, (err, buff) => {
|
||||
if (err) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
@ -26,6 +25,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
|||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class LocalSearchService extends SearchService {
|
||||
constructor(
|
||||
|
@ -82,10 +82,7 @@ export class DiskSearch implements ISearchResultProvider {
|
|||
}
|
||||
}
|
||||
|
||||
const client = new Client(
|
||||
getPathFromAmdModule(require, 'bootstrap-fork'),
|
||||
opts);
|
||||
|
||||
const client = new Client(FileAccess.asFileUri('bootstrap-fork', require).fsPath, opts);
|
||||
const channel = getNextTickChannel(client.getChannel('search'));
|
||||
this.raw = new SearchChannelClient(channel);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IExtensionResourceLoaderService } from 'vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export class TextMateService extends AbstractTextMateService {
|
||||
|
||||
|
@ -31,8 +32,7 @@ export class TextMateService extends AbstractTextMateService {
|
|||
}
|
||||
|
||||
protected async _loadVSCodeOnigurumWASM(): Promise<Response | ArrayBuffer> {
|
||||
const wasmPath = require.toUrl('vscode-oniguruma/../onig.wasm');
|
||||
const response = await fetch(wasmPath);
|
||||
const response = await fetch(FileAccess.asBrowserUri('vscode-oniguruma/../onig.wasm', require).toString(true));
|
||||
// Using the response directly only works if the server sets the MIME type 'application/wasm'.
|
||||
// Otherwise, a TypeError is thrown when using the streaming compiler.
|
||||
// We therefore use the non-streaming compiler :(.
|
||||
|
|
|
@ -26,6 +26,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
|||
import { IExtensionResourceLoaderService } from 'vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
const RUN_TEXTMATE_IN_WORKER = false;
|
||||
|
||||
|
@ -182,12 +183,9 @@ export class TextMateService extends AbstractTextMateService {
|
|||
}
|
||||
|
||||
protected async _loadVSCodeOnigurumWASM(): Promise<Response | ArrayBuffer> {
|
||||
const wasmPath = (
|
||||
this._environmentService.isBuilt
|
||||
? require.toUrl('../../../../../../node_modules.asar.unpacked/vscode-oniguruma/release/onig.wasm')
|
||||
: require.toUrl('../../../../../../node_modules/vscode-oniguruma/release/onig.wasm')
|
||||
);
|
||||
const response = await fetch(wasmPath);
|
||||
const response = await fetch(this._environmentService.isBuilt
|
||||
? FileAccess.asBrowserUri('../../../../../../node_modules.asar.unpacked/vscode-oniguruma/release/onig.wasm', require).toString(true)
|
||||
: FileAccess.asBrowserUri('../../../../../../node_modules/vscode-oniguruma/release/onig.wasm', require).toString(true));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import { TokenizationStateStore } from 'vs/editor/common/model/textModelTokens';
|
|||
import type { IGrammar, StackElement, IRawTheme, IOnigLib } from 'vscode-textmate';
|
||||
import { MultilineTokensBuilder, countEOL } from 'vs/editor/common/model/tokensStore';
|
||||
import { LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
|
||||
export interface IValidGrammarDefinitionDTO {
|
||||
location: UriComponents;
|
||||
|
@ -146,8 +147,7 @@ export class TextMateWorker {
|
|||
});
|
||||
const vscodeTextmate = await import('vscode-textmate');
|
||||
const vscodeOniguruma = await import('vscode-oniguruma');
|
||||
const wasmPath = require.toUrl('vscode-oniguruma/../onig.wasm');
|
||||
const response = await fetch(wasmPath);
|
||||
const response = await fetch(FileAccess.asBrowserUri('vscode-oniguruma/../onig.wasm', require).toString(true));
|
||||
// Using the response directly only works if the server sets the MIME type 'application/wasm'.
|
||||
// Otherwise, a TypeError is thrown when using the streaming compiler.
|
||||
// We therefore use the non-streaming compiler :(.
|
||||
|
|
|
@ -48,8 +48,8 @@ suite('ExtHostDecorations', function () {
|
|||
|
||||
// never returns
|
||||
extHostDecorations.registerDecorationProvider({
|
||||
onDidChangeDecorations: Event.None,
|
||||
provideDecoration() {
|
||||
onDidChange: Event.None,
|
||||
provideFileDecoration() {
|
||||
calledA = true;
|
||||
return new Promise(() => { });
|
||||
}
|
||||
|
@ -57,10 +57,10 @@ suite('ExtHostDecorations', function () {
|
|||
|
||||
// always returns
|
||||
extHostDecorations.registerDecorationProvider({
|
||||
onDidChangeDecorations: Event.None,
|
||||
provideDecoration() {
|
||||
onDidChange: Event.None,
|
||||
provideFileDecoration() {
|
||||
calledB = true;
|
||||
return new Promise(resolve => resolve({ letter: 'H', title: 'Hello' }));
|
||||
return new Promise(resolve => resolve({ badge: 'H', tooltip: 'Hello' }));
|
||||
}
|
||||
}, nullExtensionDescription.identifier);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function initLoader(opts) {
|
|||
nodeRequire: require,
|
||||
nodeMain: __filename,
|
||||
catchError: true,
|
||||
baseUrl: bootstrap.fileUriFromPath(path.join(__dirname, '../../../src'), process.platform === 'win32'),
|
||||
baseUrl: bootstrap.fileUriFromPath(path.join(__dirname, '../../../src'), { isWindows: process.platform === 'win32' }),
|
||||
paths: {
|
||||
'vs': `../${outdir}/vs`,
|
||||
'lib': `../${outdir}/lib`,
|
||||
|
|
Loading…
Reference in a new issue