Merge remote-tracking branch 'origin/main' into tyriar/auto_replies__eslint

This commit is contained in:
Daniel Imms
2024-09-30 07:04:26 -07:00
71 changed files with 706 additions and 1590 deletions
+11 -1
View File
@@ -1141,8 +1141,18 @@
"restrictions": []
},
{
"target": "src/{bootstrap-cli.ts,bootstrap-esm.ts,bootstrap-fork.ts,bootstrap-node.ts,bootstrap-import.ts,bootstrap-meta.ts,bootstrap-window.ts,cli.ts,main.ts,server-cli.ts,server-main.ts,bootstrap-server.ts}",
"target": "src/bootstrap-window.ts",
"restrictions": []
},
{
"target": "src/{bootstrap-cli.ts,bootstrap-esm.ts,bootstrap-fork.ts,bootstrap-import.ts,bootstrap-meta.ts,bootstrap-node.ts,bootstrap-server.ts,cli.ts,main.ts,server-cli.ts,server-main.ts}",
"restrictions": [
"vs/**/common/*",
"vs/**/node/*",
"vs/nls.js",
"src/*.js",
"*" // node.js
]
}
]
}
+9 -12
View File
@@ -26,20 +26,17 @@ function createModuleDescription(name, exclude) {
* @param {string} name
*/
function createEditorWorkerModuleDescription(name) {
const description = createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
description.name = `${description.name}.esm`;
return description;
return createModuleDescription(name, ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']);
}
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorSimpleWorker');
exports.workerExtensionHost = createEditorWorkerModuleDescription('vs/workbench/api/worker/extensionHostWorker');
exports.workerNotebook = createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookSimpleWorker');
exports.workerLanguageDetection = createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker');
exports.workerLocalFileSearch = createEditorWorkerModuleDescription('vs/workbench/services/search/worker/localFileSearch');
exports.workerProfileAnalysis = createEditorWorkerModuleDescription('vs/platform/profiling/electron-sandbox/profileAnalysisWorker');
exports.workerOutputLinks = createEditorWorkerModuleDescription('vs/workbench/contrib/output/common/outputLinkComputer');
exports.workerBackgroundTokenization = createEditorWorkerModuleDescription('vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker');
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorSimpleWorkerMain');
exports.workerExtensionHost = createEditorWorkerModuleDescription('vs/workbench/api/worker/extensionHostWorkerMain');
exports.workerNotebook = createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain');
exports.workerLanguageDetection = createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorkerMain');
exports.workerLocalFileSearch = createEditorWorkerModuleDescription('vs/workbench/services/search/worker/localFileSearchMain');
exports.workerProfileAnalysis = createEditorWorkerModuleDescription('vs/platform/profiling/electron-sandbox/profileAnalysisWorkerMain');
exports.workerOutputLinks = createEditorWorkerModuleDescription('vs/workbench/contrib/output/common/outputLinkComputerMain');
exports.workerBackgroundTokenization = createEditorWorkerModuleDescription('vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain');
exports.workbenchDesktop = [
createModuleDescription('vs/workbench/contrib/debug/node/telemetryApp'),
+2 -8
View File
@@ -8,17 +8,11 @@ const vfs = require('vinyl-fs');
const { eslintFilter } = require('./filters');
function eslint() {
const gulpeslint = require('gulp-eslint');
const eslint = require('./gulp-eslint');
return vfs
.src(eslintFilter, { base: '.', follow: true, allowEmpty: true })
.pipe(
gulpeslint({
configFile: '.eslintrc.json'
})
)
.pipe(gulpeslint.formatEach('compact'))
.pipe(
gulpeslint.results((results) => {
eslint((results) => {
if (results.warningCount > 0 || results.errorCount > 0) {
throw new Error('eslint failed with warnings and/or errors');
}
+78
View File
@@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const { ESLint } = require('eslint');
const { Transform } = require('stream');
const { relative } = require('path');
const fancyLog = require('fancy-log');
/**
* @param {Function} action - A function to handle all ESLint results
* @returns {stream} gulp file stream
*/
function eslint(action) {
const linter = new ESLint();
const formatter = linter.loadFormatter('compact');
const results = [];
results.errorCount = 0;
results.warningCount = 0;
return transform(
async (file, enc, cb) => {
const filePath = relative(process.cwd(), file.path);
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isStream()) {
cb(new Error('vinyl files with Stream contents are not supported'));
return;
}
try {
// TODO: Should this be checked?
if (await linter.isPathIgnored(filePath)) {
cb(null, file);
return;
}
const result = (await linter.lintText(file.contents.toString(), { filePath }))[0];
results.push(result);
results.errorCount += result.errorCount;
results.warningCount += result.warningCount;
const message = (await formatter).format([result]);
if (message) {
fancyLog(message);
}
cb(null, file);
} catch (error) {
cb(error);
}
},
(done) => {
try {
action(results);
done();
} catch (error) {
done(error);
}
});
}
function transform(transform, flush) {
return new Transform({
objectMode: true,
transform,
flush
});
}
module.exports = eslint;
+2 -8
View File
@@ -21,7 +21,7 @@ const copyrightHeaderLines = [
];
function hygiene(some, linting = true) {
const gulpeslint = require('gulp-eslint');
const eslint = require('./gulp-eslint');
const gulpstylelint = require('./stylelint');
const formatter = require('./lib/formatter');
@@ -172,13 +172,7 @@ function hygiene(some, linting = true) {
result
.pipe(filter(eslintFilter))
.pipe(
gulpeslint({
configFile: '.eslintrc.json'
})
)
.pipe(gulpeslint.formatEach('compact'))
.pipe(
gulpeslint.results((results) => {
eslint((results) => {
errorCount += results.warningCount;
errorCount += results.errorCount;
})
@@ -17,6 +17,10 @@
"--vscode-activityBarTop-dropBorder",
"--vscode-activityBarTop-foreground",
"--vscode-activityBarTop-inactiveForeground",
"--vscode-activityErrorBadge-background",
"--vscode-activityErrorBadge-foreground",
"--vscode-activityWarningBadge-background",
"--vscode-activityWarningBadge-foreground",
"--vscode-badge-background",
"--vscode-badge-foreground",
"--vscode-banner-background",
@@ -150,6 +154,7 @@
"--vscode-editor-placeholder-foreground",
"--vscode-editor-rangeHighlightBackground",
"--vscode-editor-rangeHighlightBorder",
"--vscode-editor-compositionBorder",
"--vscode-editor-selectionBackground",
"--vscode-editor-selectionForeground",
"--vscode-editor-selectionHighlightBackground",
@@ -546,14 +551,16 @@
"--vscode-scmGraph-foreground1",
"--vscode-scmGraph-foreground2",
"--vscode-scmGraph-foreground3",
"--vscode-scmGraph-foreground4",
"--vscode-scmGraph-foreground5",
"--vscode-scmGraph-historyItemBaseRefColor",
"--vscode-scmGraph-historyItemRefColor",
"--vscode-scmGraph-historyItemRemoteRefColor",
"--vscode-scmGraph-historyItemHoverAdditionsForeground",
"--vscode-scmGraph-historyItemHoverDefaultLabelBackground",
"--vscode-scmGraph-historyItemHoverDefaultLabelForeground",
"--vscode-scmGraph-historyItemHoverDeletionsForeground",
"--vscode-scmGraph-historyItemHoverLabelForeground",
"--vscode-scmGraph-historyItemRefColor",
"--vscode-scmGraph-historyItemRemoteRefColor",
"--vscode-scrollbar-shadow",
"--vscode-scrollbarSlider-activeBackground",
"--vscode-scrollbarSlider-background",
@@ -881,4 +888,4 @@
"--widget-color",
"--text-link-decoration"
]
}
}
@@ -12,20 +12,20 @@ export class ActiveLineMarker {
this._update(previous && (previous.codeElement || previous.element));
}
_update(before: HTMLElement | undefined) {
private _update(before: HTMLElement | undefined) {
this._unmarkActiveElement(this._current);
this._markActiveElement(before);
this._current = before;
}
_unmarkActiveElement(element: HTMLElement | undefined) {
private _unmarkActiveElement(element: HTMLElement | undefined) {
if (!element) {
return;
}
element.classList.toggle('code-active-line', false);
}
_markActiveElement(element: HTMLElement | undefined) {
private _markActiveElement(element: HTMLElement | undefined) {
if (!element) {
return;
}
@@ -11,45 +11,45 @@ import { getStrings } from './strings';
* Shows an alert when there is a content security policy violation.
*/
export class CspAlerter {
private didShow = false;
private didHaveCspWarning = false;
private _didShow = false;
private _didHaveCspWarning = false;
private messaging?: MessagePoster;
private _messaging?: MessagePoster;
constructor(
private readonly settingsManager: SettingsManager,
private readonly _settingsManager: SettingsManager,
) {
document.addEventListener('securitypolicyviolation', () => {
this.onCspWarning();
this._onCspWarning();
});
window.addEventListener('message', (event) => {
if (event && event.data && event.data.name === 'vscode-did-block-svg') {
this.onCspWarning();
this._onCspWarning();
}
});
}
public setPoster(poster: MessagePoster) {
this.messaging = poster;
if (this.didHaveCspWarning) {
this.showCspWarning();
this._messaging = poster;
if (this._didHaveCspWarning) {
this._showCspWarning();
}
}
private onCspWarning() {
this.didHaveCspWarning = true;
this.showCspWarning();
private _onCspWarning() {
this._didHaveCspWarning = true;
this._showCspWarning();
}
private showCspWarning() {
private _showCspWarning() {
const strings = getStrings();
const settings = this.settingsManager.settings;
const settings = this._settingsManager.settings;
if (this.didShow || settings.disableSecurityWarnings || !this.messaging) {
if (this._didShow || settings.disableSecurityWarnings || !this._messaging) {
return;
}
this.didShow = true;
this._didShow = true;
const notification = document.createElement('a');
notification.innerText = strings.cspAlertMessageText;
@@ -59,7 +59,7 @@ export class CspAlerter {
notification.setAttribute('role', 'button');
notification.setAttribute('aria-label', strings.cspAlertMessageLabel);
notification.onclick = () => {
this.messaging!.postMessage('showPreviewSecuritySelector', { source: settings.source });
this._messaging!.postMessage('showPreviewSecuritySelector', { source: settings.source });
};
document.body.appendChild(notification);
}
@@ -5,15 +5,15 @@
import { MessagePoster } from './messaging';
export class StyleLoadingMonitor {
private unloadedStyles: string[] = [];
private finishedLoading: boolean = false;
private _unloadedStyles: string[] = [];
private _finishedLoading: boolean = false;
private poster?: MessagePoster;
private _poster?: MessagePoster;
constructor() {
const onStyleLoadError = (event: any) => {
const source = event.target.dataset.source;
this.unloadedStyles.push(source);
this._unloadedStyles.push(source);
};
window.addEventListener('DOMContentLoaded', () => {
@@ -25,18 +25,18 @@ export class StyleLoadingMonitor {
});
window.addEventListener('load', () => {
if (!this.unloadedStyles.length) {
if (!this._unloadedStyles.length) {
return;
}
this.finishedLoading = true;
this.poster?.postMessage('previewStyleLoadError', { unloadedStyles: this.unloadedStyles });
this._finishedLoading = true;
this._poster?.postMessage('previewStyleLoadError', { unloadedStyles: this._unloadedStyles });
});
}
public setPoster(poster: MessagePoster): void {
this.poster = poster;
if (this.finishedLoading) {
poster.postMessage('previewStyleLoadError', { unloadedStyles: this.unloadedStyles });
this._poster = poster;
if (this._finishedLoading) {
poster.postMessage('previewStyleLoadError', { unloadedStyles: this._unloadedStyles });
}
}
}
@@ -1989,7 +1989,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -2507,7 +2507,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -2801,16 +2801,16 @@
},
{
"c": "t",
"t": "variable variable.other.constant",
"t": "variable",
"r": {
"dark_plus": "variable.other.constant: #4FC1FF",
"light_plus": "variable.other.constant: #0070C1",
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_modern": "variable.other.constant: #4FC1FF",
"hc_light": "variable.other.constant: #02715D",
"light_modern": "variable.other.constant: #0070C1"
"dark_modern": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_modern": "variable: #001080"
}
},
{
@@ -155,16 +155,16 @@
},
{
"c": "timeRange",
"t": "variable variable.other.constant",
"t": "variable",
"r": {
"dark_plus": "variable.other.constant: #4FC1FF",
"light_plus": "variable.other.constant: #0070C1",
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_modern": "variable.other.constant: #4FC1FF",
"hc_light": "variable.other.constant: #02715D",
"light_modern": "variable.other.constant: #0070C1"
"dark_modern": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_modern": "variable: #001080"
}
},
{
@@ -85,16 +85,16 @@
},
{
"c": "foo",
"t": "variable entity.name.function variable.other.constant",
"t": "variable entity.name.function",
"r": {
"dark_plus": "variable.other.constant: #4FC1FF",
"light_plus": "variable.other.constant: #0070C1",
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_modern": "variable.other.constant: #4FC1FF",
"hc_light": "variable.other.constant: #02715D",
"light_modern": "variable.other.constant: #0070C1"
"hc_black": "entity.name.function: #DCDCAA",
"dark_modern": "entity.name.function: #DCDCAA",
"hc_light": "entity.name.function: #5E2CBC",
"light_modern": "entity.name.function: #795E26"
}
},
{
@@ -169,7 +169,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -85,7 +85,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -323,7 +323,7 @@
},
{
"c": "constructor",
"t": "variable meta.definition.method entity.name.function storage.type",
"t": "variable meta.definition.method storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -1457,7 +1457,7 @@
},
{
"c": "constructor",
"t": "variable meta.definition.method entity.name.function storage.type",
"t": "variable meta.definition.method storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -2717,7 +2717,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -3319,7 +3319,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
@@ -3879,7 +3879,7 @@
},
{
"c": "=>",
"t": "keyword.operator storage.type",
"t": "storage.type",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
+67 -1025
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -114,6 +114,7 @@
"@swc/core": "1.3.62",
"@types/cookie": "^0.3.3",
"@types/debug": "^4.1.5",
"@types/eslint": "^8.56.10",
"@types/gulp-svgmin": "^1.2.1",
"@types/http-proxy-agent": "^2.0.1",
"@types/kerberos": "^1.1.2",
@@ -165,7 +166,6 @@
"gulp-bom": "^3.0.0",
"gulp-buffer": "0.0.2",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^5.0.0",
"gulp-filter": "^5.1.0",
"gulp-flatmap": "^1.0.2",
"gulp-gunzip": "^1.0.0",
+10 -13
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
@@ -120,18 +118,17 @@ async function doSetupNLS(): Promise<INLSConfiguration | undefined> {
//#region ESM Loading
export function load(esModule: string | undefined, onLoad?: (value: any) => void, onError?: (err: Error) => void): void {
if (!esModule) {
return;
export async function load<T>(esModule: string): Promise<T> {
try {
// NLS comes first
await setupNLS();
// Then load the ES module
return await import([`./${esModule}.js`].join('/') /* workaround to prevent esbuild from inlining this */);
} catch (error) {
console.error(`Unable to load ${esModule}: ${error}`);
throw error;
}
onLoad = onLoad || function () { };
onError = onError || function (err) { console.error(err); };
setupNLS().then(() => {
performance.mark(`code/fork/willLoadCode`);
import([`./${esModule}.js`].join('/') /* workaround to prevent esbuild from inlining this */).then(onLoad, onError);
});
}
//#endregion
+1 -3
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as performance from './vs/base/common/performance.js';
import { removeGlobalNodeJsModuleLookupPaths, devInjectNodeModuleLookupPath } from './bootstrap-node.js';
import { load } from './bootstrap-esm.js';
@@ -37,7 +35,7 @@ if (process.env['VSCODE_PARENT_PID']) {
}
// Load ESM entry point
load(process.env['VSCODE_ESM_ENTRYPOINT']);
load(process.env['VSCODE_ESM_ENTRYPOINT']!);
//#region Helpers
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
// *********************************************************************
// * *
// * We need this to redirect to node_modules from the remote-folder. *
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import { createRequire } from 'node:module';
import type { IProductConfiguration } from './vs/base/common/product.js';
-2
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
+18 -21
View File
@@ -8,32 +8,27 @@
(function () {
type ISandboxConfiguration = import('vs/base/parts/sandbox/common/sandboxTypes.js').ISandboxConfiguration;
type ILoadResult<M, T extends ISandboxConfiguration> = import('vs/platform/window/electron-sandbox/window.js').ILoadResult<M, T>;
type ILoadOptions<T extends ISandboxConfiguration> = import('vs/platform/window/electron-sandbox/window.js').ILoadOptions<T>;
type IMainWindowSandboxGlobals = import('./vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
const safeProcess = preloadGlobals.process;
// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
Error.stackTraceLimit = 100;
async function load<T extends ISandboxConfiguration>(esModule: string, resultCallback: (result: any, configuration: T) => Promise<unknown> | undefined, options: ILoadOptions<T>): Promise<void> {
async function load<M, T extends ISandboxConfiguration>(esModule: string, options: ILoadOptions<T>): Promise<ILoadResult<M, T>> {
// Window Configuration from Preload Script
const configuration = await resolveWindowConfiguration<T>();
// Signal can modify DOM
options?.canModifyDOM?.(configuration);
// Signal before import()
options?.beforeImport?.(configuration);
// Developer settings
const { enableDeveloperKeybindings, removeDeveloperKeybindingsAfterLoad, developerDeveloperKeybindingsDisposable } = setupDeveloperKeybindings(configuration, options);
const { enableDeveloperKeybindings, removeDeveloperKeybindingsAfterLoad, developerDeveloperKeybindingsDisposable, forceDisableShowDevtoolsOnError } = setupDeveloperKeybindings(configuration, options);
// NLS
setupNLS<T>(configuration);
// Signal before import()
options?.beforeImport?.(configuration);
// Compute base URL and set as global
const baseUrl = new URL(`${fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out/`);
globalThis._VSCODE_FILE_ROOT = baseUrl.toString();
@@ -45,16 +40,15 @@
try {
const result = await import(new URL(`${esModule}.js`, baseUrl).href);
const callbackResult = resultCallback(result, configuration);
if (callbackResult instanceof Promise) {
await callbackResult;
if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) {
developerDeveloperKeybindingsDisposable();
}
if (developerDeveloperKeybindingsDisposable && removeDeveloperKeybindingsAfterLoad) {
developerDeveloperKeybindingsDisposable();
}
return { result, configuration };
} catch (error) {
onUnexpectedError(error, enableDeveloperKeybindings);
onUnexpectedError(error, enableDeveloperKeybindings && !forceDisableShowDevtoolsOnError);
throw error;
}
}
@@ -74,11 +68,13 @@
const {
forceEnableDeveloperKeybindings,
disallowReloadKeybinding,
removeDeveloperKeybindingsAfterLoad
removeDeveloperKeybindingsAfterLoad,
forceDisableShowDevtoolsOnError
} = typeof options?.configureDeveloperSettings === 'function' ? options.configureDeveloperSettings(configuration) : {
forceEnableDeveloperKeybindings: false,
disallowReloadKeybinding: false,
removeDeveloperKeybindingsAfterLoad: false
removeDeveloperKeybindingsAfterLoad: false,
forceDisableShowDevtoolsOnError: false
};
const isDev = !!safeProcess.env['VSCODE_DEV'];
@@ -91,7 +87,8 @@
return {
enableDeveloperKeybindings,
removeDeveloperKeybindingsAfterLoad,
developerDeveloperKeybindingsDisposable
developerDeveloperKeybindingsDisposable,
forceDisableShowDevtoolsOnError
};
}
+2 -4
View File
@@ -3,17 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-cli.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { configurePortable } from './bootstrap-node.js';
import { load } from './bootstrap-esm.js';
import { resolveNLSConfiguration } from './vs/base/node/nls.js';
import { product } from './bootstrap-meta.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const __dirname = dirname(fileURLToPath(import.meta.url));
// NLS
const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname });
+4 -7
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import * as path from 'path';
import * as fs from 'original-fs';
import * as os from 'os';
@@ -162,7 +160,7 @@ async function onReady() {
resolveNlsConfiguration()
]);
startup(codeCachePath, nlsConfig);
await startup(codeCachePath, nlsConfig);
} catch (error) {
console.error(error);
}
@@ -171,14 +169,13 @@ async function onReady() {
/**
* Main startup routine
*/
function startup(codeCachePath: string | undefined, nlsConfig: INLSConfiguration): void {
async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfiguration): Promise<void> {
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
perf.mark('code/willLoadMainBundle');
load('vs/code/electron-main/main', () => {
perf.mark('code/didLoadMainBundle');
});
await load('vs/code/electron-main/main');
perf.mark('code/didLoadMainBundle');
}
function configureCommandlineSwitchesSync(cliArgs: NativeParsedArgs) {
+3 -5
View File
@@ -3,17 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-server.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { devInjectNodeModuleLookupPath } from './bootstrap-node.js';
import { load } from './bootstrap-esm.js';
import { resolveNLSConfiguration } from './vs/base/node/nls.js';
import { product } from './bootstrap-meta.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const __dirname = dirname(fileURLToPath(import.meta.url));
// NLS
const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname });
@@ -22,7 +20,7 @@ process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required
if (process.env['VSCODE_DEV']) {
// When running out of sources, we need to load node modules from remote/node_modules,
// which are compiled against nodejs, not electron
process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || path.join(__dirname, '..', 'remote', 'node_modules');
process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || join(__dirname, '..', 'remote', 'node_modules');
devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
} else {
delete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];
+17 -21
View File
@@ -3,8 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable local/code-import-patterns */
import './bootstrap-server.js'; // this MUST come before other imports as it changes global state
import * as path from 'path';
import * as http from 'http';
@@ -230,29 +228,27 @@ async function findFreePort(host: string | undefined, start: number, end: number
}
function loadCode(nlsConfiguration: INLSConfiguration): Promise<typeof import('./vs/server/node/server.main.js')> {
return new Promise((resolve, reject) => {
// required for `bootstrap-esm` to pick up NLS messages
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration);
// required for `bootstrap-esm` to pick up NLS messages
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration);
// See https://github.com/microsoft/vscode-remote-release/issues/6543
// We would normally install a SIGPIPE listener in bootstrap-node.js
// But in certain situations, the console itself can be in a broken pipe state
// so logging SIGPIPE to the console will cause an infinite async loop
process.env['VSCODE_HANDLES_SIGPIPE'] = 'true';
// See https://github.com/microsoft/vscode-remote-release/issues/6543
// We would normally install a SIGPIPE listener in bootstrap-node.js
// But in certain situations, the console itself can be in a broken pipe state
// so logging SIGPIPE to the console will cause an infinite async loop
process.env['VSCODE_HANDLES_SIGPIPE'] = 'true';
if (process.env['VSCODE_DEV']) {
// When running out of sources, we need to load node modules from remote/node_modules,
// which are compiled against nodejs, not electron
process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || path.join(__dirname, '..', 'remote', 'node_modules');
devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
} else {
delete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];
}
if (process.env['VSCODE_DEV']) {
// When running out of sources, we need to load node modules from remote/node_modules,
// which are compiled against nodejs, not electron
process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || path.join(__dirname, '..', 'remote', 'node_modules');
devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
} else {
delete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];
}
// Load Server
load('vs/server/node/server.main', resolve, reject);
});
// Load Server
return load<typeof import('./vs/server/node/server.main.js')>('vs/server/node/server.main');
}
function hasStdinWithoutTty(): boolean {
+3 -24
View File
@@ -26,31 +26,10 @@
]
},
"include": [
"./bootstrap-esm.ts",
"./bootstrap-cli.ts",
"./bootstrap-fork.ts",
"./bootstrap-import.ts",
"./bootstrap-meta.ts",
"./bootstrap-node.ts",
"./bootstrap-server.ts",
"./bootstrap-window.ts",
"./cli.ts",
"./main.ts",
"./server-main.ts",
"./server-cli.ts",
"./vs/base/common/jsonc.ts",
"./vs/base/common/performance.ts",
"./vs/base/node/unc.ts",
"./vs/base/node/nls.ts",
"./vs/platform/environment/node/userDataPath.ts",
"./vs/base/parts/sandbox/electron-sandbox/preload-aux.ts",
"./vs/base/parts/sandbox/electron-sandbox/preload.ts",
"./vs/code/electron-sandbox/processExplorer/processExplorer.ts",
"./vs/code/electron-sandbox/workbench/workbench.ts",
"./vs/workbench/contrib/issue/electron-sandbox/issueReporter.ts",
"./*.ts",
"./typings",
"./vs/**/*.ts",
"vscode-dts/vscode.proposed.*.d.ts",
"vscode-dts/vscode.d.ts"
"./vscode-dts/vscode.proposed.*.d.ts",
"./vscode-dts/vscode.d.ts"
]
}
+6 -6
View File
@@ -119,7 +119,7 @@ class WebWorker extends Disposable implements IWorker {
private readonly label: string;
private worker: Promise<Worker> | null;
constructor(esmWorkerLocation: URI | undefined, amdModuleId: string, id: number, label: string, onMessageCallback: IWorkerCallback, onErrorCallback: (err: any) => void) {
constructor(esmWorkerLocation: URI | undefined, moduleId: string, id: number, label: string, onMessageCallback: IWorkerCallback, onErrorCallback: (err: any) => void) {
super();
this.id = id;
this.label = label;
@@ -129,7 +129,7 @@ class WebWorker extends Disposable implements IWorker {
} else {
this.worker = Promise.resolve(workerOrPromise);
}
this.postMessage(amdModuleId, []);
this.postMessage(moduleId, []);
this.worker.then((w) => {
w.onmessage = function (ev) {
onMessageCallback(ev.data);
@@ -171,10 +171,10 @@ export class WorkerDescriptor implements IWorkerDescriptor {
public readonly esmModuleLocation: URI | undefined;
constructor(
public readonly amdModuleId: string,
public readonly moduleId: string,
readonly label: string | undefined,
) {
this.esmModuleLocation = FileAccess.asBrowserUri(`${amdModuleId}.esm.js` as AppResourcePath);
this.esmModuleLocation = FileAccess.asBrowserUri(`${moduleId}Main.js` as AppResourcePath);
}
}
@@ -194,7 +194,7 @@ class DefaultWorkerFactory implements IWorkerFactory {
throw this._webWorkerFailedBeforeError;
}
return new WebWorker(desc.esmModuleLocation, desc.amdModuleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
return new WebWorker(desc.esmModuleLocation, desc.moduleId, workerId, desc.label || 'anonymous' + workerId, onMessageCallback, (err) => {
logOnceWebWorkerWarning(err);
this._webWorkerFailedBeforeError = err;
onErrorCallback(err);
@@ -202,7 +202,7 @@ class DefaultWorkerFactory implements IWorkerFactory {
}
}
export function createWebWorker<T extends object>(amdModuleId: string, label: string | undefined): IWorkerClient<T>;
export function createWebWorker<T extends object>(moduleId: string, label: string | undefined): IWorkerClient<T>;
export function createWebWorker<T extends object>(workerDescriptor: IWorkerDescriptor): IWorkerClient<T>;
export function createWebWorker<T extends object>(arg0: string | IWorkerDescriptor, arg1?: string | undefined): IWorkerClient<T> {
const workerDescriptor = (typeof arg0 === 'string' ? new WorkerDescriptor(arg0, arg1) : arg0);
+4 -4
View File
@@ -29,7 +29,7 @@ export interface IWorkerFactory {
}
export interface IWorkerDescriptor {
readonly amdModuleId: string;
readonly moduleId: string;
readonly esmModuleLocation: URI | undefined;
readonly label: string | undefined;
}
@@ -332,7 +332,7 @@ export class SimpleWorkerClient<W extends object> extends Disposable implements
this._worker = this._register(workerFactory.create(
{
amdModuleId: 'vs/base/common/worker/simpleWorker',
moduleId: 'vs/base/common/worker/simpleWorker',
esmModuleLocation: workerDescriptor.esmModuleLocation,
label: workerDescriptor.label
},
@@ -375,12 +375,12 @@ export class SimpleWorkerClient<W extends object> extends Disposable implements
this._onModuleLoaded = this._protocol.sendMessage(DEFAULT_CHANNEL, INITIALIZE, [
this._worker.getId(),
JSON.parse(JSON.stringify(loaderConfiguration)),
workerDescriptor.amdModuleId,
workerDescriptor.moduleId,
]);
this.proxy = this._protocol.createProxyToRemoteChannel(DEFAULT_CHANNEL, async () => { await this._onModuleLoaded; });
this._onModuleLoaded.catch((e) => {
this._onError('Worker failed to load ' + workerDescriptor.amdModuleId, e);
this._onError('Worker failed to load ' + workerDescriptor.moduleId, e);
});
}
@@ -5,18 +5,21 @@
/* eslint-disable no-restricted-globals */
(function () {
(async function () {
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IProcessExplorerMain = import('vs/code/electron-sandbox/processExplorer/processExplorerMain.js').IProcessExplorerMain;
type ProcessExplorerWindowConfiguration = import('vs/platform/issue/common/issue.js').ProcessExplorerWindowConfiguration;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
bootstrapWindow.load('vs/code/electron-sandbox/processExplorer/processExplorerMain', function (processExplorer, configuration) {
return processExplorer.startup(configuration);
}, {
const { result, configuration } = await bootstrapWindow.load<IProcessExplorerMain, ProcessExplorerWindowConfiguration>('vs/code/electron-sandbox/processExplorer/processExplorerMain', {
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true
};
},
});
result.startup(configuration);
}());
@@ -591,6 +591,10 @@ function createCodiconStyleSheet() {
delayer.schedule();
}
export interface IProcessExplorerMain {
startup(configuration: ProcessExplorerWindowConfiguration): void;
}
export function startup(configuration: ProcessExplorerWindowConfiguration): void {
const platformClass = configuration.data.platform === 'win32' ? 'windows' : configuration.data.platform === 'linux' ? 'linux' : 'mac';
mainWindow.document.body.classList.add(platformClass); // used by our fonts
@@ -5,86 +5,33 @@
/* eslint-disable no-restricted-globals */
(function () {
type INativeWindowConfiguration = import('vs/platform/window/common/window.ts').INativeWindowConfiguration;
type NativeParsedArgs = import('vs/platform/environment/common/argv.js').NativeParsedArgs;
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IMainWindowSandboxGlobals = import('vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
(async function () {
// Add a perf entry right from the top
performance.mark('code/didStartRenderer');
// Load workbench main JS and CSS all in parallel. This is an
// optimization to prevent a waterfall of loading to happen, because
// we know for a fact that workbench.desktop.main will depend on
// the related CSS counterpart.
bootstrapWindow.load<INativeWindowConfiguration>('vs/workbench/workbench.desktop.main',
function (desktopMain, configuration) {
type INativeWindowConfiguration = import('vs/platform/window/common/window.ts').INativeWindowConfiguration;
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IMainWindowSandboxGlobals = import('vs/base/parts/sandbox/electron-sandbox/globals.js').IMainWindowSandboxGlobals;
type IDesktopMain = import('vs/workbench/electron-sandbox/desktop.main.js').IDesktopMain;
// Mark start of workbench
performance.mark('code/didLoadWorkbenchMain');
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
const preloadGlobals: IMainWindowSandboxGlobals = (window as any).vscode; // defined by preload.ts
return desktopMain.main(configuration);
},
{
configureDeveloperSettings: function (windowConfig) {
return {
// disable automated devtools opening on error when running extension tests
// as this can lead to nondeterministic test execution (devtools steals focus)
forceDisableShowDevtoolsOnError: typeof windowConfig.extensionTestsPath === 'string' || windowConfig['enable-smoke-test-driver'] === true,
// enable devtools keybindings in extension development window
forceEnableDeveloperKeybindings: Array.isArray(windowConfig.extensionDevelopmentPath) && windowConfig.extensionDevelopmentPath.length > 0,
removeDeveloperKeybindingsAfterLoad: true
};
},
canModifyDOM: function (windowConfig) {
showSplash(windowConfig);
},
beforeImport: function (windowConfig) {
performance.mark('code/willLoadWorkbenchMain');
//#region Splash Screen Helpers
// Code windows have a `vscodeWindowId` property to identify them
Object.defineProperty(window, 'vscodeWindowId', {
get: () => windowConfig.windowId
});
// It looks like browsers only lazily enable
// the <canvas> element when needed. Since we
// leverage canvas elements in our code in many
// locations, we try to help the browser to
// initialize canvas when it is idle, right
// before we wait for the scripts to be loaded.
window.requestIdleCallback(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context?.clearRect(0, 0, canvas.width, canvas.height);
canvas.remove();
}, { timeout: 50 });
}
}
);
//#region Helpers
function showSplash(configuration: INativeWindowConfiguration & NativeParsedArgs) {
function showSplash(configuration: INativeWindowConfiguration) {
performance.mark('code/willShowPartsSplash');
let data = configuration.partsSplash;
if (data) {
// high contrast mode has been turned by the OS -> ignore stored colors and layouts
if (configuration.autoDetectHighContrast && configuration.colorScheme.highContrast) {
if ((configuration.colorScheme.dark && data.baseTheme !== 'hc-black') || (!configuration.colorScheme.dark && data.baseTheme !== 'hc-light')) {
data = undefined;
data = undefined; // high contrast mode has been turned by the OS -> ignore stored colors and layouts
}
} else if (configuration.autoDetectColorScheme) {
// OS color scheme is tracked and has changed
if ((configuration.colorScheme.dark && data.baseTheme !== 'vs-dark') || (!configuration.colorScheme.dark && data.baseTheme !== 'vs')) {
data = undefined;
data = undefined; // OS color scheme is tracked and has changed
}
}
}
@@ -127,12 +74,7 @@
const style = document.createElement('style');
style.className = 'initialShellColors';
window.document.head.appendChild(style);
style.textContent = `body {
background-color: ${shellBackground};
color: ${shellForeground};
margin: 0;
padding: 0;
}`;
style.textContent = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`;
// set zoom level as soon as possible
if (typeof data?.zoomLevel === 'number' && typeof preloadGlobals?.webFrame?.setZoomLevel === 'function') {
@@ -148,12 +90,10 @@
splash.className = baseTheme ?? 'vs-dark';
if (layoutInfo.windowBorder && colorInfo.windowBorder) {
splash.setAttribute('style', `
position: relative;
height: calc(100vh - 2px);
width: calc(100vw - 2px);
border: 1px solid var(--window-border-color);
`);
splash.style.position = 'relative';
splash.style.height = 'calc(100vh - 2px)';
splash.style.width = 'calc(100vw - 2px)';
splash.style.border = `1px solid var(--window-border-color)`;
splash.style.setProperty('--window-border-color', colorInfo.windowBorder);
if (layoutInfo.windowBorderRadius) {
@@ -166,52 +106,53 @@
// part: title
const titleDiv = document.createElement('div');
titleDiv.setAttribute('style', `
position: absolute;
width: 100%;
height: ${layoutInfo.titleBarHeight}px;
left: 0;
top: 0;
background-color: ${colorInfo.titleBarBackground};
-webkit-app-region: drag;
`);
titleDiv.style.position = 'absolute';
titleDiv.style.width = '100%';
titleDiv.style.height = `${layoutInfo.titleBarHeight}px`;
titleDiv.style.left = '0';
titleDiv.style.top = '0';
titleDiv.style.backgroundColor = `${colorInfo.titleBarBackground}`;
(titleDiv.style as any)['-webkit-app-region'] = 'drag';
splash.appendChild(titleDiv);
if (colorInfo.titleBarBorder && layoutInfo.titleBarHeight > 0) {
const titleBorder = document.createElement('div');
titleBorder.setAttribute('style', `
position: absolute;
width: 100%;
height: 1px;
left: 0;
bottom: 0;
border-bottom: 1px solid ${colorInfo.titleBarBorder};
`);
titleBorder.style.position = 'absolute';
titleBorder.style.width = '100%';
titleBorder.style.height = '1px';
titleBorder.style.left = '0';
titleBorder.style.bottom = '0';
titleBorder.style.borderBottom = `1px solid ${colorInfo.titleBarBorder}`;
titleDiv.appendChild(titleBorder);
}
// part: activity bar
const activityDiv = document.createElement('div');
activityDiv.setAttribute('style', `
position: absolute;
width: ${layoutInfo.activityBarWidth}px;
height: calc(100% - ${layoutInfo.titleBarHeight + layoutInfo.statusBarHeight}px);
top: ${layoutInfo.titleBarHeight}px;
${layoutInfo.sideBarSide}: 0;
background-color: ${colorInfo.activityBarBackground};
`);
activityDiv.style.position = 'absolute';
activityDiv.style.width = `${layoutInfo.activityBarWidth}px`;
activityDiv.style.height = `calc(100% - ${layoutInfo.titleBarHeight + layoutInfo.statusBarHeight}px)`;
activityDiv.style.top = `${layoutInfo.titleBarHeight}px`;
if (layoutInfo.sideBarSide === 'left') {
activityDiv.style.left = '0';
} else {
activityDiv.style.right = '0';
}
activityDiv.style.backgroundColor = `${colorInfo.activityBarBackground}`;
splash.appendChild(activityDiv);
if (colorInfo.activityBarBorder && layoutInfo.activityBarWidth > 0) {
const activityBorderDiv = document.createElement('div');
activityBorderDiv.setAttribute('style', `
position: absolute;
width: 1px;
height: 100%;
top: 0;
${layoutInfo.sideBarSide === 'left' ? 'right' : 'left'}: 0;
${layoutInfo.sideBarSide === 'left' ? 'border-right' : 'border-left'}: 1px solid ${colorInfo.activityBarBorder};
`);
activityBorderDiv.style.position = 'absolute';
activityBorderDiv.style.width = '1px';
activityBorderDiv.style.height = '100%';
activityBorderDiv.style.top = '0';
if (layoutInfo.sideBarSide === 'left') {
activityBorderDiv.style.right = '0';
activityBorderDiv.style.borderRight = `1px solid ${colorInfo.activityBarBorder}`;
} else {
activityBorderDiv.style.left = '0';
activityBorderDiv.style.borderLeft = `1px solid ${colorInfo.activityBarBorder}`;
}
activityDiv.appendChild(activityBorderDiv);
}
@@ -219,52 +160,56 @@
// folder or workspace -> status bar color, sidebar
if (configuration.workspace) {
const sideDiv = document.createElement('div');
sideDiv.setAttribute('style', `
position: absolute;
width: ${layoutInfo.sideBarWidth}px;
height: calc(100% - ${layoutInfo.titleBarHeight + layoutInfo.statusBarHeight}px);
top: ${layoutInfo.titleBarHeight}px;
${layoutInfo.sideBarSide}: ${layoutInfo.activityBarWidth}px;
background-color: ${colorInfo.sideBarBackground};
`);
sideDiv.style.position = 'absolute';
sideDiv.style.width = `${layoutInfo.sideBarWidth}px`;
sideDiv.style.height = `calc(100% - ${layoutInfo.titleBarHeight + layoutInfo.statusBarHeight}px)`;
sideDiv.style.top = `${layoutInfo.titleBarHeight}px`;
if (layoutInfo.sideBarSide === 'left') {
sideDiv.style.left = `${layoutInfo.activityBarWidth}px`;
} else {
sideDiv.style.right = `${layoutInfo.activityBarWidth}px`;
}
sideDiv.style.backgroundColor = `${colorInfo.sideBarBackground}`;
splash.appendChild(sideDiv);
if (colorInfo.sideBarBorder && layoutInfo.sideBarWidth > 0) {
const sideBorderDiv = document.createElement('div');
sideBorderDiv.setAttribute('style', `
position: absolute;
width: 1px;
height: 100%;
top: 0;
right: 0;
${layoutInfo.sideBarSide === 'left' ? 'right' : 'left'}: 0;
${layoutInfo.sideBarSide === 'left' ? 'border-right' : 'border-left'}: 1px solid ${colorInfo.sideBarBorder};
`);
sideBorderDiv.style.position = 'absolute';
sideBorderDiv.style.width = '1px';
sideBorderDiv.style.height = '100%';
sideBorderDiv.style.top = '0';
sideBorderDiv.style.right = '0';
if (layoutInfo.sideBarSide === 'left') {
sideBorderDiv.style.borderRight = `1px solid ${colorInfo.sideBarBorder}`;
} else {
sideBorderDiv.style.left = '0';
sideBorderDiv.style.borderLeft = `1px solid ${colorInfo.sideBarBorder}`;
}
sideDiv.appendChild(sideBorderDiv);
}
}
// part: statusbar
const statusDiv = document.createElement('div');
statusDiv.setAttribute('style', `
position: absolute;
width: 100%;
height: ${layoutInfo.statusBarHeight}px;
bottom: 0;
left: 0;
background-color: ${configuration.workspace ? colorInfo.statusBarBackground : colorInfo.statusBarNoFolderBackground};
`);
statusDiv.style.position = 'absolute';
statusDiv.style.width = '100%';
statusDiv.style.height = `${layoutInfo.statusBarHeight}px`;
statusDiv.style.bottom = '0';
statusDiv.style.left = '0';
if (configuration.workspace && colorInfo.statusBarBackground) {
statusDiv.style.backgroundColor = colorInfo.statusBarBackground;
} else if (!configuration.workspace && colorInfo.statusBarNoFolderBackground) {
statusDiv.style.backgroundColor = colorInfo.statusBarNoFolderBackground;
}
splash.appendChild(statusDiv);
if (colorInfo.statusBarBorder && layoutInfo.statusBarHeight > 0) {
const statusBorderDiv = document.createElement('div');
statusBorderDiv.setAttribute('style', `
position: absolute;
width: 100%;
height: 1px;
top: 0;
border-top: 1px solid ${colorInfo.statusBarBorder};
`);
statusBorderDiv.style.position = 'absolute';
statusBorderDiv.style.width = '100%';
statusBorderDiv.style.height = '1px';
statusBorderDiv.style.top = '0';
statusBorderDiv.style.borderTop = `1px solid ${colorInfo.statusBarBorder}`;
statusDiv.appendChild(statusBorderDiv);
}
@@ -275,4 +220,51 @@
}
//#endregion
const { result, configuration } = await bootstrapWindow.load<IDesktopMain, INativeWindowConfiguration>('vs/workbench/workbench.desktop.main',
{
configureDeveloperSettings: function (windowConfig) {
return {
// disable automated devtools opening on error when running extension tests
// as this can lead to nondeterministic test execution (devtools steals focus)
forceDisableShowDevtoolsOnError: typeof windowConfig.extensionTestsPath === 'string' || windowConfig['enable-smoke-test-driver'] === true,
// enable devtools keybindings in extension development window
forceEnableDeveloperKeybindings: Array.isArray(windowConfig.extensionDevelopmentPath) && windowConfig.extensionDevelopmentPath.length > 0,
removeDeveloperKeybindingsAfterLoad: true
};
},
beforeImport: function (windowConfig) {
// Show our splash as early as possible
showSplash(windowConfig);
// Code windows have a `vscodeWindowId` property to identify them
Object.defineProperty(window, 'vscodeWindowId', {
get: () => windowConfig.windowId
});
// It looks like browsers only lazily enable
// the <canvas> element when needed. Since we
// leverage canvas elements in our code in many
// locations, we try to help the browser to
// initialize canvas when it is idle, right
// before we wait for the scripts to be loaded.
window.requestIdleCallback(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context?.clearRect(0, 0, canvas.width, canvas.height);
canvas.remove();
}, { timeout: 50 });
// Track import() perf
performance.mark('code/willLoadWorkbenchMain');
}
}
);
// Mark start of workbench
performance.mark('code/didLoadWorkbenchMain');
// Load workbench
result.main(configuration);
}());
@@ -10,7 +10,6 @@ import { ViewPart } from '../../view/viewPart.js';
export abstract class AbstractEditContext extends ViewPart {
abstract domNode: FastDomNode<HTMLElement>;
abstract appendTo(overflowGuardContainer: FastDomNode<HTMLElement>): void;
abstract focus(): void;
abstract isFocused(): boolean;
abstract refreshFocusState(): void;
@@ -15,12 +15,21 @@
.monaco-editor .edit-context-composition-none {
background-color: transparent;
border-bottom: none;
}
.monaco-editor .edit-context-composition-secondary {
background-color: var(--vscode-editor-selectionBackground);
.monaco-editor :not(.hc-black, .hc-light) .edit-context-composition-secondary {
border-bottom: 1px solid var(--vscode-editor-compositionBorder);
}
.monaco-editor .edit-context-composition-primary {
background-color: var(--vscode-editor-selectionHighlightBackground);
.monaco-editor :not(.hc-black, .hc-light) .edit-context-composition-primary {
border-bottom: 2px solid var(--vscode-editor-compositionBorder);
}
.monaco-editor :is(.hc-black, .hc-light) .edit-context-composition-secondary {
border: 1px solid var(--vscode-editor-compositionBorder);
}
.monaco-editor :is(.hc-black, .hc-light) .edit-context-composition-primary {
border: 2px solid var(--vscode-editor-compositionBorder);
}
@@ -18,7 +18,7 @@ import { ViewContext } from '../../../../common/viewModel/viewContext.js';
import { RestrictedRenderingContext, RenderingContext } from '../../../view/renderingContext.js';
import { ViewController } from '../../../view/viewController.js';
import { ClipboardStoredMetadata, getDataToCopy, InMemoryClipboardMetadataManager } from '../clipboardUtils.js';
import { AbstractEditContext } from '../editContextUtils.js';
import { AbstractEditContext } from '../editContext.js';
import { editContextAddDisposableListener, FocusTracker, ITypeData } from './nativeEditContextUtils.js';
import { ScreenReaderSupport } from './screenReaderSupport.js';
import { Range } from '../../../../common/core/range.js';
@@ -51,6 +51,7 @@ export class NativeEditContext extends AbstractEditContext {
constructor(
context: ViewContext,
overflowGuardContainer: FastDomNode<HTMLElement>,
viewController: ViewController,
private readonly _visibleRangeProvider: IVisibleRangeProvider,
@IInstantiationService instantiationService: IInstantiationService,
@@ -62,6 +63,9 @@ export class NativeEditContext extends AbstractEditContext {
this.domNode.setClassName(`native-edit-context`);
this._updateDomAttributes();
overflowGuardContainer.appendChild(this.domNode);
this._parent = overflowGuardContainer.domNode;
this._focusTracker = this._register(new FocusTracker(this.domNode.domNode, (newFocusValue: boolean) => this._context.viewModel.setHasFocus(newFocusValue)));
this._editContext = new EditContext();
@@ -123,11 +127,6 @@ export class NativeEditContext extends AbstractEditContext {
super.dispose();
}
public appendTo(overflowGuardContainer: FastDomNode<HTMLElement>): void {
overflowGuardContainer.appendChild(this.domNode);
this._parent = overflowGuardContainer.domNode;
}
public setAriaOptions(): void {
this._screenReaderSupport.setAriaOptions();
}
@@ -34,7 +34,7 @@ import { Color } from '../../../../../base/common/color.js';
import { IME } from '../../../../../base/common/ime.js';
import { IKeybindingService } from '../../../../../platform/keybinding/common/keybinding.js';
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { AbstractEditContext } from '../editContextUtils.js';
import { AbstractEditContext } from '../editContext.js';
import { ICompositionData, IPasteData, ITextAreaInputHost, TextAreaInput, TextAreaWrapper } from './textAreaEditContextInput.js';
import { ariaLabelForScreenReaderContent, ISimpleModel, newlinecount, PagedScreenReaderStrategy } from '../screenReaderUtils.js';
import { ClipboardDataToCopy, getDataToCopy } from '../clipboardUtils.js';
@@ -148,6 +148,7 @@ export class TextAreaEditContext extends AbstractEditContext {
constructor(
context: ViewContext,
overflowGuardContainer: FastDomNode<HTMLElement>,
viewController: ViewController,
visibleRangeProvider: IVisibleRangeProvider,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@@ -201,6 +202,9 @@ export class TextAreaEditContext extends AbstractEditContext {
this.textAreaCover = createFastDomNode(document.createElement('div'));
this.textAreaCover.setPosition('absolute');
overflowGuardContainer.appendChild(this.textArea);
overflowGuardContainer.appendChild(this.textAreaCover);
const simpleModel: ISimpleModel = {
getLineCount: (): number => {
return this._context.viewModel.getLineCount();
@@ -466,11 +470,6 @@ export class TextAreaEditContext extends AbstractEditContext {
return this.textArea;
}
appendTo(overflowGuardContainer: FastDomNode<HTMLElement>): void {
overflowGuardContainer.appendChild(this.textArea);
overflowGuardContainer.appendChild(this.textAreaCover);
}
public writeScreenReaderContent(reason: string): void {
this._textAreaInput.writeNativeTextAreaContent(reason);
}
+6 -8
View File
@@ -57,7 +57,7 @@ import { IInstantiationService } from '../../platform/instantiation/common/insta
import { IColorTheme, getThemeTypeSelector } from '../../platform/theme/common/themeService.js';
import { ViewGpuContext } from './gpu/viewGpuContext.js';
import { ViewLinesGpu } from './viewParts/viewLinesGpu/viewLinesGpu.js';
import { AbstractEditContext } from './controller/editContext/editContextUtils.js';
import { AbstractEditContext } from './controller/editContext/editContext.js';
import { IVisibleRangeProvider, TextAreaEditContext } from './controller/editContext/textArea/textAreaEditContext.js';
import { NativeEditContext } from './controller/editContext/native/nativeEditContext.js';
import { RulersGpu } from './viewParts/rulersGpu/rulersGpu.js';
@@ -124,6 +124,10 @@ export class View extends ViewEventHandler {
this._selections = [new Selection(1, 1, 1, 1)];
this._renderAnimationFrame = null;
this._overflowGuardContainer = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this._overflowGuardContainer, PartFingerprint.OverflowGuard);
this._overflowGuardContainer.setClassName('overflow-guard');
this._viewController = new ViewController(configuration, model, userInputEvents, commandDelegate);
// The view context is passed on to most classes (basically to reduce param. counts in ctors)
@@ -154,10 +158,6 @@ export class View extends ViewEventHandler {
this._viewGpuContext = this._instantiationService.createInstance(ViewGpuContext, this._context);
}
this._overflowGuardContainer = createFastDomNode(document.createElement('div'));
PartFingerprints.write(this._overflowGuardContainer, PartFingerprint.OverflowGuard);
this._overflowGuardContainer.setClassName('overflow-guard');
this._scrollbar = new EditorScrollbar(this._context, this._linesContent, this.domNode, this._overflowGuardContainer);
this._viewParts.push(this._scrollbar);
@@ -247,7 +247,6 @@ export class View extends ViewEventHandler {
this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas);
}
this._overflowGuardContainer.appendChild(scrollDecoration.getDomNode());
this._editContext.appendTo(this._overflowGuardContainer);
this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode());
this._overflowGuardContainer.appendChild(minimap.getDomNode());
this._overflowGuardContainer.appendChild(blockOutline.domNode);
@@ -268,7 +267,7 @@ export class View extends ViewEventHandler {
}
private _instantiateEditContext(experimentalEditContextEnabled: boolean): AbstractEditContext {
return this._instantiationService.createInstance(experimentalEditContextEnabled ? NativeEditContext : TextAreaEditContext, this._context, this._viewController, this._createTextAreaHandlerHelper());
return this._instantiationService.createInstance(experimentalEditContextEnabled ? NativeEditContext : TextAreaEditContext, this._context, this._overflowGuardContainer, this._viewController, this._createTextAreaHandlerHelper());
}
private _updateEditContext(): void {
@@ -279,7 +278,6 @@ export class View extends ViewEventHandler {
this._experimentalEditContextEnabled = experimentalEditContextEnabled;
this._editContext.dispose();
this._editContext = this._instantiateEditContext(experimentalEditContextEnabled);
this._editContext.appendTo(this._overflowGuardContainer);
// Replace the view parts with the new edit context
const indexOfEditContextHandler = this._viewParts.indexOf(this._editContext);
if (indexOfEditContextHandler !== -1) {
@@ -61,9 +61,10 @@
(function_declaration
name: (identifier) @entity.name.function)
(method_definition
name: (property_identifier) @meta.definition.method @entity.name.function)
name: (property_identifier) @meta.definition.method @entity.name.function
(#not-eq? @entity.name.function "constructor"))
(method_definition
name: (property_identifier) @storage.type
name: (property_identifier) @meta.definition.method @storage.type
(#eq? @storage.type "constructor"))
(method_signature
name: (property_identifier) @meta.definition.method @entity.name.function)
@@ -109,10 +110,6 @@
(predefined_type (["string" "boolean" "number" "any"])) @support.type.primitive
(type_identifier) @entity.name.type
(("const")
(variable_declarator
name: (identifier) @variable.other.constant))
([
(identifier)
(shorthand_property_identifier)
@@ -192,7 +189,6 @@
"<<="
"=="
"!="
"=>"
">>"
">>="
">>>"
@@ -1077,7 +1077,7 @@ class StandaloneContextMenuService extends ContextMenuService {
}
export const standaloneEditorWorkerDescriptor: IWorkerDescriptor = {
amdModuleId: 'vs/editor/common/services/editorSimpleWorker',
moduleId: 'vs/editor/common/services/editorSimpleWorker',
esmModuleLocation: undefined,
label: 'editorWorkerService'
};
@@ -71,7 +71,7 @@ class MonacoWebWorkerImpl<T extends object> extends EditorWorkerClient implement
constructor(modelService: IModelService, opts: IWebWorkerOptions) {
const workerDescriptor: IWorkerDescriptor = {
amdModuleId: standaloneEditorWorkerDescriptor.amdModuleId,
moduleId: standaloneEditorWorkerDescriptor.moduleId,
esmModuleLocation: standaloneEditorWorkerDescriptor.esmModuleLocation,
label: opts.label,
};
@@ -134,6 +134,10 @@ export const editorSelectionHighlightBorder = registerColor('editor.selectionHig
{ light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder },
nls.localize('editorSelectionHighlightBorder', "Border color for regions with the same content as the selection."));
export const editorCompositionBorder = registerColor('editor.compositionBorder',
{ light: '#000000', dark: '#ffffff', hcLight: '#000000', hcDark: '#ffffff' },
nls.localize('editorCompositionBorder', "The border color for an IME composition."));
// ----- editor find
@@ -254,29 +254,34 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
}
private async applyManualSync(manifest: IUserDataManifest | null, executionId: string, token: CancellationToken): Promise<void> {
const profileSynchronizers = this.getActiveProfileSynchronizers();
for (const profileSynchronizer of profileSynchronizers) {
if (token.isCancellationRequested) {
try {
this.setStatus(SyncStatus.Syncing);
const profileSynchronizers = this.getActiveProfileSynchronizers();
for (const profileSynchronizer of profileSynchronizers) {
if (token.isCancellationRequested) {
return;
}
await profileSynchronizer.apply(executionId, token);
}
const defaultProfileSynchronizer = profileSynchronizers.find(s => s.profile.isDefault);
if (!defaultProfileSynchronizer) {
return;
}
await profileSynchronizer.apply(executionId, token);
}
const defaultProfileSynchronizer = profileSynchronizers.find(s => s.profile.isDefault);
if (!defaultProfileSynchronizer) {
return;
}
const userDataProfileManifestSynchronizer = defaultProfileSynchronizer.enabled.find(s => s.resource === SyncResource.Profiles);
if (!userDataProfileManifestSynchronizer) {
return;
}
const userDataProfileManifestSynchronizer = defaultProfileSynchronizer.enabled.find(s => s.resource === SyncResource.Profiles);
if (!userDataProfileManifestSynchronizer) {
return;
}
// Sync remote profiles which are not synced locally
const remoteProfiles = (await (userDataProfileManifestSynchronizer as UserDataProfilesManifestSynchroniser).getRemoteSyncedProfiles(manifest?.latest ?? null)) || [];
const remoteProfilesToSync = remoteProfiles.filter(remoteProfile => profileSynchronizers.every(s => s.profile.id !== remoteProfile.id));
if (remoteProfilesToSync.length) {
await this.syncRemoteProfiles(remoteProfilesToSync, manifest, false, executionId, token);
// Sync remote profiles which are not synced locally
const remoteProfiles = (await (userDataProfileManifestSynchronizer as UserDataProfilesManifestSynchroniser).getRemoteSyncedProfiles(manifest?.latest ?? null)) || [];
const remoteProfilesToSync = remoteProfiles.filter(remoteProfile => profileSynchronizers.every(s => s.profile.id !== remoteProfile.id));
if (remoteProfilesToSync.length) {
await this.syncRemoteProfiles(remoteProfilesToSync, manifest, false, executionId, token);
}
} finally {
this.setStatus(SyncStatus.Idle);
}
}
@@ -73,16 +73,19 @@ export interface ILoadOptions<T extends ISandboxConfiguration = ISandboxConfigur
disallowReloadKeybinding?: boolean;
removeDeveloperKeybindingsAfterLoad?: boolean;
};
canModifyDOM?: (config: T) => void;
beforeImport?: (config: T) => void;
}
export interface ILoadResult<M, T> {
readonly result: M;
readonly configuration: T;
}
export interface IBootstrapWindow {
load<T extends ISandboxConfiguration = ISandboxConfiguration>(
load<M, T extends ISandboxConfiguration = ISandboxConfiguration>(
esModule: string,
resultCallback: (result: any, configuration: T) => Promise<unknown> | undefined,
options: ILoadOptions<T>
): Promise<void>;
): Promise<ILoadResult<M, T>>;
}
//#endregion
@@ -287,9 +287,6 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
private readonly _actionButton = observableValue<ISCMActionButtonDescriptor | undefined>(this, undefined);
get actionButton(): IObservable<ISCMActionButtonDescriptor | undefined> { return this._actionButton; }
private readonly _onDidChange = new Emitter<void>();
readonly onDidChange: Event<void> = this._onDidChange.event;
private _quickDiff: IDisposable | undefined;
public readonly isSCM: boolean = true;
@@ -319,7 +316,6 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
$updateSourceControl(features: SCMProviderFeatures): void {
this.features = { ...this.features, ...features };
this._onDidChange.fire();
if (typeof features.commitTemplate !== 'undefined') {
this._commitTemplate.set(features.commitTemplate, undefined);
+38 -10
View File
@@ -1007,26 +1007,54 @@ export class ExtHostSCM implements ExtHostSCMShape {
}
async $resolveHistoryItemRefsCommonAncestor(sourceControlHandle: number, historyItemRefs: string[], token: CancellationToken): Promise<string | undefined> {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
return await historyProvider?.resolveHistoryItemRefsCommonAncestor(historyItemRefs, token) ?? undefined;
try {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const ancestor = await historyProvider?.resolveHistoryItemRefsCommonAncestor(historyItemRefs, token);
return ancestor ?? undefined;
}
catch (err) {
this.logService.error('ExtHostSCM#$resolveHistoryItemRefsCommonAncestor', err);
return undefined;
}
}
async $provideHistoryItemRefs(sourceControlHandle: number, historyItemRefs: string[] | undefined, token: CancellationToken): Promise<SCMHistoryItemRefDto[] | undefined> {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const refs = await historyProvider?.provideHistoryItemRefs(historyItemRefs, token);
try {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const refs = await historyProvider?.provideHistoryItemRefs(historyItemRefs, token);
return refs?.map(ref => ({ ...ref, icon: getHistoryItemIconDto(ref.icon) })) ?? undefined;
return refs?.map(ref => ({ ...ref, icon: getHistoryItemIconDto(ref.icon) })) ?? undefined;
}
catch (err) {
this.logService.error('ExtHostSCM#$provideHistoryItemRefs', err);
return undefined;
}
}
async $provideHistoryItems(sourceControlHandle: number, options: any, token: CancellationToken): Promise<SCMHistoryItemDto[] | undefined> {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const historyItems = await historyProvider?.provideHistoryItems(options, token);
try {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const historyItems = await historyProvider?.provideHistoryItems(options, token);
return historyItems?.map(item => toSCMHistoryItemDto(item)) ?? undefined;
return historyItems?.map(item => toSCMHistoryItemDto(item)) ?? undefined;
}
catch (err) {
this.logService.error('ExtHostSCM#$provideHistoryItems', err);
return undefined;
}
}
async $provideHistoryItemChanges(sourceControlHandle: number, historyItemId: string, historyItemParentId: string | undefined, token: CancellationToken): Promise<SCMHistoryItemChangeDto[] | undefined> {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
return await historyProvider?.provideHistoryItemChanges(historyItemId, historyItemParentId, token) ?? undefined;
try {
const historyProvider = this._sourceControls.get(sourceControlHandle)?.historyProvider;
const changes = await historyProvider?.provideHistoryItemChanges(historyItemId, historyItemParentId, token);
return changes ?? undefined;
}
catch (err) {
this.logService.error('ExtHostSCM#$provideHistoryItemChanges', err);
return undefined;
}
}
}
@@ -5,14 +5,15 @@
/* eslint-disable no-restricted-globals */
(function () {
(async function () {
type IBootstrapWindow = import('vs/platform/window/electron-sandbox/window.js').IBootstrapWindow;
type IIssueReporterMain = import('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain').IIssueReporterMain;
type OldIssueReporterWindowConfiguration = import('vs/platform/issue/common/issue.js').OldIssueReporterWindowConfiguration;
const bootstrapWindow: IBootstrapWindow = (window as any).MonacoBootstrapWindow; // defined by bootstrap-window.ts
bootstrapWindow.load('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain', function (issueReporter, configuration) {
return issueReporter.startup(configuration);
}, {
const { result, configuration } = await bootstrapWindow.load<IIssueReporterMain, OldIssueReporterWindowConfiguration>('vs/workbench/contrib/issue/electron-sandbox/issueReporterMain', {
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true,
@@ -20,4 +21,6 @@
};
}
});
result.startup(configuration);
}());
@@ -21,8 +21,11 @@ import BaseHtml from '../browser/issueReporterPage.js';
import { IProcessMainService, IIssueMainService, OldIssueReporterWindowConfiguration } from '../../../../platform/issue/common/issue.js';
import { IssueReporter } from './issueReporterService.js';
export interface IIssueReporterMain {
startup(configuration: OldIssueReporterWindowConfiguration): void;
}
export function startup(configuration: OldIssueReporterWindowConfiguration) {
export function startup(configuration: OldIssueReporterWindowConfiguration): void {
const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
mainWindow.document.body.classList.add(platformClass); // used by our fonts
@@ -20,6 +20,8 @@ import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js'
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
import { IProductService } from '../../../../platform/product/common/productService.js';
import { IUserDataSyncEnablementService, IUserDataSyncService, SyncStatus } from '../../../../platform/userDataSync/common/userDataSync.js';
import { IUserDataSyncWorkbenchService } from '../../../services/userDataSync/common/userDataSync.js';
interface IConfiguration extends IWindowsConfiguration {
update?: { mode?: string };
@@ -65,21 +67,37 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
constructor(
@IHostService private readonly hostService: IHostService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService,
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
@IUserDataSyncWorkbenchService userDataSyncWorkbenchService: IUserDataSyncWorkbenchService,
@IProductService private readonly productService: IProductService,
@IDialogService private readonly dialogService: IDialogService
) {
super();
this.onConfigurationChange(undefined);
this.update(false);
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(e)));
this._register(userDataSyncWorkbenchService.onDidTurnOnSync(e => this.update(true)));
}
private onConfigurationChange(e: IConfigurationChangeEvent | undefined): void {
private onConfigurationChange(e: IConfigurationChangeEvent): void {
if (e && !SettingsChangeRelauncher.SETTINGS.some(key => e.affectsConfiguration(key))) {
return;
}
// Skip if turning on sync is in progress
if (this.isTurningOnSyncInProgress()) {
return;
}
this.update(e.source !== ConfigurationTarget.DEFAULT /* do not ask to relaunch if defaults changed */);
}
private isTurningOnSyncInProgress(): boolean {
return !this.userDataSyncEnablementService.isEnabled() && this.userDataSyncService.status === SyncStatus.Syncing;
}
private update(askToRelaunch: boolean): void {
let changed = false;
function processChanged(didChange: boolean) {
@@ -131,9 +149,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
// Profiles
processChanged(this.productService.quality !== 'stable' && this.enablePPEExtensionsGallery.handleChange(config._extensionsGallery?.enablePPE));
// Notify only when changed from an event and the change
// was not triggerd programmatically (e.g. from experiments)
if (changed && e && e.source !== ConfigurationTarget.DEFAULT) {
if (askToRelaunch && changed && this.hostService.hasFocus) {
this.doConfirm(
isNative ?
localize('relaunchSettingMessage', "A setting has changed that requires a restart to take effect.") :
@@ -150,11 +166,9 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
}
private async doConfirm(message: string, detail: string, primaryButton: string, confirmedFn: () => void): Promise<void> {
if (this.hostService.hasFocus) {
const { confirmed } = await this.dialogService.confirm({ message, detail, primaryButton });
if (confirmed) {
confirmedFn();
}
const { confirmed } = await this.dialogService.confirm({ message, detail, primaryButton });
if (confirmed) {
confirmedFn();
}
}
}
@@ -1289,8 +1289,7 @@ export class DirtyDiffModel extends Disposable {
this.repositoryDisposables.add(disposables);
disposables.add(toDisposable(() => this.repositoryDisposables.delete(disposables)));
const onDidChange = Event.any(repository.provider.onDidChange, repository.provider.onDidChangeResources);
disposables.add(onDidChange(this.triggerDiff, this));
disposables.add(repository.provider.onDidChangeResources(this.triggerDiff, this));
const onDidRemoveThis = Event.filter(this.scmService.onDidRemoveRepository, r => r === repository);
disposables.add(onDidRemoveThis(() => dispose(disposables), null));
@@ -80,7 +80,6 @@ export interface ISCMProvider extends IDisposable {
readonly acceptInputCommand?: Command;
readonly actionButton: IObservable<ISCMActionButtonDescriptor | undefined>;
readonly statusBarCommands: IObservable<readonly Command[] | undefined>;
readonly onDidChange: Event<void>;
getOriginalResource(uri: URI): Promise<URI | null>;
}
@@ -751,17 +751,14 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
const disableShellIntegrationReporting = (this.shellLaunchConfig.executable === undefined || this.shellType === undefined) || !shellIntegrationSupportedShellTypes.includes(this.shellType);
const xterm = this._scopedInstantiationService.createInstance(
XtermTerminal,
Terminal,
this._cols,
this._rows,
undefined,
this._scopedInstantiationService.createInstance(TerminalInstanceColorProvider, this._targetRef),
this.capabilities,
this._processManager.shellIntegrationNonce,
disableShellIntegrationReporting
);
const xterm = this._scopedInstantiationService.createInstance(XtermTerminal, Terminal, {
cols: this._cols,
rows: this._rows,
xtermColorProvider: this._scopedInstantiationService.createInstance(TerminalInstanceColorProvider, this._targetRef),
capabilities: this.capabilities,
shellIntegrationNonce: this._processManager.shellIntegrationNonce,
disableShellIntegrationReporting,
});
this.xterm = xterm;
this._resizeDebouncer = this._register(new TerminalResizeDebouncer(
() => this._isVisible,
@@ -1023,17 +1023,12 @@ export class TerminalService extends Disposable implements ITerminalService {
async createDetachedTerminal(options: IDetachedXTermOptions): Promise<IDetachedTerminalInstance> {
const ctor = await TerminalInstance.getXtermConstructor(this._keybindingService, this._contextKeyService);
const xterm = this._instantiationService.createInstance(
XtermTerminal,
ctor,
options.cols,
options.rows,
undefined,
options.colorProvider,
options.capabilities || new TerminalCapabilityStore(),
'',
false,
);
const xterm = this._instantiationService.createInstance(XtermTerminal, ctor, {
cols: options.cols,
rows: options.rows,
xtermColorProvider: options.colorProvider,
capabilities: options.capabilities || new TerminalCapabilityStore(),
});
if (options.readonly) {
xterm.raw.attachCustomKeyEventHandler(() => false);
@@ -63,39 +63,22 @@ function getFullBufferLineAsString(lineIndex: number, buffer: IBuffer): { lineDa
return { lineData, lineIndex };
}
// DEBUG: This helper can be used to draw image data to the console, it's commented out as we don't
// want to ship it, but this is very useful for investigating texture atlas issues.
// (console as any).image = (source: ImageData | HTMLCanvasElement, scale: number = 1) => {
// function getBox(width: number, height: number) {
// return {
// string: '+',
// style: 'font-size: 1px; padding: ' + Math.floor(height/2) + 'px ' + Math.floor(width/2) + 'px; line-height: ' + height + 'px;'
// };
// }
// if (source instanceof HTMLCanvasElement) {
// source = source.getContext('2d')?.getImageData(0, 0, source.width, source.height)!;
// }
// const canvas = document.createElement('canvas');
// canvas.width = source.width;
// canvas.height = source.height;
// const ctx = canvas.getContext('2d')!;
// ctx.putImageData(source, 0, 0);
// const sw = source.width * scale;
// const sh = source.height * scale;
// const dim = getBox(sw, sh);
// console.log(
// `Image: ${source.width} x ${source.height}\n%c${dim.string}`,
// `${dim.style}background: url(${canvas.toDataURL()}); background-size: ${sw}px ${sh}px; background-repeat: no-repeat; color: transparent;`
// );
// console.groupCollapsed('Zoomed');
// console.log(
// `%c${dim.string}`,
// `${getBox(sw * 10, sh * 10).style}background: url(${canvas.toDataURL()}); background-size: ${sw * 10}px ${sh * 10}px; background-repeat: no-repeat; color: transparent; image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor;`
// );
// console.groupEnd();
// };
export interface IXtermTerminalOptions {
/** The columns to initialize the terminal with. */
cols: number;
/** The rows to initialize the terminal with. */
rows: number;
/** The color provider for the terminal. */
xtermColorProvider: IXtermColorProvider;
/** The capabilities of the terminal. */
capabilities: ITerminalCapabilityStore;
/** The shell integration nonce to verify data coming from SI is trustworthy. */
shellIntegrationNonce?: string;
/** Whether to disable shell integration telemetry reporting. */
disableShellIntegrationReporting?: boolean;
/** The object that imports xterm addons, set this to inject an importer in tests. */
xtermAddonImpoter?: XtermAddonImporter;
}
/**
* Wraps the xterm object with additional functionality. Interaction with the backing process is out
@@ -105,6 +88,10 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
/** The raw xterm.js instance */
readonly raw: RawXtermTerminal;
private _core: IXtermCore;
private readonly _xtermAddonLoader: XtermAddonImporter;
private readonly _xtermColorProvider: IXtermColorProvider;
private readonly _capabilities: ITerminalCapabilityStore;
private static _suggestedRendererType: 'dom' | undefined = undefined;
private static _checkedWebglCompatible = false;
private _attached?: { container: HTMLElement; options: IXtermAttachToElementOptions };
@@ -172,13 +159,7 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
*/
constructor(
xtermCtor: typeof RawXtermTerminal,
cols: number,
rows: number,
private readonly _xtermAddonLoader: XtermAddonImporter = new XtermAddonImporter(),
private readonly _xtermColorProvider: IXtermColorProvider,
private readonly _capabilities: ITerminalCapabilityStore,
shellIntegrationNonce: string,
disableShellIntegrationReporting: boolean,
options: IXtermTerminalOptions,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@ITerminalLogService private readonly _logService: ITerminalLogService,
@@ -192,14 +173,19 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
@ILayoutService layoutService: ILayoutService
) {
super();
this._xtermAddonLoader = options.xtermAddonImpoter ?? new XtermAddonImporter();
this._xtermColorProvider = options.xtermColorProvider;
this._capabilities = options.capabilities;
const font = this._terminalConfigurationService.getFont(dom.getActiveWindow(), undefined, true);
const config = this._terminalConfigurationService.config;
const editorOptions = this._configurationService.getValue<IEditorOptions>('editor');
this.raw = this._register(new xtermCtor({
allowProposedApi: true,
cols,
rows,
cols: options.cols,
rows: options.rows,
documentOverride: layoutService.mainContainer.ownerDocument,
altClickMovesCursor: config.altClickMovesCursor && editorOptions.multiCursorModifier === 'alt',
scrollback: config.scrollback,
@@ -269,12 +255,12 @@ export class XtermTerminal extends Disposable implements IXtermTerminal, IDetach
// Load addons
this._updateUnicodeVersion();
this._markNavigationAddon = this._instantiationService.createInstance(MarkNavigationAddon, _capabilities);
this._markNavigationAddon = this._instantiationService.createInstance(MarkNavigationAddon, options.capabilities);
this.raw.loadAddon(this._markNavigationAddon);
this._decorationAddon = this._instantiationService.createInstance(DecorationAddon, this._capabilities);
this._register(this._decorationAddon.onDidRequestRunCommand(e => this._onDidRequestRunCommand.fire(e)));
this.raw.loadAddon(this._decorationAddon);
this._shellIntegrationAddon = new ShellIntegrationAddon(shellIntegrationNonce, disableShellIntegrationReporting, this._telemetryService, this._logService);
this._shellIntegrationAddon = new ShellIntegrationAddon(options.shellIntegrationNonce ?? '', options.disableShellIntegrationReporting, this._telemetryService, this._logService);
this.raw.loadAddon(this._shellIntegrationAddon);
this._xtermAddonLoader.importAddon('clipboard').then(ClipboardAddon => {
this._clipboardAddon = this._instantiationService.createInstance(ClipboardAddon, undefined, {
@@ -114,7 +114,14 @@ suite('XtermTerminal', () => {
XTermBaseCtor = (await importAMDNodeModule<typeof import('@xterm/xterm')>('@xterm/xterm', 'lib/xterm.js')).Terminal;
const capabilityStore = store.add(new TerminalCapabilityStore());
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, 80, 30, new TestXtermAddonImporter(), { getBackgroundColor: () => undefined }, capabilityStore, '', true));
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, {
cols: 80,
rows: 30,
xtermColorProvider: { getBackgroundColor: () => undefined },
capabilities: capabilityStore,
disableShellIntegrationReporting: true,
xtermAddonImpoter: new TestXtermAddonImporter(),
}));
TestWebglAddon.shouldThrow = false;
TestWebglAddon.isEnabled = false;
@@ -131,7 +138,14 @@ suite('XtermTerminal', () => {
[PANEL_BACKGROUND]: '#ff0000',
[SIDE_BAR_BACKGROUND]: '#00ff00'
}));
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, 80, 30, new TestXtermAddonImporter(), { getBackgroundColor: () => new Color(new RGBA(255, 0, 0)) }, store.add(new TerminalCapabilityStore()), '', true));
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, {
cols: 80,
rows: 30,
xtermAddonImpoter: new TestXtermAddonImporter(),
xtermColorProvider: { getBackgroundColor: () => new Color(new RGBA(255, 0, 0)) },
capabilities: store.add(new TerminalCapabilityStore()),
disableShellIntegrationReporting: true,
}));
strictEqual(xterm.raw.options.theme?.background, '#ff0000');
});
test('should react to and apply theme changes', () => {
@@ -160,7 +174,14 @@ suite('XtermTerminal', () => {
'terminal.ansiBrightCyan': '#150000',
'terminal.ansiBrightWhite': '#160000',
}));
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, 80, 30, new TestXtermAddonImporter(), { getBackgroundColor: () => undefined }, store.add(new TerminalCapabilityStore()), '', true));
xterm = store.add(instantiationService.createInstance(XtermTerminal, XTermBaseCtor, {
cols: 80,
rows: 30,
xtermAddonImpoter: new TestXtermAddonImporter(),
xtermColorProvider: { getBackgroundColor: () => undefined },
capabilities: store.add(new TerminalCapabilityStore()),
disableShellIntegrationReporting: true
}));
deepStrictEqual(xterm.raw.options.theme, {
background: undefined,
foreground: '#000200',
@@ -79,7 +79,13 @@ suite('Buffer Content Tracker', () => {
capabilities.add(TerminalCapability.NaiveCwdDetection, null!);
}
const TerminalCtor = (await importAMDNodeModule<typeof import('@xterm/xterm')>('@xterm/xterm', 'lib/xterm.js')).Terminal;
xterm = store.add(instantiationService.createInstance(XtermTerminal, TerminalCtor, 80, 30, undefined, { getBackgroundColor: () => undefined }, capabilities, '', true));
xterm = store.add(instantiationService.createInstance(XtermTerminal, TerminalCtor, {
cols: 80,
rows: 30,
xtermColorProvider: { getBackgroundColor: () => undefined },
capabilities,
disableShellIntegrationReporting: true
}));
const container = document.createElement('div');
xterm.raw.open(container);
configurationService = new TestConfigurationService({ terminal: { integrated: { tabs: { separator: ' - ', title: '${cwd}', description: '${cwd}' } } } });
@@ -397,6 +397,10 @@ export class DesktopMain extends Disposable {
}
}
export interface IDesktopMain {
main(configuration: INativeWindowConfiguration): Promise<void>;
}
export function main(configuration: INativeWindowConfiguration): Promise<void> {
const workbench = new DesktopMain(configuration);
@@ -186,7 +186,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
iframe.contentWindow!.postMessage({
type: event.data.type,
data: {
workerUrl: FileAccess.asBrowserUri('vs/workbench/api/worker/extensionHostWorker.esm.js').toString(true),
workerUrl: FileAccess.asBrowserUri('vs/workbench/api/worker/extensionHostWorkerMain.js').toString(true),
fileRoot: globalThis._VSCODE_FILE_ROOT,
nls: {
messages: getNLSMessages(),
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
child-src 'self' data: blob:;
script-src 'self' 'unsafe-eval' 'sha256-p4xRHmWlJbvrRA1GaJNOE1piFno4zCQWj+53Qkt8PF8=' https: http://localhost:* blob:;
script-src 'self' 'unsafe-eval' 'sha256-xM2KVDKIoeb8vVxk4ezEUsxdTZh5wFnKO3YmFhy9tkk=' https: http://localhost:* blob:;
connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
</head>
<body>
@@ -78,7 +78,7 @@
return;
}
const { data } = event.data;
createWorker(data.baseUrl, data.workerUrl, data.fileRoot, data.nls.messages, data.nls.language);
createWorker(data.workerUrl, data.fileRoot, data.nls.messages, data.nls.language);
};
window.parent.postMessage({
@@ -87,7 +87,7 @@
}, '*');
}
function createWorker(baseUrl, workerUrl, fileRoot, nlsMessages, nlsLanguage) {
function createWorker(workerUrl, fileRoot, nlsMessages, nlsLanguage) {
try {
if (globalThis.crossOriginIsolated) {
workerUrl += '?vscode-coi=2'; // COEP
@@ -99,7 +99,6 @@
const blob = new Blob([[
`/*extensionHostWorker*/`,
`globalThis.MonacoEnvironment = { baseUrl: ${JSON.stringify(baseUrl)} };`,
`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(nlsMessages)};`,
`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(nlsLanguage)};`,
`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(fileRoot)};`,
@@ -26,7 +26,6 @@ import { ThemeConfiguration } from './themeConfiguration.js';
import { ColorScheme } from '../../../../platform/theme/common/theme.js';
import { ColorId, FontStyle, MetadataConsts } from '../../../../editor/common/encodedTokenAttributes.js';
import { toStandardTokenType } from '../../../../editor/common/languages/supports/tokenization.js';
import { findMatchingThemeRule } from '../../textMate/common/TMHelper.js';
const colorRegistry = Registry.as<IColorRegistry>(ColorRegistryExtensions.ColorContribution);
@@ -817,34 +816,25 @@ const defaultThemeColors: { [baseTheme: string]: ITextMateThemingRule[] } = {
const noMatch = (_scope: ProbeScope) => -1;
function nameMatcher(identifers: string[], scope: ProbeScope): number {
function findInIdents(s: string, lastIndent: number): number {
for (let i = lastIndent - 1; i >= 0; i--) {
if (scopesAreMatching(s, identifers[i])) {
return i;
}
}
function nameMatcher(identifiers: string[], scopes: ProbeScope): number {
if (scopes.length < identifiers.length) {
return -1;
}
if (scope.length < identifers.length) {
return -1;
}
let lastScopeIndex = scope.length - 1;
let lastIdentifierIndex = findInIdents(scope[lastScopeIndex--], identifers.length);
if (lastIdentifierIndex >= 0) {
const score = (lastIdentifierIndex + 1) * 0x10000 + identifers[lastIdentifierIndex].length;
while (lastScopeIndex >= 0) {
lastIdentifierIndex = findInIdents(scope[lastScopeIndex--], lastIdentifierIndex);
if (lastIdentifierIndex === -1) {
return -1;
let lastIndex = 0;
let score: number | undefined = undefined;
const every = identifiers.every((identifier, identifierIndex) => {
for (let i = lastIndex; i < scopes.length; i++) {
if (scopesAreMatching(scopes[i], identifier)) {
score = (identifierIndex + 1) * 0x10000 + identifier.length;
lastIndex = i + 1;
return true;
}
}
return score;
}
return -1;
return false;
});
return every && score !== undefined ? score : -1;
}
function scopesAreMatching(thisScopeName: string, scopeName: string): boolean {
if (!thisScopeName) {
return false;
@@ -906,18 +896,15 @@ export function findMetadata(colorThemeData: ColorThemeData, captureNames: strin
metadata |= (languageId << MetadataConsts.LANGUAGEID_OFFSET);
const themeRule = findMatchingThemeRule(colorThemeData, captureNames);
let tokenStyle: TokenStyle | undefined;
if (!themeRule) {
tokenStyle = colorThemeData.resolveScopes(captureNames.map(name => [name]).reverse());
}
const definitions: TextMateThemingRuleDefinitions = {};
const tokenStyle = colorThemeData.resolveScopes([captureNames], definitions);
if (captureNames.length > 0) {
const standardToken = toStandardTokenType(captureNames[captureNames.length - 1]);
metadata |= (standardToken << MetadataConsts.TOKEN_TYPE_OFFSET);
}
switch (themeRule?.settings.fontStyle) {
switch (definitions.foreground?.settings.fontStyle) {
case 'italic':
metadata |= FontStyle.Italic | MetadataConsts.ITALIC_MASK;
break;
@@ -930,26 +917,9 @@ export function findMetadata(colorThemeData: ColorThemeData, captureNames: strin
case 'strikethrough':
metadata |= FontStyle.Strikethrough | MetadataConsts.STRIKETHROUGH_MASK;
break;
default:
if (typeof tokenStyle?.italic !== 'undefined') {
const italicbit = (tokenStyle?.italic ? FontStyle.Italic : 0);
metadata |= italicbit | MetadataConsts.ITALIC_MASK;
}
if (typeof tokenStyle?.bold !== 'undefined') {
const boldBit = (tokenStyle?.bold ? FontStyle.Bold : 0);
metadata |= boldBit | MetadataConsts.BOLD_MASK;
}
if (typeof tokenStyle?.underline !== 'undefined') {
const underlineBit = (tokenStyle?.underline ? FontStyle.Underline : 0);
metadata |= underlineBit | MetadataConsts.UNDERLINE_MASK;
}
if (typeof tokenStyle?.strikethrough !== 'undefined') {
const strikethroughBit = (tokenStyle?.strikethrough ? FontStyle.Strikethrough : 0);
metadata |= strikethroughBit | MetadataConsts.STRIKETHROUGH_MASK;
}
}
const foreground = themeRule ? themeRule.settings.foreground : tokenStyle?.foreground;
const tokenStyleForeground = foreground ? colorThemeData.getTokenColorIndex().get(foreground) : ColorId.DefaultForeground;
const foreground = tokenStyle?.foreground;
const tokenStyleForeground = (foreground !== undefined) ? colorThemeData.getTokenColorIndex().get(foreground) : ColorId.DefaultForeground;
metadata |= tokenStyleForeground << MetadataConsts.FOREGROUND_OFFSET;
return metadata;
@@ -192,6 +192,9 @@ suite('Themes - TokenStyleResolving', () => {
tokenStyle = themeData.resolveScopes([['meta.structure.dictionary.json', 'string.quoted.double.json']]);
assertTokenStyle(tokenStyle, ts('#66D9EF', undefined), 'json property');
tokenStyle = themeData.resolveScopes([['source.json', 'meta.structure.dictionary.json', 'string.quoted.double.json']]);
assertTokenStyle(tokenStyle, ts('#66D9EF', undefined), 'json property');
tokenStyle = themeData.resolveScopes([['keyword'], ['storage.type'], ['entity.name.class']]);
assertTokenStyle(tokenStyle, ts('#66D9EF', { italic: true, bold: false, underline: false }), 'storage.type');
@@ -220,8 +220,8 @@ class TreeSitterTokenizationSupport extends Disposable implements ITreeSitterTok
// Check that the current token doesn't just replace the last token
if ((previousTokenStartOffset + currentTokenLength) === originalPreviousTokenEndOffset) {
// Current token and previous token span the exact same characters
endOffsetsAndScopes[tokenIndex - 1].scopes.push(capture.name);
// Current token and previous token span the exact same characters, replace the last scope
endOffsetsAndScopes[tokenIndex - 1].scopes[endOffsetsAndScopes[tokenIndex - 1].scopes.length - 1] = capture.name;
} else {
// The current token is within the previous token. Adjust the end of the previous token.
endOffsetsAndScopes[tokenIndex - 1].endOffset = intermediateTokenOffset;
@@ -79,6 +79,9 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
private readonly _onDidChangeAccountStatus = this._register(new Emitter<AccountStatus>());
readonly onDidChangeAccountStatus = this._onDidChangeAccountStatus.event;
private readonly _onDidTurnOnSync = this._register(new Emitter<void>());
readonly onDidTurnOnSync = this._onDidTurnOnSync.event;
private _current: UserDataSyncAccount | undefined;
get current(): UserDataSyncAccount | undefined { return this._current; }
@@ -324,6 +327,7 @@ export class UserDataSyncWorkbenchService extends Disposable implements IUserDat
}
this.notificationService.info(localize('sync turned on', "{0} is turned on", SYNC_TITLE.value));
this._onDidTurnOnSync.fire();
}
async turnoff(everywhere: boolean): Promise<void> {
@@ -34,6 +34,8 @@ export interface IUserDataSyncWorkbenchService {
readonly accountStatus: AccountStatus;
readonly onDidChangeAccountStatus: Event<AccountStatus>;
readonly onDidTurnOnSync: Event<void>;
turnOn(): Promise<void>;
turnoff(everyWhere: boolean): Promise<void>;
signIn(): Promise<void>;