Merge remote-tracking branch 'origin/master' into misolori/icon-font-breakpoints

This commit is contained in:
Miguel Solorio 2019-11-14 07:59:06 -08:00
commit bb4fefc959
208 changed files with 2183 additions and 2411 deletions

11
.github/commands.yml vendored
View file

@ -118,10 +118,10 @@
},
{
type: 'label',
name: '*needs more info',
name: '~needs more info',
action: 'updateLabels',
addLabel: 'needs more info',
removeLabel: '*needs more info',
removeLabel: '~needs more info',
comment: "Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our [issue reporting](https://aka.ms/vscodeissuereporting) guidelines. Please take the time to review these and update the issue.\n\nHappy Coding!"
},
{
@ -131,12 +131,5 @@
action: 'updateLabels',
addLabel: 'a11ymas'
},
{
type: 'label',
name: '*needs more info',
action: 'updateLabels',
addLabel: 'needs more info',
removeLabel: '*needs more info'
},
]
}

View file

@ -1,7 +1,7 @@
[
{
"name": "ms-vscode.node-debug",
"version": "1.40.1",
"version": "1.41.0",
"repo": "https://github.com/Microsoft/vscode-node-debug",
"metadata": {
"id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6",
@ -16,7 +16,7 @@
},
{
"name": "ms-vscode.node-debug2",
"version": "1.39.3",
"version": "1.41.0",
"repo": "https://github.com/Microsoft/vscode-node-debug2",
"metadata": {
"id": "36d19e17-7569-4841-a001-947eb18602b2",
@ -31,7 +31,7 @@
},
{
"name": "ms-vscode.references-view",
"version": "0.0.35",
"version": "0.0.37",
"repo": "https://github.com/Microsoft/vscode-reference-view",
"metadata": {
"id": "dc489f46-520d-4556-ae85-1f9eab3c412d",

View file

@ -57,7 +57,6 @@ var BUNDLED_FILE_HEADER = [
const languages = i18n.defaultLanguages.concat([]); // i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []);
const extractEditorSrcTask = task.define('extract-editor-src', () => {
console.log(`If the build fails, consider tweaking shakeLevel below to a lower value.`);
const apiusages = monacoapi.execute().usageContent;
const extrausages = fs.readFileSync(path.join(root, 'build', 'monaco', 'monaco.usage.recipe')).toString();
standalone.extractEditor({
@ -71,14 +70,6 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
apiusages,
extrausages
],
typings: [
'typings/lib.ie11_safe_es6.d.ts',
'typings/thenable.d.ts',
'typings/es6-promise.d.ts',
'typings/require-monaco.d.ts',
"typings/lib.es2018.promise.d.ts",
'vs/monaco.d.ts'
],
libs: [
`lib.es5.d.ts`,
`lib.dom.d.ts`,
@ -138,18 +129,70 @@ const createESMSourcesAndResourcesTask = task.define('extract-editor-esm', () =>
});
const compileEditorESMTask = task.define('compile-editor-esm', () => {
console.log(`Launching the TS compiler at ${path.join(__dirname, '../out-editor-esm')}...`);
let result;
if (process.platform === 'win32') {
const result = cp.spawnSync(`..\\node_modules\\.bin\\tsc.cmd`, {
result = cp.spawnSync(`..\\node_modules\\.bin\\tsc.cmd`, {
cwd: path.join(__dirname, '../out-editor-esm')
});
console.log(result.stdout.toString());
console.log(result.stderr.toString());
} else {
const result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
cwd: path.join(__dirname, '../out-editor-esm')
});
console.log(result.stdout.toString());
console.log(result.stderr.toString());
}
console.log(result.stdout.toString());
console.log(result.stderr.toString());
if (result.status !== 0) {
console.log(`The TS Compilation failed, preparing analysis folder...`);
const destPath = path.join(__dirname, '../../vscode-monaco-editor-esm-analysis');
return util.rimraf(destPath)().then(() => {
fs.mkdirSync(destPath);
// initialize a new repository
cp.spawnSync(`git`, [`init`], {
cwd: destPath
});
// build a list of files to copy
const files = util.rreddir(path.join(__dirname, '../out-editor-esm'));
// copy files from src
for (const file of files) {
const srcFilePath = path.join(__dirname, '../src', file);
const dstFilePath = path.join(destPath, file);
if (fs.existsSync(srcFilePath)) {
util.ensureDir(path.dirname(dstFilePath));
const contents = fs.readFileSync(srcFilePath).toString().replace(/\r\n|\r|\n/g, '\n');
fs.writeFileSync(dstFilePath, contents);
}
}
// create an initial commit to diff against
cp.spawnSync(`git`, [`add`, `.`], {
cwd: destPath
});
// create the commit
cp.spawnSync(`git`, [`commit`, `-m`, `"original sources"`, `--no-gpg-sign`], {
cwd: destPath
});
// copy files from esm
for (const file of files) {
const srcFilePath = path.join(__dirname, '../out-editor-esm', file);
const dstFilePath = path.join(destPath, file);
if (fs.existsSync(srcFilePath)) {
util.ensureDir(path.dirname(dstFilePath));
const contents = fs.readFileSync(srcFilePath).toString().replace(/\r\n|\r|\n/g, '\n');
fs.writeFileSync(dstFilePath, contents);
}
}
console.log(`Open in VS Code the folder at '${destPath}' and you can alayze the compilation error`);
throw new Error('Standalone Editor compilation failed. If this is the build machine, simply launch `yarn run gulp editor-distro` on your machine to further analyze the compilation problem.');
});
}
});

View file

@ -44,7 +44,7 @@ function createCompile(src, build, emitError) {
const input = es.through();
const output = input
.pipe(utf8Filter)
.pipe(bom())
.pipe(bom()) // this is required to preserve BOM in test files that loose it otherwise
.pipe(utf8Filter.restore)
.pipe(tsFilter)
.pipe(util.loadSourcemaps())

View file

@ -143,7 +143,7 @@
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/stats",
"name": "vs/workbench/contrib/tags",
"project": "vscode-workbench"
},
{

View file

@ -43,7 +43,9 @@ function extractEditor(options) {
compilerOptions.declaration = false;
compilerOptions.moduleResolution = ts.ModuleResolutionKind.Classic;
options.compilerOptions = compilerOptions;
console.log(`Running with shakeLevel ${tss.toStringShakeLevel(options.shakeLevel)}`);
console.log(`Running tree shaker with shakeLevel ${tss.toStringShakeLevel(options.shakeLevel)}`);
// Take the extra included .d.ts files from `tsconfig.monaco.json`
options.typings = tsConfig.include.filter(includedFile => /\.d\.ts$/.test(includedFile));
let result = tss.shake(options);
for (let fileName in result) {
if (result.hasOwnProperty(fileName)) {

View file

@ -50,7 +50,10 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
options.compilerOptions = compilerOptions;
console.log(`Running with shakeLevel ${tss.toStringShakeLevel(options.shakeLevel)}`);
console.log(`Running tree shaker with shakeLevel ${tss.toStringShakeLevel(options.shakeLevel)}`);
// Take the extra included .d.ts files from `tsconfig.monaco.json`
options.typings = (<string[]>tsConfig.include).filter(includedFile => /\.d\.ts$/.test(includedFile));
let result = tss.shake(options);
for (let fileName in result) {

View file

@ -25,17 +25,17 @@ function toStringShakeLevel(shakeLevel) {
}
}
exports.toStringShakeLevel = toStringShakeLevel;
function printDiagnostics(diagnostics) {
function printDiagnostics(options, diagnostics) {
for (const diag of diagnostics) {
let result = '';
if (diag.file) {
result += `${diag.file.fileName}: `;
result += `${path.join(options.sourcesRoot, diag.file.fileName)}`;
}
if (diag.file && diag.start) {
let location = diag.file.getLineAndCharacterOfPosition(diag.start);
result += `- ${location.line + 1},${location.character} - `;
result += `:${location.line + 1}:${location.character}`;
}
result += JSON.stringify(diag.messageText);
result += ` - ` + JSON.stringify(diag.messageText);
console.log(result);
}
}
@ -44,17 +44,17 @@ function shake(options) {
const program = languageService.getProgram();
const globalDiagnostics = program.getGlobalDiagnostics();
if (globalDiagnostics.length > 0) {
printDiagnostics(globalDiagnostics);
printDiagnostics(options, globalDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
const syntacticDiagnostics = program.getSyntacticDiagnostics();
if (syntacticDiagnostics.length > 0) {
printDiagnostics(syntacticDiagnostics);
printDiagnostics(options, syntacticDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
const semanticDiagnostics = program.getSemanticDiagnostics();
if (semanticDiagnostics.length > 0) {
printDiagnostics(semanticDiagnostics);
printDiagnostics(options, semanticDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
markNodes(languageService, options);
@ -358,7 +358,7 @@ function markNodes(languageService, options) {
++step;
let node;
if (step % 100 === 0) {
console.log(`${step}/${step + black_queue.length + gray_queue.length} (${black_queue.length}, ${gray_queue.length})`);
console.log(`Treeshaking - ${Math.floor(100 * step / (step + black_queue.length + gray_queue.length))}% - ${step}/${step + black_queue.length + gray_queue.length} (${black_queue.length}, ${gray_queue.length})`);
}
if (black_queue.length === 0) {
for (let i = 0; i < gray_queue.length; i++) {

View file

@ -71,17 +71,17 @@ export interface ITreeShakingResult {
[file: string]: string;
}
function printDiagnostics(diagnostics: ReadonlyArray<ts.Diagnostic>): void {
function printDiagnostics(options: ITreeShakingOptions, diagnostics: ReadonlyArray<ts.Diagnostic>): void {
for (const diag of diagnostics) {
let result = '';
if (diag.file) {
result += `${diag.file.fileName}: `;
result += `${path.join(options.sourcesRoot, diag.file.fileName)}`;
}
if (diag.file && diag.start) {
let location = diag.file.getLineAndCharacterOfPosition(diag.start);
result += `- ${location.line + 1},${location.character} - `;
result += `:${location.line + 1}:${location.character}`;
}
result += JSON.stringify(diag.messageText);
result += ` - ` + JSON.stringify(diag.messageText);
console.log(result);
}
}
@ -92,19 +92,19 @@ export function shake(options: ITreeShakingOptions): ITreeShakingResult {
const globalDiagnostics = program.getGlobalDiagnostics();
if (globalDiagnostics.length > 0) {
printDiagnostics(globalDiagnostics);
printDiagnostics(options, globalDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
const syntacticDiagnostics = program.getSyntacticDiagnostics();
if (syntacticDiagnostics.length > 0) {
printDiagnostics(syntacticDiagnostics);
printDiagnostics(options, syntacticDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
const semanticDiagnostics = program.getSemanticDiagnostics();
if (semanticDiagnostics.length > 0) {
printDiagnostics(semanticDiagnostics);
printDiagnostics(options, semanticDiagnostics);
throw new Error(`Compilation Errors encountered.`);
}
@ -471,7 +471,7 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt
let node: ts.Node;
if (step % 100 === 0) {
console.log(`${step}/${step + black_queue.length + gray_queue.length} (${black_queue.length}, ${gray_queue.length})`);
console.log(`Treeshaking - ${Math.floor(100 * step / (step + black_queue.length + gray_queue.length))}% - ${step}/${step + black_queue.length + gray_queue.length} (${black_queue.length}, ${gray_queue.length})`);
}
if (black_queue.length === 0) {

View file

@ -185,6 +185,31 @@ function rimraf(dir) {
return result;
}
exports.rimraf = rimraf;
function _rreaddir(dirPath, prepend, result) {
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory()) {
_rreaddir(path.join(dirPath, entry.name), `${prepend}/${entry.name}`, result);
}
else {
result.push(`${prepend}/${entry.name}`);
}
}
}
function rreddir(dirPath) {
let result = [];
_rreaddir(dirPath, '', result);
return result;
}
exports.rreddir = rreddir;
function ensureDir(dirPath) {
if (fs.existsSync(dirPath)) {
return;
}
ensureDir(path.dirname(dirPath));
fs.mkdirSync(dirPath);
}
exports.ensureDir = ensureDir;
function getVersion(root) {
let version = process.env['BUILD_SOURCEVERSION'];
if (!version || !/^[0-9a-f]{40}$/i.test(version)) {

View file

@ -243,6 +243,31 @@ export function rimraf(dir: string): () => Promise<void> {
return result;
}
function _rreaddir(dirPath: string, prepend: string, result: string[]): void {
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
for (const entry of entries) {
if (entry.isDirectory()) {
_rreaddir(path.join(dirPath, entry.name), `${prepend}/${entry.name}`, result);
} else {
result.push(`${prepend}/${entry.name}`);
}
}
}
export function rreddir(dirPath: string): string[] {
let result: string[] = [];
_rreaddir(dirPath, '', result);
return result;
}
export function ensureDir(dirPath: string): void {
if (fs.existsSync(dirPath)) {
return;
}
ensureDir(path.dirname(dirPath));
fs.mkdirSync(dirPath);
}
export function getVersion(root: string): string | undefined {
let version = process.env['BUILD_SOURCEVERSION'];

View file

@ -43,7 +43,7 @@ declare namespace monaco {
}
declare namespace monaco.editor {
#include(vs/editor/browser/widget/diffNavigator): IDiffNavigator
#includeAll(vs/editor/standalone/browser/standaloneEditor;modes.=>languages.;editorCommon.=>):
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule

View file

@ -2,38 +2,17 @@
// This file is adding references to various symbols which should not be removed via tree shaking
import { ServiceIdentifier } from './vs/platform/instantiation/common/instantiation';
import { IContextViewService } from './vs/platform/contextview/browser/contextView';
import { IHighlight } from './vs/base/parts/quickopen/browser/quickOpenModel';
import { IWorkspaceContextService } from './vs/platform/workspace/common/workspace';
import { IEnvironmentService } from './vs/platform/environment/common/environment';
import { CountBadge } from './vs/base/browser/ui/countBadge/countBadge';
import { SimpleWorkerClient, create as create1 } from './vs/base/common/worker/simpleWorker';
import { create as create1 } from './vs/base/common/worker/simpleWorker';
import { create as create2 } from './vs/editor/common/services/editorSimpleWorker';
import { QuickOpenWidget } from './vs/base/parts/quickopen/browser/quickOpenWidget';
import { WorkbenchAsyncDataTree } from './vs/platform/list/browser/listService';
import { SyncDescriptor0, SyncDescriptor1, SyncDescriptor2, SyncDescriptor3, SyncDescriptor4, SyncDescriptor5, SyncDescriptor6, SyncDescriptor7, SyncDescriptor8 } from './vs/platform/instantiation/common/descriptors';
import { DiffNavigator } from './vs/editor/browser/widget/diffNavigator';
import { DocumentRangeFormattingEditProvider } from './vs/editor/common/modes';
import * as editorAPI from './vs/editor/editor.api';
(function () {
var a: any;
var b: any;
a = (<IContextViewService>b).layout; // IContextViewProvider
a = (<IWorkspaceContextService>b).getWorkspaceFolder; // IWorkspaceFolderProvider
a = (<IWorkspaceContextService>b).getWorkspace; // IWorkspaceFolderProvider
a = (<CountBadge>b).style; // IThemable
a = (<QuickOpenWidget>b).style; // IThemable
a = (<WorkbenchAsyncDataTree<any,any>>b).style; // IThemable
a = (<IEnvironmentService>b).userHome; // IUserHomeProvider
a = (<DiffNavigator>b).previous; // IDiffNavigator
a = (<ServiceIdentifier<any>>b).type;
a = (<IHighlight>b).start;
a = (<IHighlight>b).end;
a = (<SimpleWorkerClient<any, any>>b).getProxyObject; // IWorkerClient
a = create1;
a = create2;
a = (<DocumentRangeFormattingEditProvider>b).extensionId;
// injection madness
a = (<SyncDescriptor0<any>>b).ctor;

View file

@ -73,10 +73,3 @@ yarnInstall(`build`); // node modules required for build
yarnInstall('test/automation'); // node modules required for smoketest
yarnInstall('test/smoke'); // node modules required for smoketest
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
// Remove the windows process tree typings as this causes duplicate identifier errors in tsc builds
const processTreeDts = path.join('node_modules', 'windows-process-tree', 'typings', 'windows-process-tree.d.ts');
if (fs.existsSync(processTreeDts)) {
console.log('Removing windows-process-tree.d.ts');
fs.unlinkSync(processTreeDts);
}

View file

@ -241,7 +241,11 @@
});
container.addEventListener('wheel', (/** @type {WheelEvent} */ e) => {
e.preventDefault();
// Prevent pinch to zoom
if (e.ctrlKey) {
e.preventDefault();
}
if (!image || !hasLoadedImage) {
return;
}
@ -260,8 +264,6 @@
}, { passive: false });
window.addEventListener('scroll', e => {
e.preventDefault();
if (!image || !hasLoadedImage || !image.parentElement || scale === 'fit') {
return;
}
@ -270,7 +272,7 @@
if (entry) {
vscode.setState({ scale: entry.scale, offsetX: window.scrollX, offsetY: window.scrollY });
}
}, { passive: false });
}, { passive: true });
container.classList.add('image');

View file

@ -29,7 +29,7 @@
"priority": "builtin",
"selector": [
{
"filenamePattern": "*.{jpg,jpe,jpeg,png,bmp,gif,ico,tga,webp}",
"filenamePattern": "*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp}",
"mime": "image/*"
}
]
@ -45,6 +45,11 @@
"command": "imagePreview.zoomOut",
"title": "%command.zoomOut%",
"category": "Image Preview"
},
{
"command": "imagePreview.testing.makeEdit",
"title": "Make test edit",
"category": "Image Preview"
}
],
"menus": {
@ -58,6 +63,11 @@
"command": "imagePreview.zoomOut",
"when": "imagePreviewFocus",
"group": "1_imagePreview"
},
{
"command": "imagePreview.testing.makeEdit",
"when": "imagePreviewTestMode",
"group": "1_imagePreview"
}
]
}

View file

@ -34,5 +34,20 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomOut', () => {
previewManager.activePreview?.zoomOut();
}));
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.testing.makeEdit', () => {
previewManager.activePreview?.test_makeEdit();
}));
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('imagePreview.customEditorTestMode')) {
updateTestMode();
}
}));
updateTestMode();
}
function updateTestMode() {
const isInTestMode = vscode.workspace.getConfiguration('imagePreview').get<boolean>('customEditorTestMode', false);
vscode.commands.executeCommand('setContext', 'imagePreviewTestMode', isInTestMode);
}

View file

@ -43,15 +43,8 @@ export class PreviewManager {
}
});
const onEdit = new vscode.EventEmitter<{ now: number }>();
return {
editingCapability: {
onEdit: onEdit.event,
save: async () => { },
hotExit: async () => { },
applyEdits: async () => { },
undoEdits: async (edits) => { console.log('undo', edits); },
}
editingCapability: preview
};
}
@ -73,7 +66,7 @@ const enum PreviewState {
Active,
}
class Preview extends Disposable {
class Preview extends Disposable implements vscode.WebviewEditorEditingCapability {
private readonly id: string = `${Date.now()}-${Math.random().toString()}`;
@ -203,8 +196,11 @@ class Preview extends Disposable {
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Disable pinch zooming -->
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>Image Preview</title>
<link rel="stylesheet" href="${escapeAttribute(this.extensionResource('/media/main.css'))}" type="text/css" media="screen" nonce="${nonce}">
@ -243,6 +239,24 @@ class Preview extends Disposable {
path: this.extensionRoot.path + path
}));
}
//#region WebviewEditorCapabilities
private readonly _onEdit = this._register(new vscode.EventEmitter<{ now: number }>());
public readonly onEdit = this._onEdit.event;
async save() { }
async hotExit() { }
async applyEdits(_edits: any[]) { }
async undoEdits(edits: any[]) { console.log('undo', edits); }
//#endregion
public test_makeEdit() {
this._onEdit.fire({ now: Date.now() });
}
}
function escapeAttribute(value: string | vscode.Uri): string {

View file

@ -7,7 +7,7 @@
"config.npm.exclude": "Configure glob patterns for folders that should be excluded from automatic script detection.",
"config.npm.enableScriptExplorer": "Enable an explorer view for npm scripts when there is no top-level 'package.json' file.",
"config.npm.scriptExplorerAction": "The default click action used in the npm scripts explorer: `open` or `run`, the default is `open`.",
"config.npm.enableRunFromFolder": "Enable running NPM scripts contained in a folder from the Explorer context menu.",
"config.npm.enableRunFromFolder": "Enable running npm scripts contained in a folder from the Explorer context menu.",
"config.npm.fetchOnlinePackageInfo": "Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.",
"npm.parseError": "Npm task detection: failed to parse the file {0}",
"taskdef.script": "The npm script to customize.",

View file

@ -77,22 +77,6 @@
"meta.import string.quoted": "other",
"variable.other.jsdoc": "other"
}
},
{
"scopeName": "documentation.injection.ts",
"path": "./syntaxes/jsdoc.ts.injection.tmLanguage.json",
"injectTo": [
"source.ts",
"source.tsx"
]
},
{
"scopeName": "documentation.injection.js.jsx",
"path": "./syntaxes/jsdoc.js.injection.tmLanguage.json",
"injectTo": [
"source.js",
"source.js.jsx"
]
}
],
"snippets": [

View file

@ -1,54 +0,0 @@
{
"injectionSelector": "L:comment.block.documentation",
"patterns": [
{
"include": "#jsdocbody"
}
],
"repository": {
"jsdocbody": {
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
"patterns": [
{
"include": "text.html.markdown#fenced_code_block_js"
},
{
"include": "text.html.markdown#fenced_code_block_ts"
},
{
"include": "text.html.markdown#fenced_code_block_unknown"
},
{
"include": "#example"
},
{
"include": "source.ts#docblock"
},
{
"include": "text.html.markdown#inline"
}
]
},
"example": {
"begin": "((@)example)\\s+(?=([^*]|[*](?!/))*$).*$",
"while": "(^|\\G)\\s(?!@)(?=([^*]|[*](?!/))*$)",
"beginCaptures": {
"1": {
"name": "storage.type.class.jsdoc"
},
"2": {
"name": "punctuation.definition.block.tag.jsdoc"
}
},
"contentName": "meta.embedded.block.example.source.ts",
"patterns": [
{
"include": "source.js.jsx"
}
]
}
},
"scopeName": "documentation.injection.js.jsx"
}

View file

@ -1,54 +0,0 @@
{
"injectionSelector": "L:comment.block.documentation",
"patterns": [
{
"include": "#jsdocbody"
}
],
"repository": {
"jsdocbody": {
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
"patterns": [
{
"include": "text.html.markdown#fenced_code_block_js"
},
{
"include": "text.html.markdown#fenced_code_block_ts"
},
{
"include": "text.html.markdown#fenced_code_block_unknown"
},
{
"include": "#example"
},
{
"include": "source.ts#docblock"
},
{
"include": "text.html.markdown#inline"
}
]
},
"example": {
"begin": "((@)example)\\s+(?=([^*]|[*](?!/))*$).*$",
"while": "(^|\\G)\\s(?!@)(?=([^*]|[*](?!/))*$)",
"beginCaptures": {
"1": {
"name": "storage.type.class.jsdoc"
},
"2": {
"name": "punctuation.definition.block.tag.jsdoc"
}
},
"contentName": "meta.embedded.block.example.source.ts",
"patterns": [
{
"include": "source.tsx"
}
]
}
},
"scopeName": "documentation.injection.ts"
}

View file

@ -1,8 +0,0 @@
/**
* @example
* 1 + 1
*
* @other
* not colored
*/
const a = 1

View file

@ -1,7 +0,0 @@
/**
* **Bold**
* ```js
* 1 + code
* ```
*/
const a = 1

View file

@ -1,277 +0,0 @@
[
{
"c": "/**",
"t": "source.ts comment.block.documentation.ts punctuation.definition.comment.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " * ",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "@",
"t": "source.ts comment.block.documentation.ts storage.type.class.jsdoc punctuation.definition.block.tag.jsdoc",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": "example",
"t": "source.ts comment.block.documentation.ts storage.type.class.jsdoc",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "1",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts constant.numeric.decimal.tsx",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #09885A",
"hc_black": "constant.numeric: #B5CEA8"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "+",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts keyword.operator.arithmetic.tsx",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "1",
"t": "source.ts comment.block.documentation.ts meta.embedded.block.example.source.ts constant.numeric.decimal.tsx",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #09885A",
"hc_black": "constant.numeric: #B5CEA8"
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " * ",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "@",
"t": "source.ts comment.block.documentation.ts storage.type.class.jsdoc punctuation.definition.block.tag.jsdoc",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": "other",
"t": "source.ts comment.block.documentation.ts storage.type.class.jsdoc",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": " * not colored",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "*/",
"t": "source.ts comment.block.documentation.ts punctuation.definition.comment.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "const",
"t": "source.ts meta.var.expr.ts storage.type.ts",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "a",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "=",
"t": "source.ts meta.var.expr.ts keyword.operator.assignment.ts",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "1",
"t": "source.ts meta.var.expr.ts constant.numeric.decimal.ts",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #09885A",
"hc_black": "constant.numeric: #B5CEA8"
}
}
]

View file

@ -1,310 +0,0 @@
[
{
"c": "/**",
"t": "source.ts comment.block.documentation.ts punctuation.definition.comment.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " * ",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "**",
"t": "source.ts comment.block.documentation.ts markup.bold.markdown punctuation.definition.bold.markdown",
"r": {
"dark_plus": "markup.bold: #569CD6",
"light_plus": "markup.bold: #000080",
"dark_vs": "markup.bold: #569CD6",
"light_vs": "markup.bold: #000080",
"hc_black": "comment: #7CA668"
}
},
{
"c": "Bold",
"t": "source.ts comment.block.documentation.ts markup.bold.markdown",
"r": {
"dark_plus": "markup.bold: #569CD6",
"light_plus": "markup.bold: #000080",
"dark_vs": "markup.bold: #569CD6",
"light_vs": "markup.bold: #000080",
"hc_black": "comment: #7CA668"
}
},
{
"c": "**",
"t": "source.ts comment.block.documentation.ts markup.bold.markdown punctuation.definition.bold.markdown",
"r": {
"dark_plus": "markup.bold: #569CD6",
"light_plus": "markup.bold: #000080",
"dark_vs": "markup.bold: #569CD6",
"light_vs": "markup.bold: #000080",
"hc_black": "comment: #7CA668"
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "```",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown punctuation.definition.markdown",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "js",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown fenced_code.block.language.markdown",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "1",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript constant.numeric.decimal.js",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #09885A",
"hc_black": "constant.numeric: #B5CEA8"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "+",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript keyword.operator.arithmetic.js",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript",
"r": {
"dark_plus": "meta.embedded: #D4D4D4",
"light_plus": "meta.embedded: #000000",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "meta.embedded: #FFFFFF"
}
},
{
"c": "code",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown meta.embedded.block.javascript variable.other.readwrite.js",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "meta.embedded: #D4D4D4",
"light_vs": "meta.embedded: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "```",
"t": "source.ts comment.block.documentation.ts markup.fenced_code.block.markdown punctuation.definition.markdown",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " ",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "*/",
"t": "source.ts comment.block.documentation.ts punctuation.definition.comment.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": "const",
"t": "source.ts meta.var.expr.ts storage.type.ts",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "a",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "=",
"t": "source.ts meta.var.expr.ts keyword.operator.assignment.ts",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4"
}
},
{
"c": " ",
"t": "source.ts meta.var.expr.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "1",
"t": "source.ts meta.var.expr.ts constant.numeric.decimal.ts",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #09885A",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #09885A",
"hc_black": "constant.numeric: #B5CEA8"
}
}
]

View file

@ -77,18 +77,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " id: number,",
"c": " * id: number,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -99,18 +88,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " fn: !Function,",
"c": " * fn: !Function,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -121,18 +99,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " context: (!Object|undefined)",
"c": " * context: (!Object|undefined)",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -143,18 +110,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " }",
"c": " * }",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -396,18 +352,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " measureTask: goog.dom.animationFrame.Task_,",
"c": " * measureTask: goog.dom.animationFrame.Task_,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -418,18 +363,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " mutateTask: goog.dom.animationFrame.Task_,",
"c": " * mutateTask: goog.dom.animationFrame.Task_,",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -440,18 +374,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " state: (!Object|undefined),",
"c": " * state: (!Object|undefined),",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -462,18 +385,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " args: (!Array|undefined),",
"c": " * args: (!Array|undefined),",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -484,18 +396,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " isScheduled: boolean",
"c": " * isScheduled: boolean",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",
@ -506,18 +407,7 @@
}
},
{
"c": " *",
"t": "source.ts comment.block.documentation.ts",
"r": {
"dark_plus": "comment: #6A9955",
"light_plus": "comment: #008000",
"dark_vs": "comment: #6A9955",
"light_vs": "comment: #008000",
"hc_black": "comment: #7CA668"
}
},
{
"c": " }",
"c": " * }",
"t": "source.ts comment.block.documentation.ts entity.name.type.instance.jsdoc",
"r": {
"dark_plus": "entity.name.type: #4EC9B0",

View file

@ -66,12 +66,13 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider
const children = new Set(item.childItems || []);
for (const span of item.spans) {
const range = typeConverters.Range.fromTextSpan(span);
const selectionRange = item.nameSpan ? typeConverters.Range.fromTextSpan(item.nameSpan) : range;
const symbolInfo = new vscode.DocumentSymbol(
item.text,
'',
getSymbolKind(item.kind),
range,
range);
range.contains(selectionRange) ? selectionRange : range);
for (const child of children) {
if (child.spans.some(span => !!range.intersection(typeConverters.Range.fromTextSpan(span)))) {

View file

@ -22,8 +22,10 @@ const autoFixableDiagnosticCodes = new Set<number>([
class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
private static readonly kind = vscode.CodeActionKind.SourceFixAll.append('ts');
public static readonly metadata: vscode.CodeActionProviderMetadata = {
providedCodeActionKinds: [vscode.CodeActionKind.SourceFixAll]
providedCodeActionKinds: [TypeScriptAutoFixProvider.kind]
};
constructor(
@ -82,7 +84,7 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
const { edit, fixedDiagnostics } = autoFixResponse;
const codeAction = new vscode.CodeAction(
localize('autoFix.label', 'Auto fix'),
vscode.CodeActionKind.SourceFixAll);
TypeScriptAutoFixProvider.kind);
codeAction.edit = edit;
codeAction.diagnostics = fixedDiagnostics;

View file

@ -3,12 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as jsonc from 'jsonc-parser';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { ITypeScriptServiceClient } from '../typescriptService';
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
import { isTsConfigFileName } from '../utils/languageDescription';
import { Lazy } from '../utils/lazy';
import { isImplicitProjectConfigFile } from '../utils/tsconfig';
@ -18,14 +17,14 @@ const localize = nls.loadMessageBundle();
type AutoDetect = 'on' | 'off' | 'build' | 'watch';
const exists = (file: string): Promise<boolean> =>
new Promise<boolean>((resolve, _reject) => {
fs.exists(file, (value: boolean) => {
resolve(value);
});
});
const exists = async (resource: vscode.Uri): Promise<boolean> => {
try {
const stat = await vscode.workspace.fs.stat(resource);
return stat.type === vscode.FileType.File;
} catch {
return false;
}
};
interface TypeScriptTaskDefinition extends vscode.TaskDefinition {
tsconfig: string;
@ -36,6 +35,8 @@ interface TypeScriptTaskDefinition extends vscode.TaskDefinition {
* Provides tasks for building `tsconfig.json` files in a project.
*/
export default class TscTaskProvider implements vscode.TaskProvider {
private readonly projectInfoRequestTimeout = 2000;
private autoDetect: AutoDetect = 'on';
private readonly tsconfigProvider: TsConfigProvider;
private readonly disposables: vscode.Disposable[] = [];
@ -62,8 +63,8 @@ export default class TscTaskProvider implements vscode.TaskProvider {
const configPaths: Set<string> = new Set();
const tasks: vscode.Task[] = [];
for (const project of await this.getAllTsConfigs(token)) {
if (!configPaths.has(project.path)) {
configPaths.add(project.path);
if (!configPaths.has(project.fsPath)) {
configPaths.add(project.fsPath);
tasks.push(...(await this.getTasksForProject(project)));
}
}
@ -88,7 +89,8 @@ export default class TscTaskProvider implements vscode.TaskProvider {
const kind: TypeScriptTaskDefinition = (<any>_task.definition);
const tsconfigUri: vscode.Uri = _task.scope.uri.with({ path: _task.scope.uri.path + '/' + kind.tsconfig });
const tsconfig: TSConfig = {
path: tsconfigUri.fsPath,
uri: tsconfigUri,
fsPath: tsconfigUri.fsPath,
posixPath: tsconfigUri.path,
workspaceFolder: _task.scope
};
@ -104,7 +106,7 @@ export default class TscTaskProvider implements vscode.TaskProvider {
...await this.getTsConfigsInWorkspace()
];
for (const config of configs) {
if (await exists(config.path)) {
if (await exists(config.uri)) {
out.add(config);
}
}
@ -117,7 +119,8 @@ export default class TscTaskProvider implements vscode.TaskProvider {
if (isTsConfigFileName(editor.document.fileName)) {
const uri = editor.document.uri;
return [{
path: uri.fsPath,
uri,
fsPath: uri.fsPath,
posixPath: uri.path,
workspaceFolder: vscode.workspace.getWorkspaceFolder(uri)
}];
@ -129,10 +132,13 @@ export default class TscTaskProvider implements vscode.TaskProvider {
return [];
}
const response = await this.client.value.execute(
'projectInfo',
{ file, needFileNameList: false },
token);
const response = await Promise.race([
this.client.value.execute(
'projectInfo',
{ file, needFileNameList: false },
token),
new Promise<typeof ServerResponse.NoContent>(resolve => setTimeout(() => resolve(ServerResponse.NoContent), this.projectInfoRequestTimeout))
]);
if (response.type !== 'response' || !response.body) {
return [];
}
@ -143,7 +149,8 @@ export default class TscTaskProvider implements vscode.TaskProvider {
const uri = vscode.Uri.file(normalizedConfigPath);
const folder = vscode.workspace.getWorkspaceFolder(uri);
return [{
path: normalizedConfigPath,
uri,
fsPath: normalizedConfigPath,
posixPath: uri.path,
workspaceFolder: folder
}];
@ -158,7 +165,7 @@ export default class TscTaskProvider implements vscode.TaskProvider {
private static async getCommand(project: TSConfig): Promise<string> {
if (project.workspaceFolder) {
const localTsc = await TscTaskProvider.getLocalTscAtPath(path.dirname(project.path));
const localTsc = await TscTaskProvider.getLocalTscAtPath(path.dirname(project.fsPath));
if (localTsc) {
return localTsc;
}
@ -176,9 +183,9 @@ export default class TscTaskProvider implements vscode.TaskProvider {
private static async getLocalTscAtPath(folderPath: string): Promise<string | undefined> {
const platform = process.platform;
const bin = path.join(folderPath, 'node_modules', '.bin');
if (platform === 'win32' && await exists(path.join(bin, 'tsc.cmd'))) {
if (platform === 'win32' && await exists(vscode.Uri.file(path.join(bin, 'tsc.cmd')))) {
return path.join(bin, 'tsc.cmd');
} else if ((platform === 'linux' || platform === 'darwin') && await exists(path.join(bin, 'tsc'))) {
} else if ((platform === 'linux' || platform === 'darwin') && await exists(vscode.Uri.file(path.join(bin, 'tsc')))) {
return path.join(bin, 'tsc');
}
return undefined;
@ -196,7 +203,7 @@ export default class TscTaskProvider implements vscode.TaskProvider {
}
private getBuildTask(workspaceFolder: vscode.WorkspaceFolder | undefined, label: string, command: string, args: string[], buildTaskidentifier: TypeScriptTaskDefinition): vscode.Task {
const buildTask = new vscode.Task(
const buildTask = new vscode.Task2(
buildTaskidentifier,
workspaceFolder || vscode.TaskScope.Workspace,
localize('buildTscLabel', 'build - {0}', label),
@ -233,7 +240,6 @@ export default class TscTaskProvider implements vscode.TaskProvider {
}
if (this.autoDetect === 'watch' || this.autoDetect === 'on') {
tasks.push(this.getWatchTask(project.workspaceFolder, label, command, args, { type: 'typescript', tsconfig: label, option: 'watch' }));
}
@ -256,25 +262,19 @@ export default class TscTaskProvider implements vscode.TaskProvider {
return task;
}
private getBuildShellArgs(project: TSConfig): Promise<Array<string>> {
const defaultArgs = ['-p', project.path];
return new Promise<Array<string>>((resolve) => {
fs.readFile(project.path, (error, result) => {
if (error) {
return resolve(defaultArgs);
}
try {
const tsconfig = jsonc.parse(result.toString());
if (tsconfig.references) {
return resolve(['-b', project.path]);
}
} catch {
// noop
}
return resolve(defaultArgs);
});
});
private async getBuildShellArgs(project: TSConfig): Promise<Array<string>> {
const defaultArgs = ['-p', project.fsPath];
try {
const bytes = await vscode.workspace.fs.readFile(project.uri);
const text = Buffer.from(bytes).toString('utf-8');
const tsconfig = jsonc.parse(text);
if (tsconfig?.references) {
return ['-b', project.fsPath];
}
} catch {
// noops
}
return defaultArgs;
}
private getLabelForTasks(project: TSConfig): string {

View file

@ -82,7 +82,8 @@ namespace ServerState {
export default class TypeScriptServiceClient extends Disposable implements ITypeScriptServiceClient {
private static readonly WALK_THROUGH_SNIPPET_SCHEME_COLON = `${fileSchemes.walkThroughSnippet}:`;
private pathSeparator: string;
private readonly pathSeparator: string;
private readonly inMemoryResourcePrefix = '^';
private _onReady?: { promise: Promise<void>; resolve: () => void; reject: () => void; };
private _configuration: TypeScriptServiceConfiguration;
@ -591,23 +592,18 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return this.toPath(document.uri) || undefined;
}
private get inMemoryResourcePrefix(): string {
return this.apiVersion.gte(API.v270) ? '^' : '';
}
public toResource(filepath: string): vscode.Uri {
if (filepath.startsWith(TypeScriptServiceClient.WALK_THROUGH_SNIPPET_SCHEME_COLON) || (filepath.startsWith(fileSchemes.untitled + ':'))
) {
let resource = vscode.Uri.parse(filepath);
if (this.inMemoryResourcePrefix) {
const dirName = path.dirname(resource.path);
const fileName = path.basename(resource.path);
if (fileName.startsWith(this.inMemoryResourcePrefix)) {
resource = resource.with({
path: path.posix.join(dirName, fileName.slice(this.inMemoryResourcePrefix.length))
});
}
const dirName = path.dirname(resource.path);
const fileName = path.basename(resource.path);
if (fileName.startsWith(this.inMemoryResourcePrefix)) {
resource = resource.with({
path: path.posix.join(dirName, fileName.slice(this.inMemoryResourcePrefix.length))
});
}
return this.bufferSyncSupport.toVsCodeResource(resource);
}

View file

@ -2,10 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export interface TSConfig {
readonly path: string;
readonly uri: vscode.Uri;
readonly fsPath: string;
readonly posixPath: string;
readonly workspaceFolder?: vscode.WorkspaceFolder;
}
@ -20,7 +22,8 @@ export default class TsConfigProvider {
const root = vscode.workspace.getWorkspaceFolder(config);
if (root) {
configs.set(config.fsPath, {
path: config.fsPath,
uri: config,
fsPath: config.fsPath,
posixPath: config.path,
workspaceFolder: root
});

View file

@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.41.0",
"distro": "be6ad88ea0214dfdb03b943bef28e7a5c9fc2e4b",
"distro": "403ab44be562c63a0cde1969fd8f5b45ff51709c",
"author": {
"name": "Microsoft Corporation"
},
@ -42,12 +42,12 @@
"native-keymap": "2.0.0",
"native-watchdog": "1.2.0",
"node-pty": "^0.10.0-beta2",
"onigasm-umd": "^2.2.2",
"onigasm-umd": "^2.2.4",
"semver-umd": "^5.5.3",
"spdlog": "^0.11.1",
"sudo-prompt": "9.0.0",
"sudo-prompt": "9.1.0",
"v8-inspect-profiler": "^0.0.20",
"vscode-minimist": "^1.2.1",
"vscode-minimist": "^1.2.2",
"vscode-nsfw": "1.2.8",
"vscode-proxy-agent": "^0.5.2",
"vscode-ripgrep": "^1.5.7",
@ -74,6 +74,7 @@
"@types/sinon": "^1.16.36",
"@types/webpack": "^4.4.10",
"@types/windows-foreground-love": "^0.3.0",
"@types/windows-process-tree": "^0.2.0",
"@types/winreg": "^1.2.30",
"@types/yauzl": "^2.9.1",
"@types/yazl": "^2.4.2",

View file

@ -12,10 +12,10 @@
"jschardet": "2.1.1",
"native-watchdog": "1.2.0",
"node-pty": "^0.10.0-beta2",
"onigasm-umd": "^2.2.2",
"onigasm-umd": "^2.2.4",
"semver-umd": "^5.5.3",
"spdlog": "^0.11.1",
"vscode-minimist": "^1.2.1",
"vscode-minimist": "^1.2.2",
"vscode-nsfw": "1.2.8",
"vscode-proxy-agent": "^0.5.2",
"vscode-ripgrep": "^1.5.7",

View file

@ -2,7 +2,7 @@
"name": "vscode-web",
"version": "0.0.0",
"dependencies": {
"onigasm-umd": "^2.2.2",
"onigasm-umd": "^2.2.4",
"semver-umd": "^5.5.3",
"vscode-textmate": "^4.3.0",
"xterm": "4.3.0-beta17",

View file

@ -7,10 +7,10 @@ nan@^2.14.0:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
onigasm-umd@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.2.tgz#b989d762df61f899a3052ac794a50bd93fe20257"
integrity sha512-v2eMOJu7iE444L2iJN+U6s6s5S0y7oj/N0DAkrd6wokRtTVoq/v/yaDI1lIqFrTeJbNtqNzYvguDF5yNzW3Rvw==
onigasm-umd@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.4.tgz#27ee87f7496c66ad40cebfbc0d418c19bb7db5ec"
integrity sha512-N9VqCUhl9KBuzm47vcK8T/xUnbYylIhMN45Rwltlo1sZc3QUDda6SxIlyVB8r0SJQwURv8JOHjyXjjCriGvzRg==
oniguruma@^7.2.0:
version "7.2.0"

View file

@ -283,10 +283,10 @@ normalize-path@^3.0.0, normalize-path@~3.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
onigasm-umd@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.2.tgz#b989d762df61f899a3052ac794a50bd93fe20257"
integrity sha512-v2eMOJu7iE444L2iJN+U6s6s5S0y7oj/N0DAkrd6wokRtTVoq/v/yaDI1lIqFrTeJbNtqNzYvguDF5yNzW3Rvw==
onigasm-umd@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.4.tgz#27ee87f7496c66ad40cebfbc0d418c19bb7db5ec"
integrity sha512-N9VqCUhl9KBuzm47vcK8T/xUnbYylIhMN45Rwltlo1sZc3QUDda6SxIlyVB8r0SJQwURv8JOHjyXjjCriGvzRg==
oniguruma@^7.2.0:
version "7.2.0"
@ -369,10 +369,10 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
vscode-minimist@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/vscode-minimist/-/vscode-minimist-1.2.1.tgz#e63d3f4a9bf3680dcb8f9304eed612323fd6926a"
integrity sha512-cmB72+qDoiCFJ1UKnGUBdGYfXzdpJ3bQM/D/+XhkVk5v7uZgLbYiCz5JcwVyk7NC7hSi5VGtQ4wihzmi12NeXw==
vscode-minimist@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/vscode-minimist/-/vscode-minimist-1.2.2.tgz#65403f44f0c6010d259b2271d36eb5c6f4ad8aab"
integrity sha512-DXMNG2QgrXn1jOP12LzjVfvxVkzxv/0Qa27JrMBj/XP2esj+fJ/wP2T4YUH5derj73Lc96dC8F25WyfDUbTpxQ==
vscode-nsfw@1.2.8:
version "1.2.8"

View file

@ -13,9 +13,8 @@ set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"
:: Download Electron if needed
node build\lib\electron.js
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
:: Get electron
call yarn electron
:: Manage built-in extensions
if "%1"=="--builtin" goto builtin

View file

@ -1,92 +0,0 @@
// Type definitions for minimist 1.2.0
// Project: https://github.com/substack/minimist
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Necroskillz <https://github.com/Necroskillz>, kamranayub <https://github.com/kamranayub>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Return an argument object populated with the array arguments from args
*
* @param args An optional argument array (typically `process.argv.slice(2)`)
* @param opts An optional options object to customize the parsing
*/
declare function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
/**
* Return an argument object populated with the array arguments from args. Strongly-typed
* to be the intersect of type T with minimist.ParsedArgs.
*
* @type T The type that will be intersected with minimist.ParsedArgs to represent the argument object
* @param args An optional argument array (typically `process.argv.slice(2)`)
* @param opts An optional options object to customize the parsing
*/
declare function minimist<T>(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs;
/**
* Return an argument object populated with the array arguments from args. Strongly-typed
* to be the the type T which should extend minimist.ParsedArgs
*
* @type T The type that extends minimist.ParsedArgs and represents the argument object
* @param args An optional argument array (typically `process.argv.slice(2)`)
* @param opts An optional options object to customize the parsing
*/
declare function minimist<T extends minimist.ParsedArgs>(args?: string[], opts?: minimist.Opts): T;
declare namespace minimist {
export interface Opts {
/**
* A string or array of strings argument names to always treat as strings
*/
string?: string | string[];
/**
* A boolean, string or array of strings to always treat as booleans. If true will treat
* all double hyphenated arguments without equals signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
*/
boolean?: boolean | string | string[];
/**
* An object mapping string names to strings or arrays of string argument names to use as aliases
*/
alias?: { [key: string]: string | string[] };
/**
* An object mapping string argument names to default values
*/
default?: { [key: string]: any };
/**
* When true, populate argv._ with everything after the first non-option
*/
stopEarly?: boolean;
/**
* A function which is invoked with a command line parameter not defined in the opts
* configuration object. If the function returns false, the unknown option is not added to argv
*/
unknown?: (arg: string) => boolean;
/**
* When true, populate argv._ with everything before the -- and argv['--'] with everything after the --.
* Note that with -- set, parsing for arguments still stops after the `--`.
*/
'--'?: boolean;
}
export interface ParsedArgs {
[arg: string]: any;
/**
* If opts['--'] is true, populated with everything after the --
*/
'--'?: string[];
/**
* Contains all the arguments that didn't have an option associated with them
*/
_: string[];
}
}
declare module "vscode-minimist" {
export = minimist;
}

View file

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'windows-process-tree' {
export enum ProcessDataFlag {
None = 0,
Memory = 1,
CommandLine = 2
}
export interface IProcessInfo {
pid: number;
ppid: number;
name: string;
/**
* The working set size of the process, in bytes.
*/
memory?: number;
/**
* The string returned is at most 512 chars, strings exceeding this length are truncated.
*/
commandLine?: string;
}
export interface IProcessCpuInfo extends IProcessInfo {
cpu?: number;
}
export interface IProcessTreeNode {
pid: number;
name: string;
memory?: number;
commandLine?: string;
children: IProcessTreeNode[];
}
/**
* Returns a tree of processes with the rootPid process as the root.
* @param rootPid - The pid of the process that will be the root of the tree.
* @param callback - The callback to use with the returned list of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessTree(rootPid: number, callback: (tree: IProcessTreeNode) => void, flags?: ProcessDataFlag): void;
/**
* Returns a list of processes containing the rootPid process and all of its descendants.
* @param rootPid - The pid of the process of interest.
* @param callback - The callback to use with the returned set of processes.
* @param flags - The flags for what process data should be included.
*/
export function getProcessList(rootPid: number, callback: (processList: IProcessInfo[]) => void, flags?: ProcessDataFlag): void;
/**
* Returns the list of processes annotated with cpu usage information.
* @param processList - The list of processes.
* @param callback - The callback to use with the returned list of processes.
*/
export function getProcessCpuUsage(processList: IProcessInfo[], callback: (processListWithCpu: IProcessCpuInfo[]) => void): void;
}

View file

@ -205,7 +205,7 @@ export class FastDomNode<T extends HTMLElement> {
return;
}
this._layerHint = layerHint;
(<any>this.domNode.style).willChange = this._layerHint ? 'transform' : 'auto';
this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';
}
public setContain(contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'): void {

View file

@ -8,6 +8,7 @@ import { $, append } from 'vs/base/browser/dom';
import { format } from 'vs/base/common/strings';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
import { IThemable } from 'vs/base/common/styler';
export interface ICountBadgeOptions extends ICountBadgetyles {
count?: number;
@ -26,7 +27,7 @@ const defaultOpts = {
badgeForeground: Color.fromHex('#FFFFFF')
};
export class CountBadge {
export class CountBadge implements IThemable {
private element: HTMLElement;
private count: number = 0;

View file

@ -84,7 +84,11 @@ export class HighlightedLabel {
}
this.domNode.innerHTML = htmlContent;
this.domNode.title = this.title;
if (this.title) {
this.domNode.title = this.title;
} else {
this.domNode.removeAttribute('title');
}
this.didEverRender = true;
}

View file

@ -116,7 +116,7 @@ export class IconLabel extends Disposable {
return this.domNode.element;
}
setLabel(label?: string, description?: string, options?: IIconLabelValueOptions): void {
setLabel(label: string, description?: string, options?: IIconLabelValueOptions): void {
const classes = ['monaco-icon-label'];
if (options) {
if (options.extraClasses) {

View file

@ -234,7 +234,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this.rowsContainer = document.createElement('div');
this.rowsContainer.className = 'monaco-list-rows';
this.rowsContainer.style.willChange = 'transform';
this.rowsContainer.style.transform = 'translate3d(0px, 0px, 0px)';
this.disposables.add(Gesture.addTarget(this.rowsContainer));
this.scrollableElement = this.disposables.add(new ScrollableElement(this.rowsContainer, {

View file

@ -35,7 +35,7 @@
animation-duration: 4s;
animation-iteration-count: infinite;
animation-timing-function: linear;
will-change: transform;
transform: translate3d(0px, 0px, 0px);
}
/**

View file

@ -109,6 +109,10 @@ abstract class ViewItem {
get priority(): LayoutPriority | undefined { return this.view.priority; }
get snap(): boolean { return !!this.view.snap; }
set enabled(enabled: boolean) {
this.container.style.pointerEvents = enabled ? null : 'none';
}
constructor(
protected container: HTMLElement,
private view: IView,
@ -430,6 +434,10 @@ export class SplitView extends Disposable {
}
private onSashStart({ sash, start, alt }: ISashEvent): void {
for (const item of this.viewItems) {
item.enabled = false;
}
const index = firstIndex(this.sashItems, item => item.sash === sash);
// This way, we can press Alt while we resize a sash, macOS style!
@ -535,6 +543,10 @@ export class SplitView extends Disposable {
this._onDidSashChange.fire(index);
this.sashDragState!.disposable.dispose();
this.saveProportions();
for (const item of this.viewItems) {
item.enabled = true;
}
}
private onViewChange(item: ViewItem, size: number | undefined): void {

View file

@ -19,6 +19,7 @@ import { toggleClass } from 'vs/base/browser/dom';
import { values } from 'vs/base/common/map';
import { ScrollEvent } from 'vs/base/common/scrollable';
import { ICompressedTreeNode, ICompressedTreeElement } from 'vs/base/browser/ui/tree/compressedObjectTreeModel';
import { IThemable } from 'vs/base/common/styler';
interface IAsyncDataTreeNode<TInput, T> {
element: TInput | T;
@ -261,7 +262,7 @@ function dfs<TInput, T>(node: IAsyncDataTreeNode<TInput, T>, fn: (node: IAsyncDa
node.children.forEach(child => dfs(child, fn));
}
export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable {
export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable, IThemable {
protected readonly tree: ObjectTree<IAsyncDataTreeNode<TInput, T>, TFilterData>;
protected readonly root: IAsyncDataTreeNode<TInput, T>;

View file

@ -22,7 +22,6 @@ export class Cache<T> {
const cts = new CancellationTokenSource();
const promise = this.task(cts.token);
promise.finally(() => cts.dispose());
this.result = {
promise,

View file

@ -399,6 +399,23 @@ export class Color {
return new Color(new RGBA(r, g, b, a));
}
makeOpaque(opaqueBackground: Color): Color {
if (this.isOpaque() || opaqueBackground.rgba.a !== 1) {
// only allow to blend onto a non-opaque color onto a opaque color
return this;
}
const { r, g, b, a } = this.rgba;
// https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity
return new Color(new RGBA(
opaqueBackground.rgba.r - a * (opaqueBackground.rgba.r - r),
opaqueBackground.rgba.g - a * (opaqueBackground.rgba.g - g),
opaqueBackground.rgba.b - a * (opaqueBackground.rgba.b - b),
1
));
}
flatten(...backgrounds: Color[]): Color {
const background = backgrounds.reduceRight((accumulator, color) => {
return Color._flatten(color, accumulator);

View file

@ -3,7 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'sudo-prompt' {
import { Color } from 'vs/base/common/color';
export function exec(cmd: string, options: { name?: string, icns?: string }, callback: (error: string, stdout: string, stderr: string) => void): void;
}
export type styleFn = (colors: { [name: string]: Color | undefined }) => void;
export interface IThemable {
style: styleFn;
}

View file

@ -267,10 +267,10 @@ export class URI implements UriComponents {
}
return new _URI(
match[2] || _empty,
decodeURIComponent(match[4] || _empty),
decodeURIComponent(match[5] || _empty),
decodeURIComponent(match[7] || _empty),
decodeURIComponent(match[9] || _empty),
percentDecode(match[4] || _empty),
percentDecode(match[5] || _empty),
percentDecode(match[7] || _empty),
percentDecode(match[9] || _empty),
_strict
);
}
@ -648,3 +648,26 @@ function _asFormatted(uri: URI, skipEncoding: boolean): string {
}
return res;
}
// --- decode
function decodeURIComponentGraceful(str: string): string {
try {
return decodeURIComponent(str);
} catch {
if (str.length > 3) {
return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));
} else {
return str;
}
}
}
const _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
function percentDecode(str: string): string {
if (!str.match(_rEncodedAsHex)) {
return str;
}
return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));
}

View file

@ -19,13 +19,14 @@ import { OS } from 'vs/base/common/platform';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { IItemAccessor } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { coalesce } from 'vs/base/common/arrays';
import { IMatch } from 'vs/base/common/filters';
export interface IContext {
event: any;
quickNavigateConfiguration: IQuickNavigateConfiguration;
}
export interface IHighlight {
export interface IHighlight extends IMatch {
start: number;
end: number;
}
@ -461,7 +462,7 @@ class Renderer implements IRenderer<QuickOpenEntry> {
options.title = entry.getTooltip();
options.descriptionTitle = entry.getDescriptionTooltip() || entry.getDescription(); // tooltip over description because it could overflow
options.descriptionMatches = descriptionHighlights || [];
data.label.setLabel(types.withNullAsUndefined(entry.getLabel()), entry.getDescription(), options);
data.label.setLabel(entry.getLabel() || '', entry.getDescription(), options);
// Meta
data.detail.set(entry.getDetail(), detailHighlights);

View file

@ -23,6 +23,7 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
import { StandardMouseEvent, IMouseEvent } from 'vs/base/browser/mouseEvent';
import { IThemable } from 'vs/base/common/styler';
export interface IQuickOpenCallbacks {
onOk: () => void;
@ -92,7 +93,7 @@ const defaultStyles = {
const DEFAULT_INPUT_ARIA_LABEL = nls.localize('quickOpenAriaLabel', "Quick picker. Type to narrow down results.");
export class QuickOpenWidget extends Disposable implements IModelProvider {
export class QuickOpenWidget extends Disposable implements IModelProvider, IThemable {
private static readonly MAX_WIDTH = 600; // Max total width of quick open widget
private static readonly MAX_ITEMS_HEIGHT = 20 * 22; // Max height of item list below input field
@ -134,7 +135,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
private styles: IQuickOpenStyles;
// @ts-ignore (legacy widget - to be replaced with quick input)
private renderer: Renderer;
private keyDownSeenSinceShown = false;
constructor(container: HTMLElement, callbacks: IQuickOpenCallbacks, options: IQuickOpenOptions) {
super();
@ -171,7 +171,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
this._register(DOM.addDisposableListener(this.element, DOM.EventType.FOCUS, e => this.gainingFocus(), true));
this._register(DOM.addDisposableListener(this.element, DOM.EventType.BLUR, e => this.loosingFocus(e), true));
this._register(DOM.addDisposableListener(this.element, DOM.EventType.KEY_DOWN, e => {
this.keyDownSeenSinceShown = true;
const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
if (keyboardEvent.keyCode === KeyCode.Escape) {
DOM.EventHelper.stop(e, true);
@ -222,7 +221,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
this._register(DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.INPUT, (e: Event) => this.onType()));
this._register(DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this.keyDownSeenSinceShown = true;
const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
const shouldOpenInBackground = this.shouldOpenInBackground(keyboardEvent);
@ -303,7 +301,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
}));
this._register(DOM.addDisposableListener(this.treeContainer, DOM.EventType.KEY_DOWN, e => {
this.keyDownSeenSinceShown = true;
const keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
// Only handle when in quick navigation mode
@ -317,6 +314,16 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
this.navigateInTree(keyboardEvent.keyCode);
}
// Support to open item with Enter still even in quick nav mode
else if (keyboardEvent.keyCode === KeyCode.Enter) {
DOM.EventHelper.stop(e, true);
const focus = this.tree.getFocus();
if (focus) {
this.elementSelected(focus, e);
}
}
}));
this._register(DOM.addDisposableListener(this.treeContainer, DOM.EventType.KEY_UP, e => {
@ -324,13 +331,13 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
const keyCode = keyboardEvent.keyCode;
// Only handle when in quick navigation mode
if (!this.quickNavigateConfiguration || !this.keyDownSeenSinceShown) {
if (!this.quickNavigateConfiguration) {
return;
}
// Select element when keys are pressed that signal it
const quickNavKeys = this.quickNavigateConfiguration.keybindings;
const wasTriggerKeyPressed = keyCode === KeyCode.Enter || quickNavKeys.some(k => {
const wasTriggerKeyPressed = quickNavKeys.some(k => {
const [firstPart, chordPart] = k.getParts();
if (chordPart) {
return false;
@ -599,7 +606,6 @@ export class QuickOpenWidget extends Disposable implements IModelProvider {
this.visible = true;
this.isLoosingFocus = false;
this.quickNavigateConfiguration = options ? options.quickNavigateConfiguration : undefined;
this.keyDownSeenSinceShown = false;
// Adjust UI for quick navigate mode
if (this.quickNavigateConfiguration) {

View file

@ -439,6 +439,10 @@ suite('URI', () => {
assert.equal(uri.path, uri2.path);
});
test('Unable to open \'%A0.txt\': URI malformed #76506', function () {
assert.equal(URI.parse('file://some/%.txt'), 'file://some/%25.txt');
assert.equal(URI.parse('file://some/%A0.txt'), 'file://some/%25A0.txt');
});
test('Links in markdown are broken if url contains encoded parameters #79474', function () {
this.skip();

View file

@ -11,6 +11,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { request } from 'vs/base/parts/request/browser/request';
import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/windows/common/windows';
import { isEqual } from 'vs/base/common/resources';
import { isStandalone } from 'vs/base/browser/browser';
interface ICredential {
service: string;
@ -222,7 +223,7 @@ class WorkspaceProvider implements IWorkspaceProvider {
if (options?.reuse) {
window.location.href = targetHref;
} else {
if (this.isRunningInPWA()) { // TODO@ben figure out why browser.isStandalone would not work?
if (isStandalone) {
window.open(targetHref, '_blank', 'toolbar=no'); // ensures to open another 'standalone' window!
} else {
window.open(targetHref);
@ -231,10 +232,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
}
}
private isRunningInPWA(): boolean {
return (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);
}
private createTargetUrl(workspace: IWorkspace, options?: { reuse?: boolean, payload?: object }): string | undefined {
// Empty

View file

@ -16,7 +16,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IConstructorSignature1, ServicesAccessor as InstantiationServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IConstructorSignature1, ServicesAccessor as InstantiationServicesAccessor, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindings, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@ -303,7 +303,7 @@ export function registerInstantiatedEditorAction(editorAction: EditorAction): vo
EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);
}
export function registerEditorContribution(id: string, ctor: IEditorContributionCtor): void {
export function registerEditorContribution<Services extends BrandedService[]>(id: string, ctor: { new(editor: ICodeEditor, ...services: Services): IEditorContribution }): void {
EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor);
}
@ -355,7 +355,7 @@ class EditorContributionRegistry {
this.editorCommands = Object.create(null);
}
public registerEditorContribution(id: string, ctor: IEditorContributionCtor): void {
public registerEditorContribution<Services extends BrandedService[]>(id: string, ctor: { new(editor: ICodeEditor, ...services: Services): IEditorContribution }): void {
this.editorContributions.push({ id, ctor });
}

View file

@ -30,10 +30,17 @@ const defaultOptions: Options = {
alwaysRevealFirst: true
};
export interface IDiffNavigator {
canNavigate(): boolean;
next(): void;
previous(): void;
dispose(): void;
}
/**
* Create a new diff navigator for the provided diff editor.
*/
export class DiffNavigator extends Disposable {
export class DiffNavigator extends Disposable implements IDiffNavigator {
private readonly _editor: IDiffEditor;
private readonly _options: Options;

View file

@ -186,8 +186,8 @@ export interface IEditorOptions {
*/
fontLigatures?: boolean | string;
/**
* Disable the use of `will-change` for the editor margin and lines layers.
* The usage of `will-change` acts as a hint for browsers to create an extra layer.
* Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.
* The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.
* Defaults to false.
*/
disableLayerHinting?: boolean;

View file

@ -66,7 +66,7 @@ export function getCodeActions(
const filter = trigger.filter || {};
const codeActionContext: CodeActionContext = {
only: filter.kind?.value,
only: filter.include?.value,
trigger: trigger.type === 'manual' ? CodeActionTriggerKind.Manual : CodeActionTriggerKind.Automatic
};
@ -146,7 +146,7 @@ registerLanguageCommand('_executeCodeActionProvider', async function (accessor,
const codeActionSet = await getCodeActions(
model,
validatedRangeOrSelection,
{ type: 'manual', filter: { includeSourceActions: true, kind: kind && kind.value ? new CodeActionKind(kind.value) : undefined } },
{ type: 'manual', filter: { includeSourceActions: true, include: kind && kind.value ? new CodeActionKind(kind.value) : undefined } },
CancellationToken.None);
setTimeout(() => codeActionSet.dispose(), 100);

View file

@ -240,7 +240,7 @@ export class CodeActionCommand extends EditorCommand {
? nls.localize('editor.action.codeAction.noneMessage.preferred', "No preferred code actions available")
: nls.localize('editor.action.codeAction.noneMessage', "No code actions available"),
{
kind: args.kind,
include: args.kind,
includeSourceActions: true,
onlyIncludePreferredActions: args.preferred,
},
@ -293,7 +293,7 @@ export class RefactorAction extends EditorAction {
? nls.localize('editor.action.refactor.noneMessage.preferred', "No preferred refactorings available")
: nls.localize('editor.action.refactor.noneMessage', "No refactorings available"),
{
kind: CodeActionKind.Refactor.contains(args.kind) ? args.kind : CodeActionKind.None,
include: CodeActionKind.Refactor.contains(args.kind) ? args.kind : CodeActionKind.None,
onlyIncludePreferredActions: args.preferred,
},
args.apply);
@ -336,7 +336,7 @@ export class SourceAction extends EditorAction {
? nls.localize('editor.action.source.noneMessage.preferred', "No preferred source actions available")
: nls.localize('editor.action.source.noneMessage', "No source actions available"),
{
kind: CodeActionKind.Source.contains(args.kind) ? args.kind : CodeActionKind.None,
include: CodeActionKind.Source.contains(args.kind) ? args.kind : CodeActionKind.None,
includeSourceActions: true,
onlyIncludePreferredActions: args.preferred,
},
@ -365,7 +365,7 @@ export class OrganizeImportsAction extends EditorAction {
public run(_accessor: ServicesAccessor, editor: ICodeEditor): void {
return triggerCodeActionsForEditorSelection(editor,
nls.localize('editor.action.organize.noneMessage', "No organize imports action available"),
{ kind: CodeActionKind.SourceOrganizeImports, includeSourceActions: true },
{ include: CodeActionKind.SourceOrganizeImports, includeSourceActions: true },
CodeActionAutoApply.IfSingle);
}
}
@ -386,7 +386,7 @@ export class FixAllAction extends EditorAction {
public run(_accessor: ServicesAccessor, editor: ICodeEditor): void {
return triggerCodeActionsForEditorSelection(editor,
nls.localize('fixAll.noneMessage', "No fix all action available"),
{ kind: CodeActionKind.SourceFixAll, includeSourceActions: true },
{ include: CodeActionKind.SourceFixAll, includeSourceActions: true },
CodeActionAutoApply.IfSingle);
}
}
@ -418,7 +418,7 @@ export class AutoFixAction extends EditorAction {
return triggerCodeActionsForEditorSelection(editor,
nls.localize('editor.action.autoFix.noneMessage', "No auto fixes available"),
{
kind: CodeActionKind.QuickFix,
include: CodeActionKind.QuickFix,
onlyIncludePreferredActions: true
},
CodeActionAutoApply.IfSingle);

View file

@ -75,7 +75,7 @@ export class CodeActionUi extends Disposable {
}
if (newState.trigger.type === 'manual') {
if (newState.trigger.filter && newState.trigger.filter.kind) {
if (newState.trigger.filter && newState.trigger.filter.include) {
// Triggered for specific scope
if (actions.actions.length > 0) {
// Apply if we only have one action or requested autoApply

View file

@ -54,7 +54,9 @@ export class CodeActionWidget extends Disposable {
) {
super();
this._keybindingResolver = new CodeActionKeybindingResolver(keybindingService);
this._keybindingResolver = new CodeActionKeybindingResolver({
getKeybindings: () => keybindingService.getKeybindings()
});
}
get isVisible(): boolean {

View file

@ -140,20 +140,20 @@ suite('CodeAction', () => {
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
{
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { kind: new CodeActionKind('a') } }, CancellationToken.None);
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a') } }, CancellationToken.None);
assert.equal(actions.length, 2);
assert.strictEqual(actions[0].title, 'a');
assert.strictEqual(actions[1].title, 'a.b');
}
{
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { kind: new CodeActionKind('a.b') } }, CancellationToken.None);
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a.b') } }, CancellationToken.None);
assert.equal(actions.length, 1);
assert.strictEqual(actions[0].title, 'a.b');
}
{
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { kind: new CodeActionKind('a.b.c') } }, CancellationToken.None);
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a.b.c') } }, CancellationToken.None);
assert.equal(actions.length, 0);
}
});
@ -172,7 +172,7 @@ suite('CodeAction', () => {
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { kind: new CodeActionKind('a') } }, CancellationToken.None);
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: new CodeActionKind('a') } }, CancellationToken.None);
assert.equal(actions.length, 1);
assert.strictEqual(actions[0].title, 'a');
});
@ -192,12 +192,34 @@ suite('CodeAction', () => {
}
{
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { kind: CodeActionKind.Source, includeSourceActions: true } }, CancellationToken.None);
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), { type: 'auto', filter: { include: CodeActionKind.Source, includeSourceActions: true } }, CancellationToken.None);
assert.equal(actions.length, 1);
assert.strictEqual(actions[0].title, 'a');
}
});
test('getCodeActions should support filtering out some requested source code actions #84602', async function () {
const provider = staticCodeActionProvider(
{ title: 'a', kind: CodeActionKind.Source.value },
{ title: 'b', kind: CodeActionKind.Source.append('test').value },
{ title: 'c', kind: 'c' }
);
disposables.add(modes.CodeActionProviderRegistry.register('fooLang', provider));
{
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), {
type: 'auto', filter: {
include: CodeActionKind.Source.append('test'),
excludes: [CodeActionKind.Source],
includeSourceActions: true,
}
}, CancellationToken.None);
assert.equal(actions.length, 1);
assert.strictEqual(actions[0].title, 'b');
}
});
test('getCodeActions should not invoke code action providers filtered out by providedCodeActionKinds', async function () {
let wasInvoked = false;
const provider = new class implements modes.CodeActionProvider {
@ -214,7 +236,7 @@ suite('CodeAction', () => {
const { actions } = await getCodeActions(model, new Range(1, 1, 2, 1), {
type: 'auto',
filter: {
kind: CodeActionKind.QuickFix
include: CodeActionKind.QuickFix
}
}, CancellationToken.None);
assert.strictEqual(actions.length, 0);

View file

@ -46,19 +46,20 @@ export const enum CodeActionAutoApply {
}
export interface CodeActionFilter {
readonly kind?: CodeActionKind;
readonly include?: CodeActionKind;
readonly excludes?: readonly CodeActionKind[];
readonly includeSourceActions?: boolean;
readonly onlyIncludePreferredActions?: boolean;
}
export function mayIncludeActionsOfKind(filter: CodeActionFilter, providedKind: CodeActionKind): boolean {
// A provided kind may be a subset or superset of our filtered kind.
if (filter.kind && !filter.kind.intersects(providedKind)) {
if (filter.include && !filter.include.intersects(providedKind)) {
return false;
}
// Don't return source actions unless they are explicitly requested
if (CodeActionKind.Source.contains(providedKind) && !filter.includeSourceActions) {
if (!filter.includeSourceActions && CodeActionKind.Source.contains(providedKind)) {
return false;
}
@ -69,8 +70,17 @@ export function filtersAction(filter: CodeActionFilter, action: CodeAction): boo
const actionKind = action.kind ? new CodeActionKind(action.kind) : undefined;
// Filter out actions by kind
if (filter.kind) {
if (!actionKind || !filter.kind.contains(actionKind)) {
if (filter.include) {
if (!actionKind || !filter.include.contains(actionKind)) {
return false;
}
}
if (filter.excludes) {
if (actionKind && filter.excludes.some(exclude => {
// Excludes are overwritten by includes
return exclude.contains(actionKind) && (!filter.include || !filter.include.contains(actionKind));
})) {
return false;
}
}

View file

@ -5,7 +5,6 @@
import 'vs/css!./codelensWidget';
import * as dom from 'vs/base/browser/dom';
import { coalesce, isFalsyOrEmpty } from 'vs/base/common/arrays';
import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { Range } from 'vs/editor/common/core/range';
@ -66,7 +65,7 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
constructor(
editor: editorBrowser.ICodeEditor,
symbolRange: Range,
data: CodeLensItem[]
lenses: Array<CodeLens | undefined | null>
) {
this._id = 'codeLensWidget' + (++CodeLensContentWidget._idPool);
this._editor = editor;
@ -74,10 +73,9 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
this.setSymbolRange(symbolRange);
this._domNode = document.createElement('span');
this._domNode.innerHTML = '&nbsp;';
dom.addClass(this._domNode, 'codelens-decoration');
this._domNode.className = 'codelens-decoration';
this.updateHeight();
this.withCommands(data.map(data => data.symbol), false);
this.withCommands(lenses, false);
}
updateHeight(): void {
@ -88,39 +86,45 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
this._domNode.style.lineHeight = `${lineHeight}px`;
this._domNode.style.fontSize = `${Math.round(fontInfo.fontSize * 0.9)}px`;
this._domNode.style.paddingRight = `${Math.round(fontInfo.fontSize * 0.45)}px`;
this._domNode.innerHTML = '&nbsp;';
}
withCommands(inSymbols: Array<CodeLens | undefined | null>, animate: boolean): void {
withCommands(lenses: Array<CodeLens | undefined | null>, animate: boolean): void {
this._commands.clear();
const symbols = coalesce(inSymbols);
if (isFalsyOrEmpty(symbols)) {
this._domNode.innerHTML = '<span>no commands</span>';
return;
}
let html: string[] = [];
for (let i = 0; i < symbols.length; i++) {
const command = symbols[i].command;
if (command) {
const title = renderCodicons(command.title);
let part: string;
if (command.id) {
part = `<a id=${i}>${title}</a>`;
this._commands.set(String(i), command);
let innerHtml = '';
let hasSymbol = false;
for (let i = 0; i < lenses.length; i++) {
const lens = lenses[i];
if (!lens) {
continue;
}
hasSymbol = true;
if (lens.command) {
const title = renderCodicons(lens.command.title);
if (lens.command.id) {
innerHtml += `<a id=${i}>${title}</a>`;
this._commands.set(String(i), lens.command);
} else {
part = `<span>${title}</span>`;
innerHtml += `<span>${title}</span>`;
}
if (i + 1 < lenses.length) {
innerHtml += '<span>&nbsp;|&nbsp;</span>';
}
html.push(part);
}
}
const wasEmpty = this._domNode.innerHTML === '' || this._domNode.innerHTML === '&nbsp;';
this._domNode.innerHTML = html.join('<span>&nbsp;|&nbsp;</span>');
this._editor.layoutContentWidget(this);
if (wasEmpty && animate) {
dom.addClass(this._domNode, 'fadein');
if (!hasSymbol) {
// symbols but no commands
this._domNode.innerHTML = '<span>no commands</span>';
} else {
// symbols and commands
const wasEmpty = this._domNode.innerHTML === '' || this._domNode.innerHTML === '&nbsp;';
this._domNode.innerHTML = innerHtml || '&nbsp;';
this._editor.layoutContentWidget(this);
if (wasEmpty && animate) {
dom.addClass(this._domNode, 'fadein');
}
}
}
@ -213,8 +217,11 @@ export class CodeLensWidget {
this._decorationIds = new Array<string>(this._data.length);
let range: Range | undefined;
let lenses: CodeLens[] = [];
this._data.forEach((codeLensData, i) => {
lenses.push(codeLensData.symbol);
helper.addDecoration({
range: codeLensData.symbol.range,
options: ModelDecorationOptions.EMPTY
@ -229,7 +236,7 @@ export class CodeLensWidget {
});
if (range) {
this._contentWidget = new CodeLensContentWidget(editor, range, this._data);
this._contentWidget = new CodeLensContentWidget(editor, range, lenses);
this._viewZone = new CodeLensViewZone(range.startLineNumber - 1, updateCallback);
this._viewZoneId = viewZoneChangeAccessor.addZone(this._viewZone);

View file

@ -586,7 +586,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
return getCodeActions(
this._editor.getModel()!,
new Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn),
{ type: 'manual', filter: { kind: CodeActionKind.QuickFix } },
{ type: 'manual', filter: { include: CodeActionKind.QuickFix } },
cancellationToken);
});
}

View file

@ -13,12 +13,12 @@
.monaco-editor .parameter-hints-widget > .wrapper {
max-width: 440px;
display: flex;
flex-direction: column;
flex-direction: row;
}
.monaco-editor .parameter-hints-widget.multiple {
min-height: 3.3em;
padding: 0 0 0 1.9em;
padding: 0;
}
.monaco-editor .parameter-hints-widget.visible {
@ -62,20 +62,19 @@
padding: 0 0.4em;
}
.monaco-editor .parameter-hints-widget .buttons {
position: absolute;
.monaco-editor .parameter-hints-widget .controls {
display: none;
bottom: 0;
left: 0;
flex-direction: column;
align-items: center;
min-width: 22px;
justify-content: flex-end;
}
.monaco-editor .parameter-hints-widget.multiple .buttons {
display: block;
.monaco-editor .parameter-hints-widget.multiple .controls {
display: flex;
}
.monaco-editor .parameter-hints-widget.multiple .button {
position: absolute;
left: 2px;
width: 16px;
height: 16px;
background-repeat: no-repeat;
@ -88,26 +87,16 @@
}
.monaco-editor .parameter-hints-widget .button.next {
bottom: 0;
background-image: url('arrow-down.svg');
}
.monaco-editor .parameter-hints-widget .overloads {
position: absolute;
display: none;
text-align: center;
bottom: 14px;
left: 0;
width: 22px;
height: 12px;
line-height: 12px;
opacity: 0.5;
}
.monaco-editor .parameter-hints-widget.multiple .overloads {
display: block;
}
.monaco-editor .parameter-hints-widget .signature .parameter.active {
font-weight: bold;
text-decoration: underline;

View file

@ -22,6 +22,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel';
import { pad } from 'vs/base/common/strings';
const $ = dom.$;
@ -76,9 +77,10 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
const wrapper = dom.append(element, $('.wrapper'));
wrapper.tabIndex = -1;
const buttons = dom.append(wrapper, $('.buttons'));
const previous = dom.append(buttons, $('.button.previous'));
const next = dom.append(buttons, $('.button.next'));
const controls = dom.append(wrapper, $('.controls'));
const previous = dom.append(controls, $('.button.previous'));
const overloads = dom.append(controls, $('.overloads'));
const next = dom.append(controls, $('.button.next'));
const onPreviousClick = stop(domEvent(previous, 'click'));
this._register(onPreviousClick(this.previous, this));
@ -86,8 +88,6 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
const onNextClick = stop(domEvent(next, 'click'));
this._register(onNextClick(this.next, this));
const overloads = dom.append(wrapper, $('.overloads'));
const body = $('.body');
const scrollbar = new DomScrollableElement(body, {});
this._register(scrollbar);
@ -239,12 +239,8 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
dom.toggleClass(this.domNodes.signature, 'has-docs', hasDocs);
dom.toggleClass(this.domNodes.docs, 'empty', !hasDocs);
let currentOverload = String(hints.activeSignature + 1);
if (hints.signatures.length < 10) {
currentOverload += `/${hints.signatures.length}`;
}
this.domNodes.overloads.textContent = currentOverload;
this.domNodes.overloads.textContent =
pad(hints.activeSignature + 1, hints.signatures.length.toString().length) + '/' + hints.signatures.length;
if (activeParameter) {
const labelToAnnounce = this.getParameterLabel(signature, hints.activeParameter);

View file

@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { OpenerService } from 'vs/editor/browser/services/openerService';
import { DiffNavigator } from 'vs/editor/browser/widget/diffNavigator';
import { DiffNavigator, IDiffNavigator } from 'vs/editor/browser/widget/diffNavigator';
import { ConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
import { Token } from 'vs/editor/common/core/token';
@ -127,13 +127,6 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
});
}
export interface IDiffNavigator {
canNavigate(): boolean;
next(): void;
previous(): void;
dispose(): void;
}
export interface IDiffNavigatorOptions {
readonly followsCaret?: boolean;
readonly ignoreCharChanges?: boolean;

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

@ -802,6 +802,12 @@ declare namespace monaco {
declare namespace monaco.editor {
export interface IDiffNavigator {
canNavigate(): boolean;
next(): void;
previous(): void;
dispose(): void;
}
/**
* Create a new editor under `domElement`.
@ -824,13 +830,6 @@ declare namespace monaco.editor {
*/
export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
export interface IDiffNavigator {
canNavigate(): boolean;
next(): void;
previous(): void;
dispose(): void;
}
export interface IDiffNavigatorOptions {
readonly followsCaret?: boolean;
readonly ignoreCharChanges?: boolean;
@ -2598,8 +2597,8 @@ declare namespace monaco.editor {
*/
fontLigatures?: boolean | string;
/**
* Disable the use of `will-change` for the editor margin and lines layers.
* The usage of `will-change` acts as a hint for browsers to create an extra layer.
* Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.
* The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.
* Defaults to false.
*/
disableLayerHinting?: boolean;

View file

@ -8,9 +8,9 @@ import { Event, Emitter } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
export const enum AuthTokenStatus {
Disabled = 'Disabled',
Inactive = 'Inactive',
Active = 'Active'
Active = 'Active',
SigningIn = 'SigningIn'
}
export const IAuthTokenService = createDecorator<IAuthTokenService>('IAuthTokenService');

View file

@ -9,8 +9,6 @@ import { Event, Emitter } from 'vs/base/common/event';
import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth';
import { ICredentialsService } from 'vs/platform/credentials/common/credentials';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IProductService } from 'vs/platform/product/common/productService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { URI } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { shell } from 'electron';
@ -51,7 +49,7 @@ export interface IToken {
export class AuthTokenService extends Disposable implements IAuthTokenService {
_serviceBrand: undefined;
private _status: AuthTokenStatus = AuthTokenStatus.Disabled;
private _status: AuthTokenStatus = AuthTokenStatus.Inactive;
get status(): AuthTokenStatus { return this._status; }
private _onDidChangeStatus: Emitter<AuthTokenStatus> = this._register(new Emitter<AuthTokenStatus>());
readonly onDidChangeStatus: Event<AuthTokenStatus> = this._onDidChangeStatus.event;
@ -63,22 +61,17 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
constructor(
@ICredentialsService private readonly credentialsService: ICredentialsService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
) {
super();
if (productService.settingsSyncStoreUrl && configurationService.getValue('configurationSync.enableAuth')) {
this.credentialsService.getPassword(SERVICE_NAME, ACCOUNT).then(storedRefreshToken => {
if (storedRefreshToken) {
this.refresh(storedRefreshToken);
} else {
this._status = AuthTokenStatus.Inactive;
}
});
}
this.credentialsService.getPassword(SERVICE_NAME, ACCOUNT).then(storedRefreshToken => {
if (storedRefreshToken) {
this.refresh(storedRefreshToken);
}
});
}
public async login(callbackUri: URI): Promise<void> {
this.setStatus(AuthTokenStatus.SigningIn);
const nonce = generateUuid();
const port = (callbackUri.authority.match(/:([0-9]*)$/) || [])[1] || (callbackUri.scheme === 'https' || callbackUri.scheme === 'http' ? 443 : 80);
const state = `${callbackUri.scheme},${port},${encodeURIComponent(nonce)},${encodeURIComponent(callbackUri.query)}`;
@ -96,6 +89,7 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
const timeoutPromise = new Promise((resolve: (value: IToken) => void, reject) => {
const wait = setTimeout(() => {
this.setStatus(AuthTokenStatus.Inactive);
clearTimeout(wait);
reject('Login timed out.');
}, 1000 * 60 * 5);
@ -107,17 +101,10 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
}
public getToken(): Promise<string | undefined> {
if (this.status === AuthTokenStatus.Disabled) {
throw new Error('Not enabled');
}
return Promise.resolve(this._activeToken?.accessToken);
}
public async refreshToken(): Promise<void> {
if (this.status === AuthTokenStatus.Disabled) {
throw new Error('Not enabled');
}
if (!this._activeToken) {
throw new Error('No token to refresh');
}
@ -247,9 +234,6 @@ export class AuthTokenService extends Disposable implements IAuthTokenService {
}
async logout(): Promise<void> {
if (this.status === AuthTokenStatus.Disabled) {
throw new Error('Not enabled');
}
await this.credentialsService.deletePassword(SERVICE_NAME, ACCOUNT);
this._activeToken = undefined;
this.setStatus(AuthTokenStatus.Inactive);

View file

@ -7,11 +7,11 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IContextMenuDelegate } from 'vs/base/browser/contextmenu';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { AnchorAlignment, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
export const IContextViewService = createDecorator<IContextViewService>('contextViewService');
export interface IContextViewService {
export interface IContextViewService extends IContextViewProvider {
_serviceBrand: undefined;
@ -41,4 +41,4 @@ export interface IContextMenuService {
showContextMenu(delegate: IContextMenuDelegate): void;
onDidContextMenu: Event<void>; // TODO@isidor these event should be removed once we get async context menus
}
}

View file

@ -141,7 +141,6 @@ export interface IOpenDialogOptions {
availableFileSystems?: readonly string[];
}
export const IDialogService = createDecorator<IDialogService>('dialogService');
export interface IDialogOptions {
@ -240,12 +239,23 @@ export interface IFileDialogService {
*/
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
/**
* Shows a confirm dialog for saving 1-N files.
*/
showSaveConfirm(fileNameOrResources: string | URI[]): Promise<ConfirmResult>;
/**
* Shows a open file dialog and returns the chosen file URI.
*/
showOpenDialog(options: IOpenDialogOptions): Promise<URI[] | undefined>;
}
export const enum ConfirmResult {
SAVE,
DONT_SAVE,
CANCEL
}
const MAX_CONFIRM_FILES = 10;
export function getConfirmMessage(start: string, resourcesToConfirm: readonly URI[]): string {
const message = [start];

View file

@ -5,6 +5,7 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { URI } from 'vs/base/common/uri';
import { IUserHomeProvider } from 'vs/base/common/labels';
export interface ParsedArgs {
_: string[];
@ -84,6 +85,7 @@ export interface ParsedArgs {
'js-flags'?: string;
'disable-gpu'?: boolean;
'nolazy'?: boolean;
'force-device-scale-factor'?: string;
}
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');
@ -99,7 +101,7 @@ export interface IExtensionHostDebugParams extends IDebugParams {
export const BACKUPS = 'Backups';
export interface IEnvironmentService {
export interface IEnvironmentService extends IUserHomeProvider {
_serviceBrand: undefined;

View file

@ -117,6 +117,7 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
'inspect': { type: 'string' },
'inspect-brk': { type: 'string' },
'nolazy': { type: 'boolean' }, // node inspect
'force-device-scale-factor': { type: 'string' },
'_urls': { type: 'string[]' },
_: { type: 'string[]' } // main arguments

View file

@ -362,7 +362,7 @@ export class FileService extends Disposable implements IFileService {
// mtime and etag, we bail out to prevent dirty writing.
//
// First, we check for a mtime that is in the future before we do more checks. The assumption is
// that only the mtime is an indicator for a file that has changd on disk.
// that only the mtime is an indicator for a file that has changed on disk.
//
// Second, if the mtime has advanced, we compare the size of the file on disk with our previous
// one using the etag() function. Relying only on the mtime check has prooven to produce false

View file

@ -134,7 +134,7 @@ suite('Disk File Service', function () {
// we see random test failures when accessing the native file system. To
// diagnose further, we retry node.js file access tests up to 3 times to
// rule out any random disk issue.
// this.retries(3);
this.retries(3);
setup(async () => {
const logService = new NullLogService();

View file

@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import { SyncDescriptor } from './descriptors';
import { ServiceIdentifier, IConstructorSignature0 } from './instantiation';
import { ServiceIdentifier, BrandedService } from './instantiation';
const _registry: [ServiceIdentifier<any>, SyncDescriptor<any>][] = [];
export function registerSingleton<T>(id: ServiceIdentifier<T>, ctor: IConstructorSignature0<T>, supportsDelayedInstantiation?: boolean): void {
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: { new(...services: Services): T }, supportsDelayedInstantiation?: boolean): void {
_registry.push([id, new SyncDescriptor<T>(ctor, [], supportsDelayedInstantiation)]);
}

View file

@ -22,7 +22,7 @@ export namespace _util {
// --- interfaces ------
type BrandedService = { _serviceBrand: undefined };
export type BrandedService = { _serviceBrand: undefined };
export interface IConstructorSignature0<T> {
new(...services: BrandedService[]): T;
@ -101,7 +101,8 @@ export interface IInstantiationService {
createInstance<A1, A2, A3, A4, A5, A6, A7, T>(descriptor: descriptors.SyncDescriptor7<A1, A2, A3, A4, A5, A6, A7, T>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7): T;
createInstance<A1, A2, A3, A4, A5, A6, A7, A8, T>(descriptor: descriptors.SyncDescriptor8<A1, A2, A3, A4, A5, A6, A7, A8, T>, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8): T;
createInstance<Ctor extends new (...args: any) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
createInstance<Services extends BrandedService[], Ctor extends new (...services: Services) => any, R extends InstanceType<Ctor>>(t: Ctor): R;
/**
*

View file

@ -8,17 +8,12 @@ import { focusBorder, inputBackground, inputForeground, ColorIdentifier, selectF
import { IDisposable } from 'vs/base/common/lifecycle';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
export type styleFn = (colors: { [name: string]: Color | undefined }) => void;
import { IThemable, styleFn } from 'vs/base/common/styler';
export interface IStyleOverrides {
[color: string]: ColorIdentifier | undefined;
}
export interface IThemable {
style: styleFn;
}
export interface IColorMapping {
[optionsKey: string]: ColorValue | undefined;
}

View file

@ -33,7 +33,7 @@ export function registerConfiguration(): IDisposable {
'configurationSync.enable': {
type: 'boolean',
description: localize('configurationSync.enable', "When enabled, synchronizes configuration that includes Settings and Extensions."),
default: true,
default: false,
scope: ConfigurationScope.APPLICATION
},
'configurationSync.enableSettings': {
@ -63,12 +63,6 @@ export function registerConfiguration(): IDisposable {
$ref: ignoredSettingsSchemaId,
additionalProperties: true,
uniqueItems: true
},
'configurationSync.enableAuth': {
'type': 'boolean',
description: localize('configurationSync.enableAuth', "Enables authentication and requires VS Code restart when changed"),
'default': false,
'scope': ConfigurationScope.APPLICATION
}
}
});

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IUserDataSyncService, SyncStatus, ISynchroniser, IUserDataSyncStoreService, SyncSource, IUserDataSyncLogService, UserDataSyncStoreError, UserDataSyncStoreErrorCode } from 'vs/platform/userDataSync/common/userDataSync';
import { IUserDataSyncService, SyncStatus, ISynchroniser, IUserDataSyncStoreService, SyncSource, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync';
import { Disposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { SettingsSynchroniser } from 'vs/platform/userDataSync/common/settingsSync';
@ -164,13 +164,6 @@ export class UserDataAutoSync extends Disposable {
try {
await this.userDataSyncService.sync();
} catch (e) {
if (e instanceof UserDataSyncStoreError && e.code === UserDataSyncStoreErrorCode.Unauthroized) {
if (e instanceof UserDataSyncStoreError && e.code === UserDataSyncStoreErrorCode.Unauthroized && this.authTokenService.status === AuthTokenStatus.Disabled) {
this.logService.error('Sync failed because the server requires authorization. Please enable authorization.');
} else {
this.logService.error(e);
}
}
this.logService.error(e);
}
if (loop) {

View file

@ -11,7 +11,7 @@ import { URI } from 'vs/base/common/uri';
import { joinPath } from 'vs/base/common/resources';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IHeaders, IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request';
import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth';
import { IAuthTokenService } from 'vs/platform/auth/common/auth';
export class UserDataSyncStoreService extends Disposable implements IUserDataSyncStoreService {
@ -87,21 +87,17 @@ export class UserDataSyncStoreService extends Disposable implements IUserDataSyn
}
private async request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
if (this.authTokenService.status !== AuthTokenStatus.Disabled) {
const authToken = await this.authTokenService.getToken();
if (!authToken) {
throw new Error('No Auth Token Available.');
}
options.headers = options.headers || {};
options.headers['authorization'] = `Bearer ${authToken}`;
const authToken = await this.authTokenService.getToken();
if (!authToken) {
throw new Error('No Auth Token Available.');
}
options.headers = options.headers || {};
options.headers['authorization'] = `Bearer ${authToken}`;
const context = await this.requestService.request(options, token);
if (context.res.statusCode === 401) {
if (this.authTokenService.status !== AuthTokenStatus.Disabled) {
this.authTokenService.refreshToken();
}
this.authTokenService.refreshToken();
// Throw Unauthorized Error
throw new UserDataSyncStoreError('Unauthorized', UserDataSyncStoreErrorCode.Unauthroized);
}

View file

@ -496,7 +496,8 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
// Remember in recent document list (unless this opens for extension development)
// Also do not add paths when files are opened for diffing, only if opened individually
if (!usedWindows.some(window => window.isExtensionDevelopmentHost) && !(fileInputs?.filesToDiff) && !openConfig.noRecentEntry) {
const isDiff = fileInputs && fileInputs.filesToDiff.length > 0;
if (!usedWindows.some(window => window.isExtensionDevelopmentHost) && !isDiff && !openConfig.noRecentEntry) {
const recents: IRecent[] = [];
for (let pathToOpen of pathsToOpen) {
if (pathToOpen.workspace) {

View file

@ -9,10 +9,11 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { TernarySearchTree } from 'vs/base/common/map';
import { Event } from 'vs/base/common/event';
import { IWorkspaceIdentifier, IStoredWorkspaceFolder, isRawFileWorkspaceFolder, isRawUriWorkspaceFolder, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IWorkspaceFolderProvider } from 'vs/base/common/labels';
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
export interface IWorkspaceContextService {
export interface IWorkspaceContextService extends IWorkspaceFolderProvider {
_serviceBrand: undefined;
/**

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

@ -2967,6 +2967,17 @@ declare module 'vscode' {
*/
appendPlaceholder(value: string | ((snippet: SnippetString) => any), number?: number): SnippetString;
/**
* Builder-function that appends a choice (`${1|a,b,c}`) to
* the [`value`](#SnippetString.value) of this snippet string.
*
* @param values The values for choices - the array of strings
* @param number The number of this tabstop, defaults to an auto-increment
* value starting at 1.
* @return This snippet string.
*/
appendChoice(values: string[], number?: number): SnippetString;
/**
* Builder-function that appends a variable (`${VAR}`) to
* the [`value`](#SnippetString.value) of this snippet string.
@ -5732,10 +5743,18 @@ declare module 'vscode' {
ctime: number;
/**
* The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
*
* *Note:* If the file changed, it is important to provide an updated `mtime` that advanced
* from the previous value. Otherwise there may be optimizations in place that will not show
* the updated file contents in an editor for example.
*/
mtime: number;
/**
* The size in bytes.
*
* *Note:* If the file changed, it is important to provide an updated `size`. Otherwise there
* may be optimizations in place that will not show the updated file contents in an editor for
* example.
*/
size: number;
}
@ -5849,6 +5868,11 @@ declare module 'vscode' {
* An event to signal that a resource has been created, changed, or deleted. This
* event should fire for resources that are being [watched](#FileSystemProvider.watch)
* by clients of this provider.
*
* *Note:* It is important that the metadata of the file that changed provides an
* updated `mtime` that advanced from the previous value in the [stat](#FileStat) and a
* correct `size` value. Otherwise there may be optimizations in place that will not show
* the change in an editor for example.
*/
readonly onDidChangeFile: Event<FileChangeEvent[]>;
@ -7487,6 +7511,9 @@ declare module 'vscode' {
* [Terminal.sendText](#Terminal.sendText) which sends text to the underlying _process_
* (the pty "slave"), this will write the text to the terminal itself (the pty "master").
*
* Note writing `\n` will just move the cursor down 1 row, you need to write `\r` as well
* to move the cursor to the left-most cell.
*
* **Example:** Write red text to the terminal
* ```typescript
* const writeEmitter = new vscode.EventEmitter<string>();

View file

@ -523,6 +523,27 @@ declare module 'vscode' {
//#region André: debug
/**
* A DebugSource is an opaque stand-in type for the [Source](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source) type defined in the Debug Adapter Protocol.
*/
export interface DebugSource {
// opaque contents
}
export namespace debug {
/**
* Converts a "Source" object received via the Debug Adapter Protocol into a Uri that can be used to load its contents.
*
* If the "Source" object has insufficient information to create a uri, an error is thrown.
*
* @param source An object conforming to the [Source](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source) type defined in the Debug Adapter Protocol.
* @param session An optional debug session that will be used to locate the Debug Adapter Protocol.
* @return A uri that can be used to load the contents of the source.
*/
export function asDebugSourceUri(source: DebugSource, session?: DebugSession): Uri;
}
// deprecated
export interface DebugConfigurationProvider {

View file

@ -282,6 +282,10 @@ class CodeActionOnSaveParticipant implements ISaveParticipant {
return undefined;
}
const excludedActions = Object.keys(setting)
.filter(x => setting[x] === false)
.map(x => new CodeActionKind(x));
const tokenSource = new CancellationTokenSource();
const timeout = this._configurationService.getValue<number>('editor.codeActionsOnSaveTimeout', settingsOverrides);
@ -292,15 +296,15 @@ class CodeActionOnSaveParticipant implements ISaveParticipant {
tokenSource.cancel();
reject(localize('codeActionsOnSave.didTimeout', "Aborted codeActionsOnSave after {0}ms", timeout));
}, timeout)),
this.applyOnSaveActions(model, codeActionsOnSave, tokenSource.token)
this.applyOnSaveActions(model, codeActionsOnSave, excludedActions, tokenSource.token)
]).finally(() => {
tokenSource.cancel();
});
}
private async applyOnSaveActions(model: ITextModel, codeActionsOnSave: CodeActionKind[], token: CancellationToken): Promise<void> {
private async applyOnSaveActions(model: ITextModel, codeActionsOnSave: readonly CodeActionKind[], excludes: readonly CodeActionKind[], token: CancellationToken): Promise<void> {
for (const codeActionKind of codeActionsOnSave) {
const actionsToRun = await this.getActionsToRun(model, codeActionKind, token);
const actionsToRun = await this.getActionsToRun(model, codeActionKind, excludes, token);
try {
await this.applyCodeActions(actionsToRun.actions);
} catch {
@ -317,10 +321,10 @@ class CodeActionOnSaveParticipant implements ISaveParticipant {
}
}
private getActionsToRun(model: ITextModel, codeActionKind: CodeActionKind, token: CancellationToken) {
private getActionsToRun(model: ITextModel, codeActionKind: CodeActionKind, excludes: readonly CodeActionKind[], token: CancellationToken) {
return getCodeActions(model, model.getFullModelRange(), {
type: 'auto',
filter: { kind: codeActionKind, includeSourceActions: true },
filter: { include: codeActionKind, excludes: excludes, includeSourceActions: true },
}, token);
}
}

View file

@ -12,6 +12,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import * as modes from 'vs/editor/common/modes';
import { localize } from 'vs/nls';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IProductService } from 'vs/platform/product/common/productService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@ -20,6 +21,7 @@ import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } fr
import { IEditorInput } from 'vs/workbench/common/editor';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { CustomFileEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput';
import { CustomEditorModel } from 'vs/workbench/contrib/customEditor/browser/customEditorModel';
import { WebviewExtensionDescription } from 'vs/workbench/contrib/webview/browser/webview';
import { WebviewInput } from 'vs/workbench/contrib/webview/browser/webviewEditorInput';
import { ICreateWebViewShowOptions, IWebviewWorkbenchService, WebviewInputOptions } from 'vs/workbench/contrib/webview/browser/webviewWorkbenchService';
@ -27,7 +29,6 @@ import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { extHostNamedCustomer } from '../common/extHostCustomers';
import { CustomEditorModel } from 'vs/workbench/contrib/customEditor/browser/customEditorModel';
/**
* Bi-directional map between webview handles and inputs.
@ -102,6 +103,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
@IExtensionService extensionService: IExtensionService,
@IEditorGroupsService private readonly _editorGroupService: IEditorGroupsService,
@IEditorService private readonly _editorService: IEditorService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IOpenerService private readonly _openerService: IOpenerService,
@IProductService private readonly _productService: IProductService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@ -271,7 +273,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
webviewInput.webview.options = options;
webviewInput.webview.extension = extension;
const model = new CustomEditorModel();
const model = this._instantiationService.createInstance(CustomEditorModel, webviewInput.getResource());
webviewInput.setModel(model);
this._models.set(handle, model);

View file

@ -105,7 +105,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostOutputService = rpcProtocol.set(ExtHostContext.ExtHostOutputService, accessor.get(IExtHostOutputService));
// manually create and register addressable instances
const extHostWebviews = rpcProtocol.set(ExtHostContext.ExtHostWebviews, new ExtHostWebviews(rpcProtocol, initData.environment, extHostWorkspace));
const extHostWebviews = rpcProtocol.set(ExtHostContext.ExtHostWebviews, new ExtHostWebviews(rpcProtocol, initData.environment, extHostWorkspace, extHostLogService));
const extHostUrls = rpcProtocol.set(ExtHostContext.ExtHostUrls, new ExtHostUrls(rpcProtocol));
const extHostDocuments = rpcProtocol.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(rpcProtocol, extHostDocumentsAndEditors));
const extHostDocumentContentProviders = rpcProtocol.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(rpcProtocol, extHostDocumentsAndEditors, extHostLogService));
@ -778,7 +778,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
if (!parentSessionOrOptions || (typeof parentSessionOrOptions === 'object' && 'configuration' in parentSessionOrOptions)) {
return extHostDebugService.startDebugging(folder, nameOrConfig, { parentSession: parentSessionOrOptions });
}
checkProposedApiEnabled(extension);
return extHostDebugService.startDebugging(folder, nameOrConfig, parentSessionOrOptions || {});
},
addBreakpoints(breakpoints: vscode.Breakpoint[]) {
@ -786,6 +785,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
removeBreakpoints(breakpoints: vscode.Breakpoint[]) {
return extHostDebugService.removeBreakpoints(breakpoints);
},
asDebugSourceUri(source: vscode.DebugSource, session?: vscode.DebugSession): vscode.Uri {
checkProposedApiEnabled(extension);
return extHostDebugService.asDebugSourceUri(source, session);
}
};

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConstructorSignature1 } from 'vs/platform/instantiation/common/instantiation';
import { IConstructorSignature1, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { ProxyIdentifier } from 'vs/workbench/services/extensions/common/proxyIdentifier';
@ -13,12 +13,12 @@ export type IExtHostNamedCustomer<T extends IDisposable> = [ProxyIdentifier<T>,
export type IExtHostCustomerCtor<T extends IDisposable> = IConstructorSignature1<IExtHostContext, T>;
export function extHostNamedCustomer<T extends IDisposable>(id: ProxyIdentifier<T>) {
return function (ctor: IExtHostCustomerCtor<T>): void {
return function <Services extends BrandedService[]>(ctor: { new(context: IExtHostContext, ...services: Services): T }): void {
ExtHostCustomersRegistryImpl.INSTANCE.registerNamedCustomer(id, ctor);
};
}
export function extHostCustomer<T extends IDisposable>(ctor: IExtHostCustomerCtor<T>): void {
export function extHostCustomer<T extends IDisposable, Services extends BrandedService[]>(ctor: { new(context: IExtHostContext, ...services: Services): T }): void {
ExtHostCustomersRegistryImpl.INSTANCE.registerCustomer(ctor);
}

View file

@ -30,5 +30,6 @@ export interface IExtHostDebugService extends ExtHostDebugServiceShape {
registerDebugConfigurationProvider(type: string, provider: vscode.DebugConfigurationProvider): vscode.Disposable;
registerDebugAdapterDescriptorFactory(extension: IExtensionDescription, type: string, factory: vscode.DebugAdapterDescriptorFactory): vscode.Disposable;
registerDebugAdapterTrackerFactory(type: string, factory: vscode.DebugAdapterTrackerFactory): vscode.Disposable;
asDebugSourceUri(source: vscode.DebugSource, session?: vscode.DebugSession): vscode.Uri;
}

View file

@ -180,8 +180,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
}
if (fn && typeof fn !== 'function') {
console.warn('Invalid SCM input box validation function');
return;
throw new Error(`[${this._extension.identifier.value}]: Invalid SCM input box validation function`);
}
this._validateInput = fn;

View file

@ -740,6 +740,18 @@ export class SnippetString {
return this;
}
appendChoice(values: string[], number: number = this._tabstop++): SnippetString {
const value = SnippetString._escape(values.toString());
this.value += '${';
this.value += number;
this.value += '|';
this.value += value;
this.value += '|}';
return this;
}
appendVariable(name: string, defaultValue?: string | ((snippet: SnippetString) => any)): SnippetString {
if (typeof defaultValue === 'function') {

View file

@ -5,10 +5,12 @@
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { assertIsDefined } from 'vs/base/common/types';
import { URI, UriComponents } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import * as modes from 'vs/editor/common/modes';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ILogService } from 'vs/platform/log/common/log';
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
@ -16,7 +18,6 @@ import { asWebviewUri, WebviewInitData } from 'vs/workbench/api/common/shared/we
import * as vscode from 'vscode';
import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewStateData } from './extHost.protocol';
import { Disposable as VSCodeDisposable } from './extHostTypes';
import { assertIsDefined } from 'vs/base/common/types';
type IconPath = URI | { light: URI, dark: URI };
@ -35,6 +36,7 @@ export class ExtHostWebview implements vscode.Webview {
private readonly _initData: WebviewInitData,
private readonly _workspace: IExtHostWorkspace | undefined,
private readonly _extension: IExtensionDescription,
private readonly _logService: ILogService,
) { }
public dispose() {
@ -63,7 +65,7 @@ export class ExtHostWebview implements vscode.Webview {
if (this._initData.isExtensionDevelopmentDebug && !this._hasCalledAsWebviewUri) {
if (/(["'])vscode-resource:([^\s'"]+?)(["'])/i.test(value)) {
this._hasCalledAsWebviewUri = true;
console.warn(`${this._extension.identifier.value} created a webview that appears to use the vscode-resource scheme directly. Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri`);
this._logService.warn(`${this._extension.identifier.value} created a webview that appears to use the vscode-resource scheme directly. Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri`);
}
}
this._proxy.$setHtml(this._handle, value);
@ -272,6 +274,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
mainContext: IMainContext,
private readonly initData: WebviewInitData,
private readonly workspace: IExtHostWorkspace | undefined,
private readonly _logService: ILogService,
) {
this._proxy = mainContext.getProxy(MainContext.MainThreadWebviews);
}
@ -292,7 +295,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
const handle = ExtHostWebviews.newHandle();
this._proxy.$createWebviewPanel({ id: extension.identifier, location: extension.extensionLocation }, handle, viewType, title, webviewShowOptions, convertWebviewOptions(extension, this.workspace, options));
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension);
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension, this._logService);
const panel = new ExtHostWebviewEditor(handle, this._proxy, viewType, title, viewColumn, options, webview);
this._webviewPanels.set(handle, panel);
return panel;
@ -349,7 +352,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
_handle: WebviewPanelHandle,
extensionId: string
): void {
console.warn(`${extensionId} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`);
this._logService.warn(`${extensionId} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`);
}
public $onDidChangeWebviewPanelViewStates(newStates: WebviewPanelViewStateData): void {
@ -409,7 +412,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
}
const { serializer, extension } = entry;
const webview = new ExtHostWebview(webviewHandle, this._proxy, options, this.initData, this.workspace, extension);
const webview = new ExtHostWebview(webviewHandle, this._proxy, options, this.initData, this.workspace, extension, this._logService);
const revivedPanel = new ExtHostWebviewEditor(webviewHandle, this._proxy, viewType, title, typeof position === 'number' && position >= 0 ? typeConverters.ViewColumn.to(position) : undefined, options, webview);
this._webviewPanels.set(webviewHandle, revivedPanel);
await serializer.deserializeWebviewPanel(revivedPanel, state);
@ -429,7 +432,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
}
const { provider, extension } = entry;
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension);
const webview = new ExtHostWebview(handle, this._proxy, options, this.initData, this.workspace, extension, this._logService);
const revivedPanel = new ExtHostWebviewEditor(handle, this._proxy, viewType, title, typeof position === 'number' && position >= 0 ? typeConverters.ViewColumn.to(position) : undefined, options, webview);
this._webviewPanels.set(handle, revivedPanel);
const capabilities = await provider.resolveWebviewEditor({ resource: URI.revive(resource) }, revivedPanel);

View file

@ -138,6 +138,32 @@ export class ExtHostDebugService implements IExtHostDebugService, ExtHostDebugSe
});
}
public asDebugSourceUri(src: vscode.DebugSource, session?: vscode.DebugSession): URI {
const source = <any>src;
if (typeof source.sourceReference === 'number') {
// src can be retrieved via DAP's "source" request
let debug = `debug:${encodeURIComponent(source.path || '')}`;
let sep = '?';
if (session) {
debug += `${sep}session=${encodeURIComponent(session.id)}`;
sep = '&';
}
debug += `${sep}ref=${source.sourceReference}`;
return URI.parse(debug);
} else if (source.path) {
// src is just a local file path
return URI.file(source.path);
} else {
throw new Error(`cannot create uri from DAP 'source' object; properties 'path' and 'sourceReference' are both missing.`);
}
}
private registerAllDebugTypes(extensionRegistry: ExtensionDescriptionRegistry) {
const debugTypes: string[] = [];

View file

@ -7,7 +7,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { IAction } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { ITree, IActionProvider } from 'vs/base/parts/tree/browser/tree';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor, BrandedService } from 'vs/platform/instantiation/common/instantiation';
/**
* The action bar contributor allows to add actions to an actionbar in a given context.
@ -134,7 +134,7 @@ export interface IActionBarRegistry {
* Registers an Actionbar contributor. It will be called to contribute actions to all the action bars
* that are used in the Workbench in the given scope.
*/
registerActionBarContributor(scope: string, ctor: IConstructorSignature0<ActionBarContributor>): void;
registerActionBarContributor<Services extends BrandedService[]>(scope: string, ctor: { new(...services: Services): ActionBarContributor }): void;
/**
* Returns an array of registered action bar contributors known to the workbench for the given scope.

View file

@ -164,7 +164,7 @@ export class ResourceLabels extends Disposable {
const label: IResourceLabel = {
element: widget.element,
onDidRender: widget.onDidRender,
setLabel: (label?: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options),
setLabel: (label: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options),
setResource: (label: IResourceLabelProps, options?: IResourceLabelOptions) => widget.setResource(label, options),
setEditor: (editor: IEditorInput, options?: IResourceLabelOptions) => widget.setEditor(editor, options),
setFile: (resource: URI, options?: IFileLabelOptions) => widget.setFile(resource, options),
@ -367,7 +367,7 @@ class ResourceLabelWidget extends IconLabel {
setEditor(editor: IEditorInput, options?: IResourceLabelOptions): void {
this.setResource({
resource: toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }),
name: withNullAsUndefined(editor.getName()),
name: editor.getName(),
description: editor.getDescription(options ? options.descriptionVerbosity : undefined)
}, options);
}
@ -404,7 +404,7 @@ class ResourceLabelWidget extends IconLabel {
this.computedIconClasses = undefined;
this.computedPathLabel = undefined;
this.setLabel();
this.setLabel('');
}
private render(clearIconCache: boolean): void {
@ -493,7 +493,7 @@ class ResourceLabelWidget extends IconLabel {
}
}
this.setLabel(label, this.label.description, iconLabelOptions);
this.setLabel(label || '', this.label.description, iconLabelOptions);
this._onDidRender.fire();
}

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