From adc58ddb681a515e95c740f05d706167f0cf865b Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 24 Sep 2019 15:06:20 -0700 Subject: [PATCH 001/637] Process debug adapter messages in separate tasks --- .../contrib/debug/browser/debugSession.ts | 5 ++ .../debug/common/abstractDebugAdapter.ts | 53 +++++++++------ .../debug/test/browser/debugModel.test.ts | 28 +++++++- .../contrib/debug/test/common/mockDebug.ts | 65 +++++++++++++++++++ 4 files changed, 130 insertions(+), 21 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index e50b51b45e0..e68c111e96c 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -685,6 +685,11 @@ export class DebugSession implements IDebugSession { }) : Promise.resolve(undefined); } + initializeForTest(raw: RawDebugSession): void { + this.raw = raw; + this.registerListeners(); + } + //---- private private registerListeners(): void { diff --git a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts index 56a9de64e26..22cd4b426d0 100644 --- a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts +++ b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts @@ -20,6 +20,7 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { private messageCallback: ((message: DebugProtocol.ProtocolMessage) => void) | undefined; protected readonly _onError: Emitter; protected readonly _onExit: Emitter; + private queue: DebugProtocol.ProtocolMessage[] = []; constructor() { this.sequence = 1; @@ -110,29 +111,43 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { this.messageCallback(message); } else { - switch (message.type) { - case 'event': - if (this.eventCallback) { - this.eventCallback(message); - } - break; - case 'request': - if (this.requestCallback) { - this.requestCallback(message); - } - break; - case 'response': - const response = message; - const clb = this.pendingRequests.get(response.request_seq); - if (clb) { - this.pendingRequests.delete(response.request_seq); - clb(response); - } - break; + // Artificially queueing protocol messages guarantees that any microtasks for + // previous message finish before next message is processed. This is essential + // to guarantee ordering when using promises anywhere along the call path. + this.queue.push(message); + if (this.queue.length === 1) { + setTimeout(() => this.processQueue(), 0); } } } + private processQueue(): void { + const message = this.queue!.shift()!; + switch (message.type) { + case 'event': + if (this.eventCallback) { + this.eventCallback(message); + } + break; + case 'request': + if (this.requestCallback) { + this.requestCallback(message); + } + break; + case 'response': + const response = message; + const clb = this.pendingRequests.get(response.request_seq); + if (clb) { + this.pendingRequests.delete(response.request_seq); + clb(response); + } + break; + } + if (this.queue!.length) { + setTimeout(() => this.processQueue(), 0); + } + } + private internalSend(typ: 'request' | 'response' | 'event', message: DebugProtocol.ProtocolMessage): void { message.type = typ; message.seq = this.sequence++; diff --git a/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts b/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts index fc9aa21b00a..0c745ef6ccd 100644 --- a/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts +++ b/src/vs/workbench/contrib/debug/test/browser/debugModel.test.ts @@ -8,12 +8,14 @@ import { URI as uri } from 'vs/base/common/uri'; import severity from 'vs/base/common/severity'; import { DebugModel, Expression, StackFrame, Thread } from 'vs/workbench/contrib/debug/common/debugModel'; import * as sinon from 'sinon'; -import { MockRawSession } from 'vs/workbench/contrib/debug/test/common/mockDebug'; +import { MockRawSession, MockDebugAdapter } from 'vs/workbench/contrib/debug/test/common/mockDebug'; import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; -import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplModel } from 'vs/workbench/contrib/debug/common/replModel'; +import { SimpleReplElement, RawObjectReplElement, ReplEvaluationInput, ReplModel, ReplEvaluationResult } from 'vs/workbench/contrib/debug/common/replModel'; import { IBreakpointUpdateData, IDebugSessionOptions } from 'vs/workbench/contrib/debug/common/debug'; import { NullOpenerService } from 'vs/platform/opener/common/opener'; +import { RawDebugSession } from 'vs/workbench/contrib/debug/browser/rawDebugSession'; +import { timeout } from 'vs/base/common/async'; function createMockSession(model: DebugModel, name = 'mockSession', options?: IDebugSessionOptions): DebugSession { return new DebugSession({ resolved: { name, type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, options, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, undefined!, NullOpenerService); @@ -540,4 +542,26 @@ suite('Debug - Model', () => { assert.equal(grandChild.getReplElements().length, 2); assert.equal(child3.getReplElements().length, 1); }); + + test('repl ordering', async () => { + const session = createMockSession(model); + model.addSession(session); + + const adapter = new MockDebugAdapter(); + const raw = new RawDebugSession(adapter, undefined!, undefined!, undefined!, undefined!, undefined!); + session.initializeForTest(raw); + + await session.addReplExpression(undefined, 'before.1'); + assert.equal(session.getReplElements().length, 3); + assert.equal((session.getReplElements()[0]).value, 'before.1'); + assert.equal((session.getReplElements()[1]).value, 'before.1'); + assert.equal((session.getReplElements()[2]).value, '=before.1'); + + await session.addReplExpression(undefined, 'after.2'); + await timeout(0); + assert.equal(session.getReplElements().length, 6); + assert.equal((session.getReplElements()[3]).value, 'after.2'); + assert.equal((session.getReplElements()[4]).value, '=after.2'); + assert.equal((session.getReplElements()[5]).value, 'after.2'); + }); }); diff --git a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts b/src/vs/workbench/contrib/debug/test/common/mockDebug.ts index 9ce2b7f792e..41250367a7d 100644 --- a/src/vs/workbench/contrib/debug/test/common/mockDebug.ts +++ b/src/vs/workbench/contrib/debug/test/common/mockDebug.ts @@ -11,6 +11,7 @@ import { ILaunch, IDebugService, State, IDebugSession, IConfigurationManager, IS import { Source } from 'vs/workbench/contrib/debug/common/debugSource'; import { CompletionItem } from 'vs/editor/common/modes'; import Severity from 'vs/base/common/severity'; +import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstractDebugAdapter'; export class MockDebugService implements IDebugService { @@ -463,3 +464,67 @@ export class MockRawSession { public readonly onDidStop: Event = null!; } + +export class MockDebugAdapter extends AbstractDebugAdapter { + private seq = 0; + + startSession(): Promise { + return Promise.resolve(); + } + + stopSession(): Promise { + return Promise.resolve(); + } + + sendMessage(message: DebugProtocol.ProtocolMessage): void { + setTimeout(() => { + if (message.type === 'request') { + const request = message as DebugProtocol.Request; + switch (request.command) { + case 'evaluate': + this.evaluate(request, request.arguments); + return; + } + this.sendResponseBody(request, {}); + return; + } + }, 0); + } + + sendResponseBody(request: DebugProtocol.Request, body: any) { + const response: DebugProtocol.Response = { + seq: ++this.seq, + type: 'response', + request_seq: request.seq, + command: request.command, + success: true, + body + }; + this.acceptMessage(response); + } + + sendEventBody(event: string, body: any) { + const response: DebugProtocol.Event = { + seq: ++this.seq, + type: 'event', + event, + body + }; + this.acceptMessage(response); + } + + evaluate(request: DebugProtocol.Request, args: DebugProtocol.EvaluateArguments) { + if (args.expression.indexOf('before.') === 0) { + this.sendEventBody('output', { output: args.expression }); + } + + this.sendResponseBody(request, { + result: '=' + args.expression, + variablesReference: 0 + }); + + if (args.expression.indexOf('after.') === 0) { + this.sendEventBody('output', { output: args.expression }); + } + } +} From e97a41e850c0b03564e237a713c5e08b1822f762 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 7 Nov 2019 18:27:47 +0800 Subject: [PATCH 002/637] fix Chinese system input in iOS 13.2 resolve https://github.com/microsoft/monaco-editor/issues/1663 --- src/vs/editor/browser/controller/textAreaInput.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index daecfbc4f68..2e64c93ba59 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -274,7 +274,11 @@ export class TextAreaInput extends Disposable { this._register(dom.addDisposableListener(textArea.domNode, 'compositionend', (e: CompositionEvent) => { this._lastTextAreaEvent = TextAreaInputEventType.compositionend; - + // https://github.com/microsoft/monaco-editor/issues/1663 + // On iOS 13.2, Chinese system IME randomly trigger an additional compositionend event with empty data + if (!this._isDoingComposition) { + return; + } if (compositionDataInValid(e.locale)) { // https://github.com/Microsoft/monaco-editor/issues/339 const [newState, typeInput] = deduceInputFromTextAreaValue(/*couldBeEmojiInput*/false, /*couldBeTypingAtOffset0*/false); From e3eaf02f577fb67752165bb4aadfb3d0e921ac53 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 25 Nov 2019 06:36:01 -0800 Subject: [PATCH 003/637] Setup ESRP code signing for rpm Fixes #78727 --- .../linux/product-build-linux.yml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 6e1f8ec1e53..a45cf9baf01 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -127,6 +127,30 @@ steps: ./build/azure-pipelines/linux/publish.sh displayName: Publish +- script: | + set -e + pushd ../VSCode-linux-x64 && zip -r -X -y ../VSCode-linux-x64.zip * && popd + displayName: Archive rpm for signing + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + inputs: + ConnectedServiceName: 'ESRP CodeSign' + FolderPath: '$(agent.builddirectory)' + Pattern: 'VSCode-linux-x64.zip' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-450778-Pgp", + "operationSetCode": "LinuxSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 120 + displayName: Codesign + - task: PublishPipelineArtifact@0 displayName: 'Publish Pipeline Artifact' inputs: From 5cb35d3bfcac4deb49d525c50c06fd133ba379da Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 25 Nov 2019 07:11:25 -0800 Subject: [PATCH 004/637] Set rpm path for sign --- build/azure-pipelines/linux/product-build-linux.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index a45cf9baf01..183c8f9ffd7 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -127,16 +127,11 @@ steps: ./build/azure-pipelines/linux/publish.sh displayName: Publish -- script: | - set -e - pushd ../VSCode-linux-x64 && zip -r -X -y ../VSCode-linux-x64.zip * && popd - displayName: Archive rpm for signing - - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESRP CodeSign' - FolderPath: '$(agent.builddirectory)' - Pattern: 'VSCode-linux-x64.zip' + FolderPath: '$(agent.builddirectory)/.build/linux/rpm/x86_64' + Pattern: '*.rpm' signConfigType: inlineSignParams inlineOperation: | [ From 47cc448a15a89ab695db48c34fc218a804ca4bcc Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 25 Nov 2019 07:55:23 -0800 Subject: [PATCH 005/637] Log paths --- build/azure-pipelines/linux/product-build-linux.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 183c8f9ffd7..b8afaaa6d53 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -127,6 +127,15 @@ steps: ./build/azure-pipelines/linux/publish.sh displayName: Publish +- script: | + ls -lR . + displayName: Debug log 1 + +- script: | + apt-get install tree + tree + displayName: Debug log 2 + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESRP CodeSign' From 01b295dd4104874abdeff166c13d8b4d7c43a14b Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 25 Nov 2019 10:21:34 -0800 Subject: [PATCH 006/637] Update log --- build/azure-pipelines/linux/product-build-linux.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index b8afaaa6d53..96c75405c54 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -128,14 +128,13 @@ steps: displayName: Publish - script: | - ls -lR . + pwd + echo '******* .build' + ls -lR .build + echo '******* ..' + ls -lR .. displayName: Debug log 1 -- script: | - apt-get install tree - tree - displayName: Debug log 2 - - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESRP CodeSign' From 323dc09e48727ec90f56bb1eb4f390164e0c776f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 25 Nov 2019 11:05:21 -0800 Subject: [PATCH 007/637] Try new folder path --- build/azure-pipelines/linux/product-build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 96c75405c54..2ba9457bc71 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -138,7 +138,7 @@ steps: - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESRP CodeSign' - FolderPath: '$(agent.builddirectory)/.build/linux/rpm/x86_64' + FolderPath: '.build/linux/rpm/x86_64' Pattern: '*.rpm' signConfigType: inlineSignParams inlineOperation: | From bed89d568ea7726a616b800c7da2f1a65a5c63e7 Mon Sep 17 00:00:00 2001 From: Kristian Thy Date: Wed, 27 Nov 2019 00:27:35 +0100 Subject: [PATCH 008/637] feat: region folding for perl5 --- extensions/perl/perl.language-configuration.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/perl/perl.language-configuration.json b/extensions/perl/perl.language-configuration.json index 6cf6295b798..c142f2d58f6 100644 --- a/extensions/perl/perl.language-configuration.json +++ b/extensions/perl/perl.language-configuration.json @@ -25,8 +25,8 @@ ], "folding": { "markers": { - "start": "^=pod\\s*$", - "end": "^=cut\\s*$" + "start": "^(?:(?:=pod\\s*$)|(?:\\s*#region\\b))", + "end": "^(?:(?:=cut\\s*$)|(?:\\s*#endregion\\b))" } } } \ No newline at end of file From 22cbe0c912b2d641ec4aec8e3ae7457f97b3c6c0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 27 Nov 2019 09:57:21 -0800 Subject: [PATCH 009/637] Sign rpm before publishing --- .../linux/product-build-linux.yml | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 2ba9457bc71..6743d997729 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -118,26 +118,9 @@ steps: displayName: Run integration tests condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) -- script: | - set -e - AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \ - AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \ - VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ - VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \ - ./build/azure-pipelines/linux/publish.sh - displayName: Publish - -- script: | - pwd - echo '******* .build' - ls -lR .build - echo '******* ..' - ls -lR .. - displayName: Debug log 1 - - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: - ConnectedServiceName: 'ESRP CodeSign' + ConnectedServiceName: 'ESRP CodeSign rpm' FolderPath: '.build/linux/rpm/x86_64' Pattern: '*.rpm' signConfigType: inlineSignParams @@ -154,6 +137,15 @@ steps: SessionTimeout: 120 displayName: Codesign +- script: | + set -e + AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \ + AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \ + VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \ + VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \ + ./build/azure-pipelines/linux/publish.sh + displayName: Publish + - task: PublishPipelineArtifact@0 displayName: 'Publish Pipeline Artifact' inputs: From a079c71934eec704f5a9de4478ca1c0151799d0a Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 27 Nov 2019 10:00:49 -0800 Subject: [PATCH 010/637] Fix display name --- build/azure-pipelines/linux/product-build-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 6743d997729..98d4b094253 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -120,7 +120,7 @@ steps: - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: - ConnectedServiceName: 'ESRP CodeSign rpm' + ConnectedServiceName: 'ESRP CodeSign' FolderPath: '.build/linux/rpm/x86_64' Pattern: '*.rpm' signConfigType: inlineSignParams @@ -135,7 +135,7 @@ steps: } ] SessionTimeout: 120 - displayName: Codesign + displayName: Codesign rpm - script: | set -e From 9c8ff0429912c1fe8e3a64d432519a423409c6e2 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 27 Nov 2019 10:33:38 -0800 Subject: [PATCH 011/637] Move Linux package build into new step --- build/azure-pipelines/linux/product-build-linux.yml | 7 +++++++ build/azure-pipelines/linux/publish.sh | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 98d4b094253..972962dfcff 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -118,6 +118,13 @@ steps: displayName: Run integration tests condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + yarn gulp "vscode-linux-x64-build-deb" + yarn gulp "vscode-linux-x64-build-rpm" + yarn gulp "vscode-linux-x64-prepare-snap" + displayName: Build packages + - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 inputs: ConnectedServiceName: 'ESRP CodeSign' diff --git a/build/azure-pipelines/linux/publish.sh b/build/azure-pipelines/linux/publish.sh index 3a5f9683eaa..3da6ea3eed6 100755 --- a/build/azure-pipelines/linux/publish.sh +++ b/build/azure-pipelines/linux/publish.sh @@ -31,7 +31,6 @@ node build/azure-pipelines/common/createAsset.js "server-$PLATFORM_LINUX" archiv node build/azure-pipelines/common/symbols.js "$VSCODE_MIXIN_PASSWORD" "$VSCODE_HOCKEYAPP_TOKEN" "x64" "$VSCODE_HOCKEYAPP_ID_LINUX64" # Publish DEB -yarn gulp "vscode-linux-x64-build-deb" PLATFORM_DEB="linux-deb-x64" DEB_ARCH="amd64" DEB_FILENAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/)" @@ -40,7 +39,6 @@ DEB_PATH="$REPO/.build/linux/deb/$DEB_ARCH/deb/$DEB_FILENAME" node build/azure-pipelines/common/createAsset.js "$PLATFORM_DEB" package "$DEB_FILENAME" "$DEB_PATH" # Publish RPM -yarn gulp "vscode-linux-x64-build-rpm" PLATFORM_RPM="linux-rpm-x64" RPM_ARCH="x86_64" RPM_FILENAME="$(ls $REPO/.build/linux/rpm/$RPM_ARCH/ | grep .rpm)" @@ -49,8 +47,6 @@ RPM_PATH="$REPO/.build/linux/rpm/$RPM_ARCH/$RPM_FILENAME" node build/azure-pipelines/common/createAsset.js "$PLATFORM_RPM" package "$RPM_FILENAME" "$RPM_PATH" # Publish Snap -yarn gulp "vscode-linux-x64-prepare-snap" - # Pack snap tarball artifact, in order to preserve file perms mkdir -p $REPO/.build/linux/snap-tarball SNAP_TARBALL_PATH="$REPO/.build/linux/snap-tarball/snap-x64.tar.gz" From 80db12a5ecc4b3b2e4f0f14a36e3f997355c9aac Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 29 Nov 2019 15:09:26 +0100 Subject: [PATCH 012/637] move API to stable --- src/vs/vscode.d.ts | 236 +++++++++++++++++ src/vs/vscode.proposed.d.ts | 242 ------------------ .../workbench/api/common/extHost.api.impl.ts | 6 - 3 files changed, 236 insertions(+), 248 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index a21f1a0ec4a..0c00be8daa6 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -8084,6 +8084,172 @@ declare module 'vscode' { waitUntil(thenable: Thenable): void; } + /** + * An event that is fired when files are going to be created. + * + * To make modifications to the workspace before the files are created, + * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a + * thenable that resolves to a [workspace edit](#WorkspaceEdit). + */ + export interface FileWillCreateEvent { + + /** + * The files that are going to be created. + */ + readonly files: ReadonlyArray; + + /** + * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). + * + * *Note:* This function can only be called during event dispatch and not + * in an asynchronous manner: + * + * ```ts + * workspace.onWillCreateFiles(event => { + * // async, will *throw* an error + * setTimeout(() => event.waitUntil(promise)); + * + * // sync, OK + * event.waitUntil(promise); + * }) + * ``` + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + + /** + * Allows to pause the event until the provided thenable resolves. + * + * *Note:* This function can only be called during event dispatch. + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + } + + /** + * An event that is fired after files are created. + */ + export interface FileCreateEvent { + + /** + * The files that got created. + */ + readonly files: ReadonlyArray; + } + + /** + * An event that is fired when files are going to be deleted. + * + * To make modifications to the workspace before the files are deleted, + * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a + * thenable that resolves to a [workspace edit](#WorkspaceEdit). + */ + export interface FileWillDeleteEvent { + + /** + * The files that are going to be deleted. + */ + readonly files: ReadonlyArray; + + /** + * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). + * + * *Note:* This function can only be called during event dispatch and not + * in an asynchronous manner: + * + * ```ts + * workspace.onWillCreateFiles(event => { + * // async, will *throw* an error + * setTimeout(() => event.waitUntil(promise)); + * + * // sync, OK + * event.waitUntil(promise); + * }) + * ``` + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + + /** + * Allows to pause the event until the provided thenable resolves. + * + * *Note:* This function can only be called during event dispatch. + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + } + + /** + * An event that is fired after files are deleted. + */ + export interface FileDeleteEvent { + + /** + * The files that got deleted. + */ + readonly files: ReadonlyArray; + } + + /** + * An event that is fired when files are going to be renamed. + * + * To make modifications to the workspace before the files are renamed, + * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a + * thenable that resolves to a [workspace edit](#WorkspaceEdit). + */ + export interface FileWillRenameEvent { + + /** + * The files that are going to be renamed. + */ + readonly files: ReadonlyArray<{ oldUri: Uri, newUri: Uri }>; + + /** + * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). + * + * *Note:* This function can only be called during event dispatch and not + * in an asynchronous manner: + * + * ```ts + * workspace.onWillCreateFiles(event => { + * // async, will *throw* an error + * setTimeout(() => event.waitUntil(promise)); + * + * // sync, OK + * event.waitUntil(promise); + * }) + * ``` + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + + /** + * Allows to pause the event until the provided thenable resolves. + * + * *Note:* This function can only be called during event dispatch. + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + } + + /** + * An event that is fired after files are renamed. + */ + export interface FileRenameEvent { + + /** + * The files that got renamed. + */ + readonly files: ReadonlyArray<{ oldUri: Uri, newUri: Uri }>; + } + + /** * An event describing a change to the set of [workspace folders](#workspace.workspaceFolders). */ @@ -8433,6 +8599,76 @@ declare module 'vscode' { */ export const onDidSaveTextDocument: Event; + /** + * An event that is emitted when files are being created. + * + * *Note 1:* This event is triggered by user gestures, like creating a file from the + * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api. This event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + * + * *Note 2:* When this event is fired, edits to files thare are being created cannot be applied. + */ + export const onWillCreateFiles: Event; + + /** + * An event that is emitted when files have been created. + * + * *Note:* This event is triggered by user gestures, like creating a file from the + * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + */ + export const onDidCreateFiles: Event; + + /** + * An event that is emitted when files are being deleted. + * + * *Note 1:* This event is triggered by user gestures, like deleting a file from the + * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + * + * *Note 2:* When deleting a folder with children only one event is fired. + */ + export const onWillDeleteFiles: Event; + + /** + * An event that is emitted when files have been deleted. + * + * *Note 1:* This event is triggered by user gestures, like deleting a file from the + * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + * + * *Note 2:* When deleting a folder with children only one event is fired. + */ + export const onDidDeleteFiles: Event; + + /** + * An event that is emitted when files are being renamed. + * + * *Note 1:* This event is triggered by user gestures, like renaming a file from the + * explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + * + * *Note 2:* When renaming a folder with children only one event is fired. + */ + export const onWillRenameFiles: Event; + + /** + * An event that is emitted when files have been renamed. + * + * *Note 1:* This event is triggered by user gestures, like renaming a file from the + * explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when + * files change on disk, e.g triggered by another application, or when using the + * [`workspace.fs`](#FileSystem)-api. + * + * *Note 2:* When renaming a folder with children only one event is fired. + */ + export const onDidRenameFiles: Event; + /** * Get a workspace configuration object. * diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 9241ab3e662..13abf220667 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -736,7 +736,6 @@ declare module 'vscode' { //#endregion - //#region Terminal /** @@ -830,247 +829,6 @@ declare module 'vscode' { //#endregion - //#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768 - - /** - * An event that is fired when files are going to be created. - * - * To make modifications to the workspace before the files are created, - * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a - * thenable that resolves to a [workspace edit](#WorkspaceEdit). - */ - export interface FileWillCreateEvent { - - /** - * The files that are going to be created. - */ - readonly files: ReadonlyArray; - - /** - * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are created. - */ - export interface FileCreateEvent { - - /** - * The files that got created. - */ - readonly files: ReadonlyArray; - } - - /** - * An event that is fired when files are going to be deleted. - * - * To make modifications to the workspace before the files are deleted, - * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a - * thenable that resolves to a [workspace edit](#WorkspaceEdit). - */ - export interface FileWillDeleteEvent { - - /** - * The files that are going to be deleted. - */ - readonly files: ReadonlyArray; - - /** - * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are deleted. - */ - export interface FileDeleteEvent { - - /** - * The files that got deleted. - */ - readonly files: ReadonlyArray; - } - - /** - * An event that is fired when files are going to be renamed. - * - * To make modifications to the workspace before the files are renamed, - * call the [`waitUntil](#FileWillCreateEvent.waitUntil)-function with a - * thenable that resolves to a [workspace edit](#WorkspaceEdit). - */ - export interface FileWillRenameEvent { - - /** - * The files that are going to be renamed. - */ - readonly files: ReadonlyArray<{ oldUri: Uri, newUri: Uri }>; - - /** - * Allows to pause the event and to apply a [workspace edit](#WorkspaceEdit). - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are renamed. - */ - export interface FileRenameEvent { - - /** - * The files that got renamed. - */ - readonly files: ReadonlyArray<{ oldUri: Uri, newUri: Uri }>; - } - - export namespace workspace { - - /** - * An event that is emitted when files are being created. - * - * *Note 1:* This event is triggered by user gestures, like creating a file from the - * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api. This event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - * - * *Note 2:* When this event is fired, edits to files thare are being created cannot be applied. - */ - export const onWillCreateFiles: Event; - - /** - * An event that is emitted when files have been created. - * - * *Note:* This event is triggered by user gestures, like creating a file from the - * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - */ - export const onDidCreateFiles: Event; - - /** - * An event that is emitted when files are being deleted. - * - * *Note 1:* This event is triggered by user gestures, like deleting a file from the - * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - * - * *Note 2:* When deleting a folder with children only one event is fired. - */ - export const onWillDeleteFiles: Event; - - /** - * An event that is emitted when files have been deleted. - * - * *Note 1:* This event is triggered by user gestures, like deleting a file from the - * explorer, or from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - * - * *Note 2:* When deleting a folder with children only one event is fired. - */ - export const onDidDeleteFiles: Event; - - /** - * An event that is emitted when files are being renamed. - * - * *Note 1:* This event is triggered by user gestures, like renaming a file from the - * explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - * - * *Note 2:* When renaming a folder with children only one event is fired. - */ - export const onWillRenameFiles: Event; - - /** - * An event that is emitted when files have been renamed. - * - * *Note 1:* This event is triggered by user gestures, like renaming a file from the - * explorer, and from the [`workspace.applyEdit`](#workspace.applyEdit)-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * [`workspace.fs`](#FileSystem)-api. - * - * *Note 2:* When renaming a folder with children only one event is fired. - */ - export const onDidRenameFiles: Event; - } - //#endregion - //#region Alex - OnEnter enhancement export interface OnEnterRule { /** diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 84a355928e9..32ad205cba6 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -699,27 +699,21 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostLabelService.$registerResourceLabelFormatter(formatter); }, onDidCreateFiles: (listener, thisArg, disposables) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.onDidCreateFile(listener, thisArg, disposables); }, onDidDeleteFiles: (listener, thisArg, disposables) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.onDidDeleteFile(listener, thisArg, disposables); }, onDidRenameFiles: (listener, thisArg, disposables) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.onDidRenameFile(listener, thisArg, disposables); }, onWillCreateFiles: (listener: (e: vscode.FileWillCreateEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.getOnWillCreateFileEvent(extension)(listener, thisArg, disposables); }, onWillDeleteFiles: (listener: (e: vscode.FileWillDeleteEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.getOnWillDeleteFileEvent(extension)(listener, thisArg, disposables); }, onWillRenameFiles: (listener: (e: vscode.FileWillRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { - checkProposedApiEnabled(extension); return extHostFileSystemEvent.getOnWillRenameFileEvent(extension)(listener, thisArg, disposables); } }; From 2d33ccfff6fb6a496f1110d366f5dbb48680afc4 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Fri, 29 Nov 2019 21:54:58 +0000 Subject: [PATCH 013/637] #85645 display Variables fetch failure message --- src/vs/workbench/contrib/debug/common/debugModel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 380ee08754b..613ce6491a4 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -122,7 +122,7 @@ export class ExpressionContainer implements IExpressionContainer { new Variable(this.session, this.threadId, this, v.variablesReference, v.name, v.evaluateName, v.value, v.namedVariables, v.indexedVariables, v.presentationHint, v.type)) : []; } catch (e) { - return [new Variable(this.session, this.threadId, this, 0, e.message, e.message, '', 0, 0, { kind: 'virtual' }, undefined, false)]; + return [new Variable(this.session, this.threadId, this, 0, e.message, e.message, '', 0, 0, { kind: 'virtual' }, undefined, true)]; } } From 389015f5cd95d0cf5dd3fce0a4c73a7c4151dadf Mon Sep 17 00:00:00 2001 From: Gustavo Cassel Date: Sat, 30 Nov 2019 13:58:35 -0300 Subject: [PATCH 014/637] Developed commands to change focus between preview editor and references within Peek View --- .../gotoSymbol/peek/referencesController.ts | 40 ++++++++++++++++++- .../gotoSymbol/peek/referencesWidget.ts | 12 +++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts index 4d22101b994..7404b344c89 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts @@ -173,6 +173,18 @@ export abstract class ReferencesController implements editorCommon.IEditorContri }); } + async changeFocusBetweenPreviewAndReferences() { + if (!this._widget) { + // can be called while still resolving... + return; + } + if (this._widget.isPreviewEditorFocused()) { + this._widget.focusOnReferenceTree(); + } else { + this._widget.focusOnPreviewEditor(); + } + } + async goToNextOrPreviousReference(fwd: boolean) { if (!this._editor.hasModel() || !this._model || !this._widget) { // can be called while still resolving... @@ -229,7 +241,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri if (this._editor === openedEditor) { // this._widget.show(range); - this._widget.focus(); + this._widget.focusOnReferenceTree(); } else { // we opened a different editor instance which means a different controller instance. @@ -278,6 +290,30 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC } } +KeybindingsRegistry.registerCommandAndKeybindingRule({ + id: 'changeFocus', + weight: KeybindingWeight.WorkbenchContrib + 50, + primary: KeyCode.F2, + when: ctxReferenceSearchVisible, + handler(accessor) { + withController(accessor, controller => { + controller.changeFocusBetweenPreviewAndReferences(); + }); + } +}); + +KeybindingsRegistry.registerCommandAndKeybindingRule({ + id: 'changeFocusFromEmbeddedEditor', + weight: KeybindingWeight.EditorContrib + 50, + primary: KeyCode.F2, + when: PeekContext.inPeekEditor, + handler(accessor) { + withController(accessor, controller => { + controller.changeFocusBetweenPreviewAndReferences(); + }); + } +}); + KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'goToNextReference', weight: KeybindingWeight.WorkbenchContrib + 50, @@ -362,7 +398,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey), handler(accessor: ServicesAccessor) { const listService = accessor.get(IListService); - const focus = listService.lastFocusedList?.getFocus(); + const focus = listService.lastFocusedList ?.getFocus(); if (Array.isArray(focus) && focus[0] instanceof OneReference) { withController(accessor, controller => controller.openReference(focus[0], true)); } diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts index 48a83e6d40e..2b9f946be1b 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts @@ -251,10 +251,18 @@ export class ReferenceWidget extends peekView.PeekViewWidget { super.show(where, this.layoutData.heightInLines || 18); } - focus(): void { + focusOnReferenceTree(): void { this._tree.domFocus(); } + focusOnPreviewEditor(): void { + this._preview.focus(); + } + + isPreviewEditorFocused(): boolean { + return this._preview.hasTextFocus(); + } + protected _onTitleClick(e: IMouseEvent): void { if (this._preview && this._preview.getModel()) { this._onDidSelectReference.fire({ @@ -457,7 +465,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget { dom.show(this._treeContainer); dom.show(this._previewContainer); this._splitView.layout(this._dim.width); - this.focus(); + this.focusOnReferenceTree(); // pick input and a reference to begin with return this._tree.setInput(this._model.groups.length === 1 ? this._model.groups[0] : this._model); From aca51c78cfbe23ed9d0eafb7743f91cae7b3566d Mon Sep 17 00:00:00 2001 From: Gustavo Cassel Date: Sat, 30 Nov 2019 16:36:54 -0300 Subject: [PATCH 015/637] Fixed Hygien format checks --- src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts index 7404b344c89..414c03f877c 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts @@ -398,7 +398,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(ctxReferenceSearchVisible, WorkbenchListFocusContextKey), handler(accessor: ServicesAccessor) { const listService = accessor.get(IListService); - const focus = listService.lastFocusedList ?.getFocus(); + const focus = listService.lastFocusedList?.getFocus(); if (Array.isArray(focus) && focus[0] instanceof OneReference) { withController(accessor, controller => controller.openReference(focus[0], true)); } From 8d3a5b6e98c0831d59d10fb5154b9dbb05d7d9f4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 2 Dec 2019 06:17:21 -0800 Subject: [PATCH 016/637] Sign with prod key --- build/azure-pipelines/linux/product-build-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 972962dfcff..573d7c7d4c2 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -134,7 +134,7 @@ steps: inlineOperation: | [ { - "keyCode": "CP-450778-Pgp", + "keyCode": "CP-450779-Pgp", "operationSetCode": "LinuxSign", "parameters": [ ], "toolName": "sign", From 8a7928e2707c73066bd3ffca33b323e9bed45e65 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 15:48:58 +0100 Subject: [PATCH 017/637] Fix #85210 --- .../sharedProcess/sharedProcessMain.ts | 3 +- .../userDataSync/common/userDataAutoSync.ts | 69 +++++++++++++++++++ .../common/userDataSyncService.ts | 66 +----------------- .../electron-browser/userDataAutoSync.ts | 32 +++++++++ .../userDataSync/browser/userDataAutoSync.ts | 35 ++++++++++ .../userDataSync/browser/userDataSync.ts | 13 +++- .../browser/userDataSyncTrigger.ts | 61 ++++++++++++++++ 7 files changed, 212 insertions(+), 67 deletions(-) create mode 100644 src/vs/platform/userDataSync/common/userDataAutoSync.ts create mode 100644 src/vs/platform/userDataSync/electron-browser/userDataAutoSync.ts create mode 100644 src/vs/workbench/contrib/userDataSync/browser/userDataAutoSync.ts create mode 100644 src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 27469c14739..96ce984b782 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -51,7 +51,7 @@ import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskF import { Schemas } from 'vs/base/common/network'; import { IProductService } from 'vs/platform/product/common/productService'; import { IUserDataSyncService, IUserDataSyncStoreService, ISettingsMergeService, registerConfiguration, IUserDataSyncLogService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; -import { UserDataSyncService, UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService'; +import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyncService'; import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService'; import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; import { SettingsMergeChannelClient } from 'vs/platform/userDataSync/common/settingsSyncIpc'; @@ -64,6 +64,7 @@ import { AuthTokenChannel } from 'vs/platform/auth/common/authTokenIpc'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; import { UserDataSyncUtilServiceClient } from 'vs/platform/userDataSync/common/keybindingsSyncIpc'; +import { UserDataAutoSync } from 'vs/platform/userDataSync/electron-browser/userDataAutoSync'; export interface ISharedProcessConfiguration { readonly machineId: string; diff --git a/src/vs/platform/userDataSync/common/userDataAutoSync.ts b/src/vs/platform/userDataSync/common/userDataAutoSync.ts new file mode 100644 index 00000000000..75123459141 --- /dev/null +++ b/src/vs/platform/userDataSync/common/userDataAutoSync.ts @@ -0,0 +1,69 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IUserDataSyncService, SyncStatus, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { Event } from 'vs/base/common/event'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { timeout } from 'vs/base/common/async'; +import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth'; + +export class UserDataAutoSync extends Disposable { + + private enabled: boolean = false; + + constructor( + @IConfigurationService private readonly configurationService: IConfigurationService, + @IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService, + @IUserDataSyncLogService private readonly logService: IUserDataSyncLogService, + @IAuthTokenService private readonly authTokenService: IAuthTokenService, + ) { + super(); + this.updateEnablement(false); + this._register(Event.any(authTokenService.onDidChangeStatus, userDataSyncService.onDidChangeStatus)(() => this.updateEnablement(true))); + this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('sync.enable'))(() => this.updateEnablement(true))); + } + + private updateEnablement(stopIfDisabled: boolean): void { + const enabled = this.isSyncEnabled(); + if (this.enabled === enabled) { + return; + } + + this.enabled = enabled; + if (this.enabled) { + this.logService.info('Syncing configuration started'); + this.sync(true); + return; + } else { + if (stopIfDisabled) { + this.userDataSyncService.stop(); + this.logService.info('Syncing configuration stopped.'); + } + } + + } + + protected async sync(loop: boolean): Promise { + if (this.enabled) { + try { + await this.userDataSyncService.sync(); + } catch (e) { + this.logService.error(e); + } + if (loop) { + await timeout(1000 * 60 * 5); // Loop sync for every 5 min. + this.sync(loop); + } + } + } + + private isSyncEnabled(): boolean { + return this.configurationService.getValue('sync.enable') + && this.userDataSyncService.status !== SyncStatus.Uninitialized + && this.authTokenService.status === AuthTokenStatus.SignedIn; + } + +} diff --git a/src/vs/platform/userDataSync/common/userDataSyncService.ts b/src/vs/platform/userDataSync/common/userDataSyncService.ts index d4a1b83deda..db118026b58 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncService.ts @@ -3,13 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IUserDataSyncService, SyncStatus, ISynchroniser, IUserDataSyncStoreService, SyncSource, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserDataSyncService, SyncStatus, ISynchroniser, IUserDataSyncStoreService, SyncSource } 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'; import { Emitter, Event } from 'vs/base/common/event'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { timeout } from 'vs/base/common/async'; import { ExtensionsSynchroniser } from 'vs/platform/userDataSync/common/extensionsSync'; import { IExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IAuthTokenService, AuthTokenStatus } from 'vs/platform/auth/common/auth'; @@ -128,65 +126,3 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ } } - -export class UserDataAutoSync extends Disposable { - - private enabled: boolean = false; - - constructor( - @IConfigurationService private readonly configurationService: IConfigurationService, - @IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService, - @IUserDataSyncStoreService userDataSyncStoreService: IUserDataSyncStoreService, - @IUserDataSyncLogService private readonly logService: IUserDataSyncLogService, - @IAuthTokenService private readonly authTokenService: IAuthTokenService, - ) { - super(); - this.updateEnablement(false); - this._register(Event.any(authTokenService.onDidChangeStatus, userDataSyncService.onDidChangeStatus)(() => this.updateEnablement(true))); - this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('sync.enable'))(() => this.updateEnablement(true))); - - // Sync immediately if there is a local change. - this._register(Event.debounce(this.userDataSyncService.onDidChangeLocal, () => undefined, 500)(() => this.sync(false))); - } - - private updateEnablement(stopIfDisabled: boolean): void { - const enabled = this.isSyncEnabled(); - if (this.enabled === enabled) { - return; - } - - this.enabled = enabled; - if (this.enabled) { - this.logService.info('Syncing configuration started'); - this.sync(true); - return; - } else { - if (stopIfDisabled) { - this.userDataSyncService.stop(); - this.logService.info('Syncing configuration stopped.'); - } - } - - } - - private async sync(loop: boolean): Promise { - if (this.enabled) { - try { - await this.userDataSyncService.sync(); - } catch (e) { - this.logService.error(e); - } - if (loop) { - await timeout(1000 * 30); // Loop sync for every 30s. - this.sync(loop); - } - } - } - - private isSyncEnabled(): boolean { - return this.configurationService.getValue('sync.enable') - && this.userDataSyncService.status !== SyncStatus.Uninitialized - && this.authTokenService.status === AuthTokenStatus.SignedIn; - } - -} diff --git a/src/vs/platform/userDataSync/electron-browser/userDataAutoSync.ts b/src/vs/platform/userDataSync/electron-browser/userDataAutoSync.ts new file mode 100644 index 00000000000..90ec9533ecd --- /dev/null +++ b/src/vs/platform/userDataSync/electron-browser/userDataAutoSync.ts @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IUserDataSyncService, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; +import { Event } from 'vs/base/common/event'; +import { IElectronService } from 'vs/platform/electron/node/electron'; +import { UserDataAutoSync as BaseUserDataAutoSync } from 'vs/platform/userDataSync/common/userDataAutoSync'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IAuthTokenService } from 'vs/platform/auth/common/auth'; + +export class UserDataAutoSync extends BaseUserDataAutoSync { + + constructor( + @IUserDataSyncService userDataSyncService: IUserDataSyncService, + @IElectronService electronService: IElectronService, + @IConfigurationService configurationService: IConfigurationService, + @IUserDataSyncLogService logService: IUserDataSyncLogService, + @IAuthTokenService authTokenService: IAuthTokenService, + ) { + super(configurationService, userDataSyncService, logService, authTokenService); + + // Sync immediately if there is a local change. + this._register(Event.debounce(Event.any( + electronService.onWindowFocus, + electronService.onWindowOpen, + userDataSyncService.onDidChangeLocal + ), () => undefined, 500)(() => this.sync(false))); + } + +} diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataAutoSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataAutoSync.ts new file mode 100644 index 00000000000..d0d54c3c403 --- /dev/null +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataAutoSync.ts @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IUserDataSyncService, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IAuthTokenService } from 'vs/platform/auth/common/auth'; +import { Event } from 'vs/base/common/event'; +import { UserDataAutoSync as BaseUserDataAutoSync } from 'vs/platform/userDataSync/common/userDataAutoSync'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger'; +import { IHostService } from 'vs/workbench/services/host/browser/host'; + +export class UserDataAutoSync extends BaseUserDataAutoSync { + + constructor( + @IUserDataSyncService userDataSyncService: IUserDataSyncService, + @IConfigurationService configurationService: IConfigurationService, + @IUserDataSyncLogService logService: IUserDataSyncLogService, + @IAuthTokenService authTokenService: IAuthTokenService, + @IInstantiationService instantiationService: IInstantiationService, + @IHostService hostService: IHostService, + ) { + super(configurationService, userDataSyncService, logService, authTokenService); + + // Sync immediately if there is a local change. + this._register(Event.debounce(Event.any( + userDataSyncService.onDidChangeLocal, + instantiationService.createInstance(UserDataSyncTrigger).onDidTriggerSync, + hostService.onDidChangeFocus + ), () => undefined, 500)(() => this.sync(false))); + } + +} diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 1f5577d1189..2a57564f862 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -30,7 +30,8 @@ import { FalseContext } from 'vs/platform/contextkey/common/contextkeys'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { isWeb } from 'vs/base/common/platform'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { UserDataAutoSync } from 'vs/platform/userDataSync/common/userDataSyncService'; +import { UserDataAutoSync } from 'vs/workbench/contrib/userDataSync/browser/userDataAutoSync'; +import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger'; const CONTEXT_AUTH_TOKEN_STATE = new RawContextKey('authTokenStatus', AuthTokenStatus.Initializing); const SYNC_PUSH_LIGHT_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/userDataSync/browser/media/check-light.svg`)); @@ -78,10 +79,20 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo if (isWeb) { this._register(instantiationService.createInstance(UserDataAutoSync)); + } else { + this._register(instantiationService.createInstance(UserDataSyncTrigger).onDidTriggerSync(() => this.triggerSync())); } } } + private triggerSync(): void { + if (this.configurationService.getValue('sync.enable') + && this.userDataSyncService.status !== SyncStatus.Uninitialized + && this.authTokenService.status === AuthTokenStatus.SignedIn) { + this.userDataSyncService.sync(); + } + } + private onDidChangeAuthTokenStatus(status: AuthTokenStatus) { this.authTokenContext.set(status); if (status === AuthTokenStatus.SignedIn) { diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts new file mode 100644 index 00000000000..21dc9c85367 --- /dev/null +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.ts @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Event, Emitter } from 'vs/base/common/event'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { SettingsEditor2Input, KeybindingsEditorInput, PreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput'; +import { isEqual } from 'vs/base/common/resources'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; +import { VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IEditorInput } from 'vs/workbench/common/editor'; +import { IViewlet } from 'vs/workbench/common/viewlet'; + +export class UserDataSyncTrigger extends Disposable { + + private readonly _onDidTriggerSync: Emitter = this._register(new Emitter()); + readonly onDidTriggerSync: Event = this._onDidTriggerSync.event; + + constructor( + @IEditorService editorService: IEditorService, + @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService, + @IViewletService viewletService: IViewletService, + ) { + super(); + this._register(Event.debounce(Event.any( + Event.filter(editorService.onDidActiveEditorChange, () => this.isUserDataEditorInput(editorService.activeEditor)), + Event.filter(viewletService.onDidViewletOpen, viewlet => this.isUserDataViewlet(viewlet)) + ), () => undefined, 500)(() => this._onDidTriggerSync.fire())); + } + + private isUserDataViewlet(viewlet: IViewlet): boolean { + return viewlet.getId() === VIEWLET_ID; + } + + private isUserDataEditorInput(editorInput: IEditorInput | undefined): boolean { + if (!editorInput) { + return false; + } + if (editorInput instanceof SettingsEditor2Input) { + return true; + } + if (editorInput instanceof PreferencesEditorInput) { + return true; + } + if (editorInput instanceof KeybindingsEditorInput) { + return true; + } + const resource = editorInput.getResource(); + if (isEqual(resource, this.workbenchEnvironmentService.settingsResource)) { + return true; + } + if (isEqual(resource, this.workbenchEnvironmentService.keybindingsResource)) { + return true; + } + return false; + } +} + From e7a7e46fcc0a590f16d99df3ea08a8f35c180c14 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 2 Dec 2019 15:57:02 +0100 Subject: [PATCH 018/637] add another unit test for #80688 --- .../src/singlefolder-tests/workspace.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts index 175ef8522d1..6e409489af6 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts @@ -916,4 +916,23 @@ suite('workspace-namespace', () => { const expected2 = 'import2;import1;'; assert.equal(document.getText(), expected2); }); + + test('The api workspace.applyEdit failed for some case of mixing resourceChange and textEdit #80688', async function () { + const file1 = await createRandomFile(); + const file2 = await createRandomFile(); + let we = new vscode.WorkspaceEdit(); + we.insert(file1, new vscode.Position(0, 0), 'import1;'); + we.insert(file1, new vscode.Position(0, 0), 'import2;'); + + const file2Name = basename(file2.fsPath); + const file2NewUri = vscode.Uri.parse(file2.toString().replace(file2Name, `new/${file2Name}`)); + we.renameFile(file2, file2NewUri); + + await vscode.workspace.applyEdit(we); + + const document = await vscode.workspace.openTextDocument(file1); + const expected = 'import1;import2;'; + // const expected2 = 'import2;import1;'; + assert.equal(document.getText(), expected); + }); }); From a01739bab2eccc05ae0153fdc1410be1b6b8e92c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 15:58:51 +0100 Subject: [PATCH 019/637] Fix #85351 --- .../contrib/userDataSync/browser/userDataSync.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 2a57564f862..9e702a131d6 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -32,6 +32,7 @@ import { isWeb } from 'vs/base/common/platform'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { UserDataAutoSync } from 'vs/workbench/contrib/userDataSync/browser/userDataAutoSync'; import { UserDataSyncTrigger } from 'vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger'; +import { timeout } from 'vs/base/common/async'; const CONTEXT_AUTH_TOKEN_STATE = new RawContextKey('authTokenStatus', AuthTokenStatus.Initializing); const SYNC_PUSH_LIGHT_ICON_URI = URI.parse(registerAndGetAmdImageURL(`vs/workbench/contrib/userDataSync/browser/media/check-light.svg`)); @@ -104,7 +105,12 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo private onDidChangeSyncStatus(status: SyncStatus) { this.syncStatusContext.set(status); - this.updateBadge(); + if (status === SyncStatus.Syncing) { + // Show syncing progress if takes more than 1s. + timeout(1000).then(() => this.updateBadge()); + } else { + this.updateBadge(); + } if (this.userDataSyncService.status === SyncStatus.HasConflicts) { if (!this.conflictsWarningDisposable.value) { From 8d2160686e73b3ea2fd5d44628f4b7348e6aeff4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 2 Dec 2019 16:01:09 +0100 Subject: [PATCH 020/637] add jsdoc comment for #80688 --- src/vs/vscode.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 060cd82e81e..04396f195a3 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -8315,8 +8315,8 @@ declare module 'vscode' { * * All changes of a workspace edit are applied in the same order in which they have been added. If * multiple textual inserts are made at the same position, these strings appear in the resulting text - * in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a' - * cause failure of the operation. + * in the order the 'inserts' were made, unless that are interleaved with resource edits. Invalid sequences + * like 'delete file a' -> 'insert text in file a' cause failure of the operation. * * When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used. * A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will From d0c8461d5965cd269f0f1787e3d72473bd76e666 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 16:09:40 +0100 Subject: [PATCH 021/637] skip tests in all platforms --- .../test/common/keybindingsMerge.test.ts | 198 +++++++++--------- 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts index c1a38818e55..10970c25bbf 100644 --- a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts +++ b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts @@ -440,18 +440,17 @@ suite('KeybindingsMerge - No Conflicts', () => { }); -if (OS !== OperatingSystem.Windows) { - suite('KeybindingsMerge - Conflicts', () => { +suite.skip('KeybindingsMerge - Conflicts', () => { - test('merge when local and remote with one entry but different value', async () => { - const localContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const actual = await mergeKeybindings(localContent, remoteContent, null); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when local and remote with one entry but different value', async () => { + const localContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const actual = await mergeKeybindings(localContent, remoteContent, null); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+d", @@ -468,22 +467,22 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); + }); - test('merge when local and remote with different keybinding', async () => { - const localContent = stringify([ - { key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }, - { key: 'alt+a', command: '-a', when: 'editorTextFocus && !editorReadonly' } - ]); - const remoteContent = stringify([ - { key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }, - { key: 'alt+a', command: '-a', when: 'editorTextFocus && !editorReadonly' } - ]); - const actual = await mergeKeybindings(localContent, remoteContent, null); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when local and remote with different keybinding', async () => { + const localContent = stringify([ + { key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }, + { key: 'alt+a', command: '-a', when: 'editorTextFocus && !editorReadonly' } + ]); + const remoteContent = stringify([ + { key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }, + { key: 'alt+a', command: '-a', when: 'editorTextFocus && !editorReadonly' } + ]); + const actual = await mergeKeybindings(localContent, remoteContent, null); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+d", @@ -510,17 +509,17 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); + }); - test('merge when the entry is removed in local but updated in remote', async () => { - const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const localContent = stringify([]); - const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const actual = await mergeKeybindings(localContent, remoteContent, baseContent); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when the entry is removed in local but updated in remote', async () => { + const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const localContent = stringify([]); + const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const actual = await mergeKeybindings(localContent, remoteContent, baseContent); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [] ======= [ @@ -531,17 +530,17 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); + }); - test('merge when the entry is removed in local but updated in remote and a new entry is added in local', async () => { - const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const localContent = stringify([{ key: 'alt+b', command: 'b' }]); - const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const actual = await mergeKeybindings(localContent, remoteContent, baseContent); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when the entry is removed in local but updated in remote and a new entry is added in local', async () => { + const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const localContent = stringify([{ key: 'alt+b', command: 'b' }]); + const remoteContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const actual = await mergeKeybindings(localContent, remoteContent, baseContent); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+b", @@ -557,17 +556,17 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); + }); - test('merge when the entry is removed in remote but updated in local', async () => { - const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const localContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const remoteContent = stringify([]); - const actual = await mergeKeybindings(localContent, remoteContent, baseContent); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when the entry is removed in remote but updated in local', async () => { + const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const localContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const remoteContent = stringify([]); + const actual = await mergeKeybindings(localContent, remoteContent, baseContent); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+c", @@ -578,17 +577,17 @@ if (OS !== OperatingSystem.Windows) { ======= [] >>>>>>> remote`); - }); + }); - test('merge when the entry is removed in remote but updated in local and a new entry is added in remote', async () => { - const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const localContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); - const remoteContent = stringify([{ key: 'alt+b', command: 'b' }]); - const actual = await mergeKeybindings(localContent, remoteContent, baseContent); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when the entry is removed in remote but updated in local and a new entry is added in remote', async () => { + const baseContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const localContent = stringify([{ key: 'alt+c', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); + const remoteContent = stringify([{ key: 'alt+b', command: 'b' }]); + const actual = await mergeKeybindings(localContent, remoteContent, baseContent); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+c", @@ -608,39 +607,39 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); + }); - test('merge when local and remote has moved forwareded with conflicts', async () => { - const baseContent = stringify([ - { key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }, - { key: 'alt+c', command: '-a' }, - { key: 'cmd+e', command: 'd' }, - { key: 'alt+a', command: 'f' }, - { key: 'alt+d', command: '-f' }, - { key: 'cmd+d', command: 'c', when: 'context1' }, - { key: 'cmd+c', command: '-c' }, - ]); - const localContent = stringify([ - { key: 'alt+d', command: '-f' }, - { key: 'cmd+e', command: 'd' }, - { key: 'cmd+c', command: '-c' }, - { key: 'cmd+d', command: 'c', when: 'context1' }, - { key: 'alt+a', command: 'f' }, - { key: 'alt+e', command: 'e' }, - ]); - const remoteContent = stringify([ - { key: 'alt+a', command: 'f' }, - { key: 'cmd+c', command: '-c' }, - { key: 'cmd+d', command: 'd' }, - { key: 'alt+d', command: '-f' }, - { key: 'alt+c', command: 'c', when: 'context1' }, - { key: 'alt+g', command: 'g', when: 'context2' }, - ]); - const actual = await mergeKeybindings(localContent, remoteContent, baseContent); - assert.ok(actual.hasChanges); - assert.ok(actual.hasConflicts); - assert.equal(actual.mergeContent, - `<<<<<<< local + test('merge when local and remote has moved forwareded with conflicts', async () => { + const baseContent = stringify([ + { key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }, + { key: 'alt+c', command: '-a' }, + { key: 'cmd+e', command: 'd' }, + { key: 'alt+a', command: 'f' }, + { key: 'alt+d', command: '-f' }, + { key: 'cmd+d', command: 'c', when: 'context1' }, + { key: 'cmd+c', command: '-c' }, + ]); + const localContent = stringify([ + { key: 'alt+d', command: '-f' }, + { key: 'cmd+e', command: 'd' }, + { key: 'cmd+c', command: '-c' }, + { key: 'cmd+d', command: 'c', when: 'context1' }, + { key: 'alt+a', command: 'f' }, + { key: 'alt+e', command: 'e' }, + ]); + const remoteContent = stringify([ + { key: 'alt+a', command: 'f' }, + { key: 'cmd+c', command: '-c' }, + { key: 'cmd+d', command: 'd' }, + { key: 'alt+d', command: '-f' }, + { key: 'alt+c', command: 'c', when: 'context1' }, + { key: 'alt+g', command: 'g', when: 'context2' }, + ]); + const actual = await mergeKeybindings(localContent, remoteContent, baseContent); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `<<<<<<< local [ { "key": "alt+d", @@ -703,11 +702,10 @@ if (OS !== OperatingSystem.Windows) { } ] >>>>>>> remote`); - }); - }); -} +}); + async function mergeKeybindings(localContent: string, remoteContent: string, baseContent: string | null) { const userDataSyncUtilService = new MockUserDataSyncUtilService(); From c723666fb0df256a1def31b413c457be2adaa7ad Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 2 Dec 2019 16:28:22 +0100 Subject: [PATCH 022/637] Clearer indication of what is input and what is output in debug console fixes #37363 --- src/vs/workbench/contrib/debug/browser/media/repl.css | 6 ++++++ src/vs/workbench/contrib/debug/browser/repl.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/debug/browser/media/repl.css b/src/vs/workbench/contrib/debug/browser/media/repl.css index 68c1f96bacc..ecec955ca92 100644 --- a/src/vs/workbench/contrib/debug/browser/media/repl.css +++ b/src/vs/workbench/contrib/debug/browser/media/repl.css @@ -39,6 +39,12 @@ flex: 1; } +.repl .repl-tree .monaco-tl-contents .arrow { + position:absolute; + left: 2px; + opacity: 0.3; +} + .repl .repl-tree .output.expression.value-and-source .source { margin-left: 4px; margin-right: 8px; diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index 4ff31849ccd..df3ba1ceef0 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -610,6 +610,7 @@ class ReplEvaluationInputsRenderer implements ITreeRenderer Date: Mon, 2 Dec 2019 16:29:20 +0100 Subject: [PATCH 023/637] Fix #85052 --- src/vs/platform/userDataSync/common/extensionsSync.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index 720d0d86ccc..502384a6731 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -166,7 +166,7 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser // First time sync if (!remoteExtensions) { this.logService.info('Extensions: Remote extensions does not exist. Synchronizing extensions for the first time.'); - return { added: [], removed: [], updated: [], remote: localExtensions.filter(({ identifier }) => ignoredExtensions.some(id => id.toLowerCase() === identifier.id.toLowerCase())) }; + return { added: [], removed: [], updated: [], remote: localExtensions.filter(({ identifier }) => ignoredExtensions.every(id => id.toLowerCase() !== identifier.id.toLowerCase())) }; } const uuids: Map = new Map(); From 6a92fcc7a65b7d1f71d7e09374b462b6f1eac11d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 16:30:59 +0100 Subject: [PATCH 024/637] fix tests --- .../platform/userDataSync/test/common/keybindingsMerge.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts index 10970c25bbf..85ad7a36b13 100644 --- a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts +++ b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts @@ -714,8 +714,7 @@ async function mergeKeybindings(localContent: string, remoteContent: string, bas } function stringify(value: any): string { - const result = JSON.stringify(value, null, '\t'); - return OS === OperatingSystem.Windows ? result.replace('\n', '\r\n') : result; + return JSON.stringify(value, null, '\t'); } class MockUserDataSyncUtilService implements IUserDataSyncUtilService { From 7ac8b2a8a0dec30995df6a0f1108c1ec47eca8ea Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 2 Dec 2019 16:31:50 +0100 Subject: [PATCH 025/637] repl: stronger arros in dark theme --- src/vs/workbench/contrib/debug/browser/media/repl.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/debug/browser/media/repl.css b/src/vs/workbench/contrib/debug/browser/media/repl.css index ecec955ca92..96b7e52d65d 100644 --- a/src/vs/workbench/contrib/debug/browser/media/repl.css +++ b/src/vs/workbench/contrib/debug/browser/media/repl.css @@ -45,6 +45,10 @@ opacity: 0.3; } +.vs-dark .repl .repl-tree .monaco-tl-contents .arrow { + opacity: 0.45; +} + .repl .repl-tree .output.expression.value-and-source .source { margin-left: 4px; margin-right: 8px; From 350e8d2bfd20f8546895e8ecfc81eb5f14db89fa Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 2 Dec 2019 16:35:46 +0100 Subject: [PATCH 026/637] for now, disable outline navigation #46153 --- .../workbench/contrib/outline/browser/outline.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts index 37462197013..33ab1f4a348 100644 --- a/src/vs/workbench/contrib/outline/browser/outline.contribution.ts +++ b/src/vs/workbench/contrib/outline/browser/outline.contribution.ts @@ -11,7 +11,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { OutlineConfigKeys, OutlineViewId } from 'vs/editor/contrib/documentSymbols/outline'; -import './outlineNavigation'; +// import './outlineNavigation'; const _outlineDesc = { id: OutlineViewId, From f4fa05e0aecdb5b2eb658686df95e00c2d06a079 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 2 Dec 2019 16:41:51 +0100 Subject: [PATCH 027/637] fix typo --- src/vs/vscode.proposed.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 5d2f4c6e87c..e9cc058941c 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -825,7 +825,7 @@ declare module 'vscode' { readonly creationOptions: Readonly; } - //#endregionn + //#endregion //#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718 From 888c06f60542c829d567e43721a8174c5351a03f Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 18:38:10 +0100 Subject: [PATCH 028/637] Change log name to Sync --- src/vs/workbench/contrib/logs/common/logs.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/logs/common/logs.contribution.ts b/src/vs/workbench/contrib/logs/common/logs.contribution.ts index 7a1a767f67a..70a088ed9f8 100644 --- a/src/vs/workbench/contrib/logs/common/logs.contribution.ts +++ b/src/vs/workbench/contrib/logs/common/logs.contribution.ts @@ -45,7 +45,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution { } private registerCommonContributions(): void { - this.registerLogChannel(Constants.userDataSyncLogChannelId, nls.localize('userDataSyncLog', "Configuration Sync"), this.environmentService.userDataSyncLogResource); + this.registerLogChannel(Constants.userDataSyncLogChannelId, nls.localize('userDataSyncLog', "Sync"), this.environmentService.userDataSyncLogResource); this.registerLogChannel(Constants.rendererLogChannelId, nls.localize('rendererLog', "Window"), this.environmentService.logFile); } From 573df438dbb97795ea6ce3c242c27f0dcd8b43dc Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Mon, 2 Dec 2019 10:41:08 -0800 Subject: [PATCH 029/637] Add minimap.errorHighlight and minimap.warningHighlight theme colors, #82291 --- .../editor/common/services/markerDecorationsServiceImpl.ts | 5 +++-- src/vs/platform/theme/common/colorRegistry.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts index fbf9037fa91..44fd54c6c6d 100644 --- a/src/vs/editor/common/services/markerDecorationsServiceImpl.ts +++ b/src/vs/editor/common/services/markerDecorationsServiceImpl.ts @@ -17,6 +17,7 @@ import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDeco import { Schemas } from 'vs/base/common/network'; import { Emitter, Event } from 'vs/base/common/event'; import { withUndefinedAsNull } from 'vs/base/common/types'; +import { minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry'; function MODEL_ID(resource: URI): string { return resource.toString(); @@ -205,7 +206,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor color = themeColorFromId(overviewRulerWarning); zIndex = 20; minimap = { - color, + color: themeColorFromId(minimapWarning), position: MinimapPosition.Inline }; break; @@ -220,7 +221,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor color = themeColorFromId(overviewRulerError); zIndex = 30; minimap = { - color, + color: themeColorFromId(minimapError), position: MinimapPosition.Inline }; break; diff --git a/src/vs/platform/theme/common/colorRegistry.ts b/src/vs/platform/theme/common/colorRegistry.ts index 864db693fd1..43163b757bc 100644 --- a/src/vs/platform/theme/common/colorRegistry.ts +++ b/src/vs/platform/theme/common/colorRegistry.ts @@ -422,6 +422,8 @@ export const overviewRulerSelectionHighlightForeground = registerColor('editorOv export const minimapFindMatch = registerColor('minimap.findMatchHighlight', { light: '#d18616', dark: '#d18616', hc: '#AB5A00' }, nls.localize('minimapFindMatchHighlight', 'Minimap marker color for find matches.'), true); export const minimapSelection = registerColor('minimap.selectionHighlight', { light: '#ADD6FF', dark: '#264F78', hc: '#ffffff' }, nls.localize('minimapSelectionHighlight', 'Minimap marker color for the editor selection.'), true); +export const minimapError = registerColor('minimap.errorHighlight', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hc: new Color(new RGBA(255, 50, 50, 1)) }, nls.localize('minimapError', 'Minimap marker color for errors.')); +export const minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Minimap marker color for warnings.')); export const problemsErrorIconForeground = registerColor('problemsErrorIcon.foreground', { dark: editorErrorForeground, light: editorErrorForeground, hc: editorErrorForeground }, nls.localize('problemsErrorIconForeground', "The color used for the problems error icon.")); export const problemsWarningIconForeground = registerColor('problemsWarningIcon.foreground', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningForeground }, nls.localize('problemsWarningIconForeground', "The color used for the problems warning icon.")); From a1affdefd7cf470c37205dd89ad00fbe23fb9f0d Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Mon, 2 Dec 2019 10:51:34 -0800 Subject: [PATCH 030/637] minimap - do not render decorations outside the viewport Fixes #85817 --- src/vs/editor/browser/viewParts/minimap/minimap.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/editor/browser/viewParts/minimap/minimap.ts b/src/vs/editor/browser/viewParts/minimap/minimap.ts index 4703c176847..a90678b1fe0 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimap.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimap.ts @@ -850,6 +850,11 @@ export class Minimap extends ViewPart { charWidth: number): void { const y = (lineNumber - layout.startLineNumber) * lineHeight; + // Skip rendering the line if it's vertically outside our viewport + if (y + height < 0 || y > this._options.canvasOuterHeight) { + return; + } + // Cache line offset data so that it is only read once per line let lineIndexToXOffset = lineOffsetMap.get(lineNumber); const isFirstDecorationForLine = !lineIndexToXOffset; From 3d772fb16433dedf16637ebf0fe0740019864c97 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Mon, 2 Dec 2019 11:30:17 -0800 Subject: [PATCH 031/637] minimap - only create char renderer when needed --- src/vs/editor/browser/viewParts/minimap/minimap.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/browser/viewParts/minimap/minimap.ts b/src/vs/editor/browser/viewParts/minimap/minimap.ts index a90678b1fe0..b2b451023ee 100644 --- a/src/vs/editor/browser/viewParts/minimap/minimap.ts +++ b/src/vs/editor/browser/viewParts/minimap/minimap.ts @@ -33,6 +33,7 @@ import { Color } from 'vs/base/common/color'; import { GestureEvent, EventType, Gesture } from 'vs/base/browser/touch'; import { MinimapCharRendererFactory } from 'vs/editor/browser/viewParts/minimap/minimapCharRendererFactory'; import { MinimapPosition } from 'vs/editor/common/model'; +import { once } from 'vs/base/common/functional'; function getMinimapLineHeight(renderMinimap: RenderMinimap, scale: number): number { if (renderMinimap === RenderMinimap.Text) { @@ -73,7 +74,7 @@ class MinimapOptions { public readonly fontScale: number; - public readonly charRenderer: MinimapCharRenderer; + public readonly charRenderer: () => MinimapCharRenderer; /** * container dom node left position (in CSS px) @@ -117,7 +118,7 @@ class MinimapOptions { const minimapOpts = options.get(EditorOption.minimap); this.showSlider = minimapOpts.showSlider; this.fontScale = Math.round(minimapOpts.scale * pixelRatio); - this.charRenderer = MinimapCharRendererFactory.create(this.fontScale, fontInfo.fontFamily); + this.charRenderer = once(() => MinimapCharRendererFactory.create(this.fontScale, fontInfo.fontFamily)); this.pixelRatio = pixelRatio; this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth; this.lineHeight = options.get(EditorOption.lineHeight); @@ -905,6 +906,7 @@ export class Minimap extends ViewPart { private renderLines(layout: MinimapLayout): RenderData { const renderMinimap = this._options.renderMinimap; + const charRenderer = this._options.charRenderer(); const startLineNumber = layout.startLineNumber; const endLineNumber = layout.endLineNumber; const minimapLineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale); @@ -946,7 +948,7 @@ export class Minimap extends ViewPart { useLighterFont, renderMinimap, this._tokensColorTracker, - this._options.charRenderer, + charRenderer, dy, tabSize, lineInfo.data[lineIndex]!, From 92a1abd450e1a7402dc84b4f9a95272dbbaa6dd8 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 2 Dec 2019 11:40:43 -0800 Subject: [PATCH 032/637] Add a real setting for `search.enableSearchEditorPreview`. --- .../workbench/contrib/search/browser/search.contribution.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index fea95600589..af5b9c2f727 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -813,6 +813,11 @@ configurationRegistry.registerConfiguration({ type: 'number', default: 300, markdownDescription: nls.localize('search.searchOnTypeDebouncePeriod', "When `#search.searchOnType#` is enabled, controls the timeout in milliseconds between a character being typed and the search starting. Has no effect when `search.searchOnType` is disabled.") + }, + 'search.enableSearchEditorPreview': { + type: 'boolean', + default: false, + description: nls.localize('search.enableSearchEditorPreview', "Experimental: When enabled, allows opening workspace search results in an editor.") } } }); From 104f90e0ebdc56f04a7f5e12fd28c317c6931efc Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Mon, 2 Dec 2019 11:53:41 -0800 Subject: [PATCH 033/637] Fix #85715. Fix #85717 --- .../client/src/matchingTag.ts | 130 ++++++++++++------ 1 file changed, 85 insertions(+), 45 deletions(-) diff --git a/extensions/html-language-features/client/src/matchingTag.ts b/extensions/html-language-features/client/src/matchingTag.ts index 6816c2c5e32..d12726d35da 100644 --- a/extensions/html-language-features/client/src/matchingTag.ts +++ b/extensions/html-language-features/client/src/matchingTag.ts @@ -45,8 +45,8 @@ export function activateMatchingTagPosition( isEnabled = true; } - let prevCursorCount = 0; - let cursorCount = 0; + let prevCursors: readonly Selection[] = []; + let cursors: readonly Selection[] = []; let inMirrorMode = false; function onDidChangeTextEditorSelection(event: TextEditorSelectionChangeEvent) { @@ -54,67 +54,67 @@ export function activateMatchingTagPosition( return; } - prevCursorCount = cursorCount; - cursorCount = event.selections.length; + prevCursors = cursors; + cursors = event.selections; - if (cursorCount === 1) { - if (inMirrorMode && prevCursorCount === 2) { - return; + if (cursors.length === 1) { + if (inMirrorMode && prevCursors.length === 2) { + if (cursors[0].isEqual(prevCursors[0]) || cursors[0].isEqual(prevCursors[1])) { + return; + } } if (event.selections[0].isEmpty) { - matchingTagPositionProvider(event.textEditor.document, event.selections[0].active).then(position => { - if (position && window.activeTextEditor) { - inMirrorMode = true; - const newCursor = new Selection(position.line, position.character, position.line, position.character); - window.activeTextEditor.selections = [...window.activeTextEditor.selections, newCursor]; + matchingTagPositionProvider(event.textEditor.document, event.selections[0].active).then(matchingTagPosition => { + if (matchingTagPosition && window.activeTextEditor) { + const charBeforeAndAfterPositionsRoughtlyEqual = isCharBeforeAndAfterPositionsRoughtlyEqual( + event.textEditor.document, + event.selections[0].anchor, + new Position(matchingTagPosition.line, matchingTagPosition.character) + ); + + if (charBeforeAndAfterPositionsRoughtlyEqual) { + inMirrorMode = true; + const newCursor = new Selection( + matchingTagPosition.line, + matchingTagPosition.character, + matchingTagPosition.line, + matchingTagPosition.character + ); + window.activeTextEditor.selections = [...window.activeTextEditor.selections, newCursor]; + } } }); } } - if (cursorCount === 2 && inMirrorMode) { + if (cursors.length === 2 && inMirrorMode) { // Check two cases if (event.selections[0].isEmpty && event.selections[1].isEmpty) { - const charBeforePrimarySelection = getCharBefore(event.textEditor.document, event.selections[0].anchor); - const charAfterPrimarySelection = getCharAfter(event.textEditor.document, event.selections[0].anchor); - const charBeforeSecondarySelection = getCharBefore(event.textEditor.document, event.selections[1].anchor); - const charAfterSecondarySelection = getCharAfter(event.textEditor.document, event.selections[1].anchor); + const charBeforeAndAfterPositionsRoughtlyEqual = isCharBeforeAndAfterPositionsRoughtlyEqual( + event.textEditor.document, + event.selections[0].anchor, + event.selections[1].anchor + ); - // Exit mirror mode when cursor position no longer mirror - // Unless it's in the case of `<|>` - const charBeforeBothPositionRoughlyEqual = - charBeforePrimarySelection === charBeforeSecondarySelection || - (charBeforePrimarySelection === '/' && charBeforeSecondarySelection === '<') || - (charBeforeSecondarySelection === '/' && charBeforePrimarySelection === '<'); - const charAfterBothPositionRoughlyEqual = - charAfterPrimarySelection === charAfterSecondarySelection || - (charAfterPrimarySelection === ' ' && charAfterSecondarySelection === '>') || - (charAfterSecondarySelection === ' ' && charAfterPrimarySelection === '>'); - - if (!charBeforeBothPositionRoughlyEqual || !charAfterBothPositionRoughlyEqual) { + if (!charBeforeAndAfterPositionsRoughtlyEqual) { inMirrorMode = false; window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; return; } else { // Need to cleanup in the case of
if ( - charBeforePrimarySelection === ' ' && - charAfterPrimarySelection === '>' && - charBeforeSecondarySelection === ' ' && - charAfterSecondarySelection === '>' + shouldDoCleanupForHtmlAttributeInput( + event.textEditor.document, + event.selections[0].anchor, + event.selections[1].anchor + ) ) { - const primaryBeforeSecondary = - event.textEditor.document.offsetAt(event.selections[0].anchor) < - event.textEditor.document.offsetAt(event.selections[1].anchor); - - if (primaryBeforeSecondary) { - inMirrorMode = false; - const cleanupEdit = new WorkspaceEdit(); - const cleanupRange = new Range(event.selections[1].anchor.translate(0, -1), event.selections[1].anchor); - cleanupEdit.replace(event.textEditor.document.uri, cleanupRange, ''); - window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; - workspace.applyEdit(cleanupEdit); - } + inMirrorMode = false; + const cleanupEdit = new WorkspaceEdit(); + const cleanupRange = new Range(event.selections[1].anchor.translate(0, -1), event.selections[1].anchor); + cleanupEdit.replace(event.textEditor.document.uri, cleanupRange, ''); + window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; + workspace.applyEdit(cleanupEdit); } } } @@ -141,3 +141,43 @@ function getCharAfter(document: TextDocument, position: Position) { return document.getText(new Range(position, document.positionAt(offset + 1))); } + +// Check if chars before and after the two positions are equal +// For the chars before, `<` and `/` are consiered equal to handle the case of `<|>` +function isCharBeforeAndAfterPositionsRoughtlyEqual(document: TextDocument, firstPos: Position, secondPos: Position) { + const charBeforePrimarySelection = getCharBefore(document, firstPos); + const charAfterPrimarySelection = getCharAfter(document, firstPos); + const charBeforeSecondarySelection = getCharBefore(document, secondPos); + const charAfterSecondarySelection = getCharAfter(document, secondPos); + + // Exit mirror mode when cursor position no longer mirror + // Unless it's in the case of `<|>` + const charBeforeBothPositionRoughlyEqual = + charBeforePrimarySelection === charBeforeSecondarySelection || + (charBeforePrimarySelection === '/' && charBeforeSecondarySelection === '<') || + (charBeforeSecondarySelection === '/' && charBeforePrimarySelection === '<'); + const charAfterBothPositionRoughlyEqual = + charAfterPrimarySelection === charAfterSecondarySelection || + (charAfterPrimarySelection === ' ' && charAfterSecondarySelection === '>') || + (charAfterSecondarySelection === ' ' && charAfterPrimarySelection === '>'); + + return charBeforeBothPositionRoughlyEqual && charAfterBothPositionRoughlyEqual; +} + +function shouldDoCleanupForHtmlAttributeInput(document: TextDocument, firstPos: Position, secondPos: Position) { + // Need to cleanup in the case of
+ const charBeforePrimarySelection = getCharBefore(document, firstPos); + const charAfterPrimarySelection = getCharAfter(document, firstPos); + const charBeforeSecondarySelection = getCharBefore(document, secondPos); + const charAfterSecondarySelection = getCharAfter(document, secondPos); + + const primaryBeforeSecondary = document.offsetAt(firstPos) < document.offsetAt(secondPos); + + return ( + primaryBeforeSecondary && + charBeforePrimarySelection === ' ' && + charAfterPrimarySelection === '>' && + charBeforeSecondarySelection === ' ' && + charAfterSecondarySelection === '>' + ); +} From 5f1b81b4976cc6a31d46befb828c0fe64ce47f49 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 2 Dec 2019 21:43:59 +0100 Subject: [PATCH 034/637] [css/html/json] provide replace & insert proposals --- .../client/src/cssMain.ts | 29 ++- extensions/css-language-features/package.json | 11 + .../client/src/htmlMain.ts | 29 ++- .../html-language-features/package.json | 8 + .../client/src/jsonMain.ts | 36 ++- .../json-language-features/package.json | 217 +++++++++--------- .../npm/src/features/jsonContributions.ts | 19 +- 7 files changed, 227 insertions(+), 122 deletions(-) diff --git a/extensions/css-language-features/client/src/cssMain.ts b/extensions/css-language-features/client/src/cssMain.ts index 1bc18bf6346..936176e9103 100644 --- a/extensions/css-language-features/client/src/cssMain.ts +++ b/extensions/css-language-features/client/src/cssMain.ts @@ -5,8 +5,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { commands, CompletionItem, CompletionItemKind, ExtensionContext, languages, Position, Range, SnippetString, TextEdit, window, workspace } from 'vscode'; -import { Disposable, LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient'; +import { commands, CompletionItem, CompletionItemKind, ExtensionContext, languages, Position, Range, SnippetString, TextEdit, window, workspace, TextDocument, CompletionContext, CancellationToken, ProviderResult, CompletionList } from 'vscode'; +import { Disposable, LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, ProvideCompletionItemsSignature } from 'vscode-languageclient'; import * as nls from 'vscode-nls'; import { getCustomDataPathsFromAllExtensions, getCustomDataPathsInAllWorkspaces } from './customData'; @@ -43,6 +43,31 @@ export function activate(context: ExtensionContext) { }, initializationOptions: { dataPaths + }, + middleware: { + // testing the replace / insert mode + provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult { + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range2 = { inserting: new Range(range.start, position), replacing: range }; + item.range = undefined; + } + } + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); + } } }; diff --git a/extensions/css-language-features/package.json b/extensions/css-language-features/package.json index 702d9d755ca..ba1c6f95918 100644 --- a/extensions/css-language-features/package.json +++ b/extensions/css-language-features/package.json @@ -783,6 +783,17 @@ } } ], + "configurationDefaults": { + "[css]": { + "editor.suggest.insertMode": "replace" + }, + "[scss]": { + "editor.suggest.insertMode": "replace" + }, + "[less]": { + "editor.suggest.insertMode": "replace" + } + }, "jsonValidation": [ { "fileMatch": "*.css-data.json", diff --git a/extensions/html-language-features/client/src/htmlMain.ts b/extensions/html-language-features/client/src/htmlMain.ts index 194935b25fc..4d900214bd1 100644 --- a/extensions/html-language-features/client/src/htmlMain.ts +++ b/extensions/html-language-features/client/src/htmlMain.ts @@ -8,8 +8,8 @@ import * as fs from 'fs'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, Disposable, FormattingOptions, CancellationToken, ProviderResult, TextEdit } from 'vscode'; -import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams, DocumentRangeFormattingParams, DocumentRangeFormattingRequest } from 'vscode-languageclient'; +import { languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, Disposable, FormattingOptions, CancellationToken, ProviderResult, TextEdit, CompletionContext, CompletionList } from 'vscode'; +import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, TextDocumentPositionParams, DocumentRangeFormattingParams, DocumentRangeFormattingRequest, ProvideCompletionItemsSignature } from 'vscode-languageclient'; import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared'; import { activateTagClosing } from './tagClosing'; import TelemetryReporter from 'vscode-extension-telemetry'; @@ -72,6 +72,31 @@ export function activate(context: ExtensionContext) { dataPaths, provideFormatter: false, // tell the server to not provide formatting capability and ignore the `html.format.enable` setting. }, + middleware: { + // testing the replace / insert mode + provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult { + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range2 = { inserting: new Range(range.start, position), replacing: range }; + item.range = undefined; + } + } + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); + } + } }; // Create the language client and start the client. diff --git a/extensions/html-language-features/package.json b/extensions/html-language-features/package.json index a641eb4ca46..5dedb79987b 100644 --- a/extensions/html-language-features/package.json +++ b/extensions/html-language-features/package.json @@ -180,6 +180,14 @@ } } }, + "configurationDefaults": { + "[html]": { + "editor.suggest.insertMode": "replace" + }, + "[handlebars]": { + "editor.suggest.insertMode": "replace" + } + }, "jsonValidation": [ { "fileMatch": "*.html-data.json", diff --git a/extensions/json-language-features/client/src/jsonMain.ts b/extensions/json-language-features/client/src/jsonMain.ts index d7c6684b3f2..23c42f795c9 100644 --- a/extensions/json-language-features/client/src/jsonMain.ts +++ b/extensions/json-language-features/client/src/jsonMain.ts @@ -10,8 +10,16 @@ import { xhr, XHRResponse, getErrorStatusDescription } from 'request-light'; const localize = nls.loadMessageBundle(); -import { workspace, window, languages, commands, ExtensionContext, extensions, Uri, LanguageConfiguration, Diagnostic, StatusBarAlignment, TextEditor, TextDocument, FormattingOptions, CancellationToken, ProviderResult, TextEdit, Range, Disposable } from 'vscode'; -import { LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType, DidChangeConfigurationNotification, HandleDiagnosticsSignature, ResponseError, DocumentRangeFormattingParams, DocumentRangeFormattingRequest } from 'vscode-languageclient'; +import { + workspace, window, languages, commands, ExtensionContext, extensions, Uri, LanguageConfiguration, + Diagnostic, StatusBarAlignment, TextEditor, TextDocument, FormattingOptions, CancellationToken, + ProviderResult, TextEdit, Range, Position, Disposable, CompletionItem, CompletionList, CompletionContext +} from 'vscode'; +import { + LanguageClient, LanguageClientOptions, RequestType, ServerOptions, TransportKind, NotificationType, + DidChangeConfigurationNotification, HandleDiagnosticsSignature, ResponseError, DocumentRangeFormattingParams, + DocumentRangeFormattingRequest, ProvideCompletionItemsSignature +} from 'vscode-languageclient'; import TelemetryReporter from 'vscode-extension-telemetry'; import { hash } from './utils/hash'; @@ -132,6 +140,29 @@ export function activate(context: ExtensionContext) { } next(uri, diagnostics); + }, + // testing the replace / insert mode + provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult { + function updateRanges(item: CompletionItem) { + const range = item.range; + if (range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) { + item.range2 = { inserting: new Range(range.start, position), replacing: range }; + item.range = undefined; + } + } + function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined { + if (r) { + (Array.isArray(r) ? r : r.items).forEach(updateRanges); + } + return r; + } + const isThenable = (obj: ProviderResult): obj is Thenable => obj && (obj)['then']; + + const r = next(document, position, context, token); + if (isThenable(r)) { + return r.then(updateProposals); + } + return updateProposals(r); } } }; @@ -422,5 +453,4 @@ function readJSONFile(location: string) { console.log(`Problems reading ${location}: ${e}`); return {}; } - } diff --git a/extensions/json-language-features/package.json b/extensions/json-language-features/package.json index 833059f3c83..37417289ed2 100644 --- a/extensions/json-language-features/package.json +++ b/extensions/json-language-features/package.json @@ -1,113 +1,114 @@ { - "name": "json-language-features", - "displayName": "%displayName%", - "description": "%description%", - "version": "1.0.0", - "publisher": "vscode", - "license": "MIT", - "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", - "engines": { - "vscode": "0.10.x" - }, - "icon": "icons/json.png", - "activationEvents": [ - "onLanguage:json", - "onLanguage:jsonc" - ], - "main": "./client/out/jsonMain", - "enableProposedApi": true, - "scripts": { - "compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server", - "watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server", - "postinstall": "cd server && yarn install", - "install-client-next": "yarn add vscode-languageclient@next" - }, - "categories": [ - "Programming Languages" - ], - "contributes": { - "configuration": { - "id": "json", - "order": 20, - "type": "object", - "title": "JSON", - "properties": { - "json.schemas": { - "type": "array", - "scope": "resource", - "description": "%json.schemas.desc%", - "items": { - "type": "object", - "default": { - "fileMatch": [ - "/myfile" - ], - "url": "schemaURL" - }, - "properties": { - "url": { - "type": "string", - "default": "/user.schema.json", - "description": "%json.schemas.url.desc%" - }, - "fileMatch": { - "type": "array", - "items": { - "type": "string", - "default": "MyFile.json", - "description": "%json.schemas.fileMatch.item.desc%" - }, - "minItems": 1, - "description": "%json.schemas.fileMatch.desc%" - }, - "schema": { - "$ref": "http://json-schema.org/draft-07/schema#", - "description": "%json.schemas.schema.desc%" - } - } - } - }, - "json.format.enable": { - "type": "boolean", - "scope": "window", - "default": true, - "description": "%json.format.enable.desc%" - }, - "json.trace.server": { - "type": "string", - "scope": "window", - "enum": [ - "off", - "messages", - "verbose" - ], - "default": "off", - "description": "%json.tracing.desc%" - }, - "json.colorDecorators.enable": { - "type": "boolean", - "scope": "window", - "default": true, - "description": "%json.colorDecorators.enable.desc%", - "deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%" - } - } + "name": "json-language-features", + "displayName": "%displayName%", + "description": "%description%", + "version": "1.0.0", + "publisher": "vscode", + "license": "MIT", + "aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217", + "engines": { + "vscode": "0.10.x" }, - "configurationDefaults": { - "[json]": { - "editor.quickSuggestions": { - "strings": true + "icon": "icons/json.png", + "activationEvents": [ + "onLanguage:json", + "onLanguage:jsonc" + ], + "main": "./client/out/jsonMain", + "enableProposedApi": true, + "scripts": { + "compile": "gulp compile-extension:json-language-features-client compile-extension:json-language-features-server", + "watch": "gulp watch-extension:json-language-features-client watch-extension:json-language-features-server", + "postinstall": "cd server && yarn install", + "install-client-next": "yarn add vscode-languageclient@next" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "configuration": { + "id": "json", + "order": 20, + "type": "object", + "title": "JSON", + "properties": { + "json.schemas": { + "type": "array", + "scope": "resource", + "description": "%json.schemas.desc%", + "items": { + "type": "object", + "default": { + "fileMatch": [ + "/myfile" + ], + "url": "schemaURL" + }, + "properties": { + "url": { + "type": "string", + "default": "/user.schema.json", + "description": "%json.schemas.url.desc%" + }, + "fileMatch": { + "type": "array", + "items": { + "type": "string", + "default": "MyFile.json", + "description": "%json.schemas.fileMatch.item.desc%" + }, + "minItems": 1, + "description": "%json.schemas.fileMatch.desc%" + }, + "schema": { + "$ref": "http://json-schema.org/draft-07/schema#", + "description": "%json.schemas.schema.desc%" + } + } + } + }, + "json.format.enable": { + "type": "boolean", + "scope": "window", + "default": true, + "description": "%json.format.enable.desc%" + }, + "json.trace.server": { + "type": "string", + "scope": "window", + "enum": [ + "off", + "messages", + "verbose" + ], + "default": "off", + "description": "%json.tracing.desc%" + }, + "json.colorDecorators.enable": { + "type": "boolean", + "scope": "window", + "default": true, + "description": "%json.colorDecorators.enable.desc%", + "deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%" + } + } + }, + "configurationDefaults": { + "[json]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace" + } } - } + }, + "dependencies": { + "request-light": "^0.2.5", + "vscode-extension-telemetry": "0.1.1", + "vscode-languageclient": "^6.0.0-next.3", + "vscode-nls": "^4.1.1" + }, + "devDependencies": { + "@types/node": "^12.11.7" } - }, - "dependencies": { - "request-light": "^0.2.5", - "vscode-extension-telemetry": "0.1.1", - "vscode-languageclient": "^6.0.0-next.3", - "vscode-nls": "^4.1.1" - }, - "devDependencies": { - "@types/node": "^12.11.7" - } } diff --git a/extensions/npm/src/features/jsonContributions.ts b/extensions/npm/src/features/jsonContributions.ts index e59b7866ec3..af91f401201 100644 --- a/extensions/npm/src/features/jsonContributions.ts +++ b/extensions/npm/src/features/jsonContributions.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Location, getLocation, createScanner, SyntaxKind, ScanError } from 'jsonc-parser'; +import { Location, getLocation, createScanner, SyntaxKind, ScanError, JSONScanner } from 'jsonc-parser'; import { basename } from 'path'; import { BowerJSONContribution } from './bowerJSONContribution'; import { PackageJSONContribution } from './packageJSONContribution'; @@ -111,7 +111,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { add: (suggestion: CompletionItem) => { if (!proposed[suggestion.label]) { proposed[suggestion.label] = true; - suggestion.range = overwriteRange; + suggestion.range2 = { replacing: overwriteRange, inserting: new Range(overwriteRange.start, overwriteRange.start) }; items.push(suggestion); } }, @@ -123,8 +123,9 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { let collectPromise: Thenable | null = null; if (location.isAtPropertyKey) { - const addValue = !location.previousNode || !location.previousNode.colonOffset; - const isLast = this.isLast(document, position); + const scanner = createScanner(document.getText(), true); + const addValue = !location.previousNode || !this.hasColonAfter(scanner, location.previousNode.offset + location.previousNode.length); + const isLast = this.isLast(scanner, document.offsetAt(position)); collectPromise = this.jsonContribution.collectPropertySuggestions(fileName, location, currentWord, addValue, isLast, collector); } else { if (location.path.length === 0) { @@ -153,15 +154,19 @@ export class JSONCompletionItemProvider implements CompletionItemProvider { return text.substring(i + 1, position.character); } - private isLast(document: TextDocument, position: Position): boolean { - const scanner = createScanner(document.getText(), true); - scanner.setPosition(document.offsetAt(position)); + private isLast(scanner: JSONScanner, offset: number): boolean { + scanner.setPosition(offset); let nextToken = scanner.scan(); if (nextToken === SyntaxKind.StringLiteral && scanner.getTokenError() === ScanError.UnexpectedEndOfString) { nextToken = scanner.scan(); } return nextToken === SyntaxKind.CloseBraceToken || nextToken === SyntaxKind.EOF; } + private hasColonAfter(scanner: JSONScanner, offset: number): boolean { + scanner.setPosition(offset); + return scanner.scan() === SyntaxKind.ColonToken; + } + } export const xhrDisabled = () => Promise.reject({ responseText: 'Use of online resources is disabled.' }); From c2c96f3f461b9a0165a902d27cc5fd3b6f725a16 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Mon, 2 Dec 2019 21:54:16 +0100 Subject: [PATCH 035/637] [json] update service --- extensions/json-language-features/server/package.json | 2 +- extensions/json-language-features/server/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/json-language-features/server/package.json b/extensions/json-language-features/server/package.json index 6dc132cc742..b4992717f5b 100644 --- a/extensions/json-language-features/server/package.json +++ b/extensions/json-language-features/server/package.json @@ -14,7 +14,7 @@ "dependencies": { "jsonc-parser": "^2.2.0", "request-light": "^0.2.5", - "vscode-json-languageservice": "^3.4.7", + "vscode-json-languageservice": "^3.4.8", "vscode-languageserver": "^6.0.0-next.3", "vscode-uri": "^2.1.1" }, diff --git a/extensions/json-language-features/server/yarn.lock b/extensions/json-language-features/server/yarn.lock index f0fde79ab0c..b5fcaf44bab 100644 --- a/extensions/json-language-features/server/yarn.lock +++ b/extensions/json-language-features/server/yarn.lock @@ -80,10 +80,10 @@ request-light@^0.2.5: https-proxy-agent "^2.2.3" vscode-nls "^4.1.1" -vscode-json-languageservice@^3.4.7: - version "3.4.7" - resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.4.7.tgz#8d85f3c1d46a1e58e9867d747552fb8c83d934fd" - integrity sha512-y3MN2+/yph3yoIHGmHu4ScYpm285L58XVvfGkd49xTQzLja4apxSbwzsYcP9QsqS0W7KuvoyiPhqksiudoMwjg== +vscode-json-languageservice@^3.4.8: + version "3.4.8" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.4.8.tgz#2fc14e0a2603ed704ab57e29f3bcce75106be2bd" + integrity sha512-8h3VjUU4r37LVleIV7YGYs6MlnwHs4qR002cJsL3Z/ebrKzgab1OkwzGocAAJY21rnLhVy4KjnIy7oN1XGPlqA== dependencies: jsonc-parser "^2.2.0" vscode-languageserver-textdocument "^1.0.0-next.4" From 6b69213fa4d49cbdc1ffab32c019364cd696f5c6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Nov 2019 14:46:56 -0800 Subject: [PATCH 036/637] Dismiss custom editor on rename if the editor no longer matches the new resource name --- .../customEditor/browser/customEditorInput.ts | 18 ++++---- .../customEditor/browser/customEditors.ts | 27 +++++------- .../customEditor/common/customEditor.ts | 41 ++++++++++++++++--- 3 files changed, 56 insertions(+), 30 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index 78cba9eadda..edf216c14d9 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -159,12 +159,16 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { return this.fileDialogService.pickFileToSave({});//this.getSaveDialogOptions(defaultUri, availableFileSystems)); } - public handleMove(groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined { - const webview = assertIsDefined(this.takeOwnershipOfWebview()); - return this.instantiationService.createInstance(CustomFileEditorInput, - uri, - this.viewType, - generateUuid(), - new Lazy(() => webview)); + public handleMove(_groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined { + const editorInfo = this.customEditorService.getCustomEditor(this.viewType); + if (editorInfo?.matches(uri)) { + const webview = assertIsDefined(this.takeOwnershipOfWebview()); + return this.instantiationService.createInstance(CustomFileEditorInput, + uri, + this.viewType, + generateUuid(), + new Lazy(() => webview)); + } + return undefined; } } diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts index 9e87a796443..ea3e9dcdaf1 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import { coalesce, distinct, find, mergeSort } from 'vs/base/common/arrays'; -import * as glob from 'vs/base/common/glob'; import { Lazy } from 'vs/base/common/lazy'; import { Disposable } from 'vs/base/common/lifecycle'; import { basename, isEqual } from 'vs/base/common/resources'; @@ -32,14 +31,14 @@ import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/wo import { CustomFileEditorInput } from './customEditorInput'; const defaultEditorId = 'default'; -const defaultEditorInfo: CustomEditorInfo = { +const defaultEditorInfo = new CustomEditorInfo({ id: defaultEditorId, displayName: nls.localize('promptOpenWith.defaultEditor', "VS Code's standard text editor"), selector: [ { filenamePattern: '*' } ], priority: CustomEditorPriority.default, -}; +}); export class CustomEditorInfoStore { private readonly contributedEditors = new Map(); @@ -64,7 +63,7 @@ export class CustomEditorInfoStore { public getContributedEditors(resource: URI): readonly CustomEditorInfo[] { return Array.from(this.contributedEditors.values()).filter(customEditor => - customEditor.selector.some(selector => matches(selector, resource))); + customEditor.matches(resource)); } } @@ -97,12 +96,12 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ for (const extension of extensions) { for (const webviewEditorContribution of extension.value) { - this._editorInfoStore.add({ + this._editorInfoStore.add(new CustomEditorInfo({ id: webviewEditorContribution.viewType, displayName: webviewEditorContribution.displayName, selector: webviewEditorContribution.selector || [], priority: webviewEditorContribution.priority || CustomEditorPriority.default, - }); + })); } } this.updateContexts(); @@ -127,6 +126,10 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ return { resource, viewType: activeInput.viewType }; } + public getCustomEditor(viewType: string): CustomEditorInfo | undefined { + return this._editorInfoStore.get(viewType); + } + public getContributedCustomEditors(resource: URI): readonly CustomEditorInfo[] { return this._editorInfoStore.getContributedEditors(resource); } @@ -134,7 +137,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ public getUserConfiguredCustomEditors(resource: URI): readonly CustomEditorInfo[] { const rawAssociations = this.configurationService.getValue(customEditorsAssociationsKey) || []; return coalesce(rawAssociations - .filter(association => matches(association, resource)) + .filter(association => CustomEditorInfo.selectorMatches(association, resource)) .map(association => this._editorInfoStore.get(association.viewType))); } @@ -405,16 +408,6 @@ function priorityToRank(priority: CustomEditorPriority): number { } } -function matches(selector: CustomEditorSelector, resource: URI): boolean { - if (selector.filenamePattern) { - if (glob.match(selector.filenamePattern.toLowerCase(), basename(resource).toLowerCase())) { - return true; - } - } - - return false; -} - registerThemingParticipant((theme, collector) => { const shadow = theme.getColor(colorRegistry.scrollbarShadow); if (shadow) { diff --git a/src/vs/workbench/contrib/customEditor/common/customEditor.ts b/src/vs/workbench/contrib/customEditor/common/customEditor.ts index 9162ab0e3d2..135ffc819b7 100644 --- a/src/vs/workbench/contrib/customEditor/common/customEditor.ts +++ b/src/vs/workbench/contrib/customEditor/common/customEditor.ts @@ -4,11 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import { Event } from 'vs/base/common/event'; +import * as glob from 'vs/base/common/glob'; +import { basename } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { EditorInput, IEditor, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor'; +import { EditorInput, IEditor, IRevertOptions, ISaveOptions } from 'vs/workbench/common/editor'; import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IWorkingCopy } from 'vs/workbench/services/workingCopy/common/workingCopyService'; @@ -29,6 +31,7 @@ export interface ICustomEditorService { readonly activeCustomEditor: ICustomEditor | undefined; + getCustomEditor(viewType: string): CustomEditorInfo | undefined; getContributedCustomEditors(resource: URI): readonly CustomEditorInfo[]; getUserConfiguredCustomEditors(resource: URI): readonly CustomEditorInfo[]; @@ -87,9 +90,35 @@ export interface CustomEditorSelector { readonly filenamePattern?: string; } -export interface CustomEditorInfo { - readonly id: string; - readonly displayName: string; - readonly priority: CustomEditorPriority; - readonly selector: readonly CustomEditorSelector[]; +export class CustomEditorInfo { + + public readonly id: string; + public readonly displayName: string; + public readonly priority: CustomEditorPriority; + public readonly selector: readonly CustomEditorSelector[]; + + constructor(descriptor: { + readonly id: string; + readonly displayName: string; + readonly priority: CustomEditorPriority; + readonly selector: readonly CustomEditorSelector[]; + }) { + this.id = descriptor.id; + this.displayName = descriptor.displayName; + this.priority = descriptor.priority; + this.selector = descriptor.selector; + } + + matches(resource: URI): boolean { + return this.selector.some(selector => CustomEditorInfo.selectorMatches(selector, resource)); + } + + static selectorMatches(selector: CustomEditorSelector, resource: URI): boolean { + if (selector.filenamePattern) { + if (glob.match(selector.filenamePattern.toLowerCase(), basename(resource).toLowerCase())) { + return true; + } + } + return false; + } } From e33be1b0afbe9c3cb7234c6edf4b7a3f868f7d7e Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Nov 2019 15:30:01 -0800 Subject: [PATCH 037/637] Explicitly register for save and saveAs --- .../api/browser/mainThreadWebview.ts | 16 ++++++++++++++-- .../workbench/api/common/extHost.protocol.ts | 6 ++++++ src/vs/workbench/api/common/extHostWebview.ts | 19 +++++++++++++++---- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index 1bd635659f9..7af79adc7e2 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -280,8 +280,6 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma this._proxy.$applyEdits(handle, editsToApply); } }); - model.onWillSave(e => { e.waitUntil(this._proxy.$onSave(handle)); }); - model.onWillSaveAs(e => { e.waitUntil(this._proxy.$onSaveAs(handle, e.resource.toJSON(), e.targetResource.toJSON())); }); webviewInput.onDisposeWebview(() => { this._customEditorService.models.disposeModel(model); @@ -315,6 +313,20 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma this._editorProviders.delete(viewType); } + public async $registerCapabilities(handle: extHostProtocol.WebviewPanelHandle, capabilities: readonly extHostProtocol.WebviewEditorCapabilities[]): Promise { + const webviewInput = this.getWebviewInput(handle); + const model = await this._customEditorService.models.loadOrCreate(webviewInput.getResource(), webviewInput.viewType); + + const capabilitiesSet = new Set(capabilities); + + if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.Save)) { + model.onWillSave(e => { e.waitUntil(this._proxy.$onSave(handle)); }); + } + if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.SaveAs)) { + model.onWillSaveAs(e => { e.waitUntil(this._proxy.$onSaveAs(handle, e.resource.toJSON(), e.targetResource.toJSON())); }); + } + } + public $onEdit(handle: extHostProtocol.WebviewPanelHandle, editData: any): void { const webview = this.getWebviewInput(handle); if (!(webview instanceof CustomFileEditorInput)) { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 4bf6846bd20..4df48aeb239 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -556,6 +556,11 @@ export interface WebviewExtensionDescription { readonly location: UriComponents; } +export enum WebviewEditorCapabilities { + Save, + SaveAs, +} + export interface MainThreadWebviewsShape extends IDisposable { $createWebviewPanel(extension: WebviewExtensionDescription, handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: modes.IWebviewPanelOptions & modes.IWebviewOptions): void; $disposeWebview(handle: WebviewPanelHandle): void; @@ -573,6 +578,7 @@ export interface MainThreadWebviewsShape extends IDisposable { $registerEditorProvider(extension: WebviewExtensionDescription, viewType: string, options: modes.IWebviewPanelOptions): void; $unregisterEditorProvider(viewType: string): void; + $registerCapabilities(handle: WebviewPanelHandle, capabilities: readonly WebviewEditorCapabilities[]): void; $onEdit(handle: WebviewPanelHandle, editJson: any): void; } diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index e59a0eebbe7..216fb35e53b 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -16,7 +16,7 @@ import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor'; import { asWebviewUri, WebviewInitData } from 'vs/workbench/api/common/shared/webview'; import * as vscode from 'vscode'; -import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewStateData } from './extHost.protocol'; +import { ExtHostWebviewsShape, IMainContext, MainContext, MainThreadWebviewsShape, WebviewPanelHandle, WebviewPanelViewStateData, WebviewEditorCapabilities } from './extHost.protocol'; import { Disposable as VSCodeDisposable } from './extHostTypes'; type IconPath = URI | { light: URI, dark: URI }; @@ -257,12 +257,11 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa } async _onSave(): Promise { - await assertIsDefined(this._capabilities).editingCapability?.save(); + await assertIsDefined(this._capabilities?.editingCapability)?.save(); } - async _onSaveAs(resource: vscode.Uri, targetResource: vscode.Uri): Promise { - await assertIsDefined(this._capabilities).editingCapability?.saveAs(resource, targetResource); + await assertIsDefined(this._capabilities?.editingCapability)?.saveAs(resource, targetResource); } private assertNotDisposed() { @@ -450,6 +449,7 @@ export class ExtHostWebviews implements ExtHostWebviewsShape { this._webviewPanels.set(handle, revivedPanel); const capabilities = await provider.resolveWebviewEditor({ resource: URI.revive(input.resource) }, revivedPanel); revivedPanel._setCapabilities(capabilities); + this.registerCapabilites(handle, capabilities); // TODO: the first set of edits should likely be passed when resolving if (input.edits.length) { @@ -480,6 +480,17 @@ export class ExtHostWebviews implements ExtHostWebviewsShape { private getWebviewPanel(handle: WebviewPanelHandle): ExtHostWebviewEditor | undefined { return this._webviewPanels.get(handle); } + + private registerCapabilites(handle: WebviewPanelHandle, capabilities: vscode.WebviewEditorCapabilities) { + const declaredCapabilites: WebviewEditorCapabilities[] = []; + if (capabilities.editingCapability?.save) { + declaredCapabilites.push(WebviewEditorCapabilities.Save); + } + if (capabilities.editingCapability?.saveAs) { + declaredCapabilites.push(WebviewEditorCapabilities.SaveAs); + } + this._proxy.$registerCapabilities(handle, declaredCapabilites); + } } function convertWebviewOptions( From 6781ef6bf5f59ee3dbe3255b91514fa3710eea24 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Nov 2019 15:30:28 -0800 Subject: [PATCH 038/637] Populate custom editor save as dialog with current path --- .../customEditor/browser/customEditorInput.ts | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index edf216c14d9..4ec3e8f7dff 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -117,27 +117,13 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { return false; } - // Preserve view state by opening the editor first. In addition - // this allows the user to review the contents of the editor. - // let viewState: IEditorViewState | undefined = undefined; - // const editor = await this.editorService.openEditor(this, undefined, group); - // if (isTextEditor(editor)) { - // viewState = editor.getViewState(); - // } - let dialogPath = this._editorResource; - // if (this._editorResource.scheme === Schemas.untitled) { - // dialogPath = this.suggestFileName(resource); - // } - const target = await this.promptForPath(this._editorResource, dialogPath, options?.availableFileSystems); if (!target) { return false; // save cancelled } - await this._model.saveAs(this._editorResource, target, options); - - return true; + return await this._model.saveAs(this._editorResource, target, options); } public revert(options?: IRevertOptions): Promise { @@ -156,7 +142,10 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { // Help user to find a name for the file by opening it first await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true } }); - return this.fileDialogService.pickFileToSave({});//this.getSaveDialogOptions(defaultUri, availableFileSystems)); + return this.fileDialogService.pickFileToSave({ + availableFileSystems, + defaultUri + }); } public handleMove(_groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined { From e3fb9ceca19857d4debc51b6d357609811c5995b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Nov 2019 15:32:50 -0800 Subject: [PATCH 039/637] Use single editable capability --- src/vs/workbench/api/browser/mainThreadWebview.ts | 5 +---- src/vs/workbench/api/common/extHost.protocol.ts | 3 +-- src/vs/workbench/api/common/extHostWebview.ts | 7 ++----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index 7af79adc7e2..558cf599eaf 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -318,11 +318,8 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma const model = await this._customEditorService.models.loadOrCreate(webviewInput.getResource(), webviewInput.viewType); const capabilitiesSet = new Set(capabilities); - - if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.Save)) { + if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.Editable)) { model.onWillSave(e => { e.waitUntil(this._proxy.$onSave(handle)); }); - } - if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.SaveAs)) { model.onWillSaveAs(e => { e.waitUntil(this._proxy.$onSaveAs(handle, e.resource.toJSON(), e.targetResource.toJSON())); }); } } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 4df48aeb239..b7d4837a61e 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -557,8 +557,7 @@ export interface WebviewExtensionDescription { } export enum WebviewEditorCapabilities { - Save, - SaveAs, + Editable, } export interface MainThreadWebviewsShape extends IDisposable { diff --git a/src/vs/workbench/api/common/extHostWebview.ts b/src/vs/workbench/api/common/extHostWebview.ts index 216fb35e53b..ef8b03fcd93 100644 --- a/src/vs/workbench/api/common/extHostWebview.ts +++ b/src/vs/workbench/api/common/extHostWebview.ts @@ -483,11 +483,8 @@ export class ExtHostWebviews implements ExtHostWebviewsShape { private registerCapabilites(handle: WebviewPanelHandle, capabilities: vscode.WebviewEditorCapabilities) { const declaredCapabilites: WebviewEditorCapabilities[] = []; - if (capabilities.editingCapability?.save) { - declaredCapabilites.push(WebviewEditorCapabilities.Save); - } - if (capabilities.editingCapability?.saveAs) { - declaredCapabilites.push(WebviewEditorCapabilities.SaveAs); + if (capabilities.editingCapability) { + declaredCapabilites.push(WebviewEditorCapabilities.Editable); } this._proxy.$registerCapabilities(handle, declaredCapabilites); } From d43ca55162683f26f8b817e12dcd90e555e154d1 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Dec 2019 12:03:01 -0800 Subject: [PATCH 040/637] Move more functionality into registerCapabilities --- .../api/browser/mainThreadWebview.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index 558cf599eaf..529d9e60f99 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -271,16 +271,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma webviewInput.webview.options = options; webviewInput.webview.extension = extension; - const model = await this._customEditorService.models.loadOrCreate(webviewInput.getResource(), webviewInput.viewType); - - model.onUndo(edits => { this._proxy.$undoEdits(handle, edits.map(x => x.data)); }); - model.onApplyEdit(edits => { - const editsToApply = edits.filter(x => x.source !== webviewInput).map(x => x.data); - if (editsToApply.length) { - this._proxy.$applyEdits(handle, editsToApply); - } - }); - + const model = await this.getModel(webviewInput); webviewInput.onDisposeWebview(() => { this._customEditorService.models.disposeModel(model); }); @@ -315,15 +306,29 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma public async $registerCapabilities(handle: extHostProtocol.WebviewPanelHandle, capabilities: readonly extHostProtocol.WebviewEditorCapabilities[]): Promise { const webviewInput = this.getWebviewInput(handle); - const model = await this._customEditorService.models.loadOrCreate(webviewInput.getResource(), webviewInput.viewType); + const model = await this.getModel(webviewInput); const capabilitiesSet = new Set(capabilities); if (capabilitiesSet.has(extHostProtocol.WebviewEditorCapabilities.Editable)) { + model.onUndo(edits => { this._proxy.$undoEdits(handle, edits.map(x => x.data)); }); + + model.onApplyEdit(edits => { + const editsToApply = edits.filter(x => x.source !== webviewInput).map(x => x.data); + if (editsToApply.length) { + this._proxy.$applyEdits(handle, editsToApply); + } + }); + model.onWillSave(e => { e.waitUntil(this._proxy.$onSave(handle)); }); + model.onWillSaveAs(e => { e.waitUntil(this._proxy.$onSaveAs(handle, e.resource.toJSON(), e.targetResource.toJSON())); }); } } + private getModel(webviewInput: WebviewInput) { + return this._customEditorService.models.loadOrCreate(webviewInput.getResource(), webviewInput.viewType); + } + public $onEdit(handle: extHostProtocol.WebviewPanelHandle, editData: any): void { const webview = this.getWebviewInput(handle); if (!(webview instanceof CustomFileEditorInput)) { From cc378fa6ea74726001517596c9e759fc609917f7 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Mon, 2 Dec 2019 13:45:57 -0800 Subject: [PATCH 041/637] update distro and TPNs --- ThirdPartyNotices.txt | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 440edf6844b..7a3dd5cf7b3 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -8,7 +8,7 @@ This project incorporates components from the projects listed below. The origina 1. atom/language-clojure version 0.22.7 (https://github.com/atom/language-clojure) 2. atom/language-coffee-script version 0.49.3 (https://github.com/atom/language-coffee-script) 3. atom/language-java version 0.31.3 (https://github.com/atom/language-java) -4. atom/language-sass version 0.61.4 (https://github.com/atom/language-sass) +4. atom/language-sass version 0.62.1 (https://github.com/atom/language-sass) 5. atom/language-shellscript version 0.26.0 (https://github.com/atom/language-shellscript) 6. atom/language-xml version 0.35.2 (https://github.com/atom/language-xml) 7. Colorsublime-Themes version 0.1.0 (https://github.com/Colorsublime/Colorsublime-Themes) @@ -27,13 +27,13 @@ This project incorporates components from the projects listed below. The origina 20. Ionic documentation version 1.2.4 (https://github.com/ionic-team/ionic-site) 21. ionide/ionide-fsgrammar (https://github.com/ionide/ionide-fsgrammar) 22. jeff-hykin/cpp-textmate-grammar version 1.12.11 (https://github.com/jeff-hykin/cpp-textmate-grammar) -23. jeff-hykin/cpp-textmate-grammar version 1.14.9 (https://github.com/jeff-hykin/cpp-textmate-grammar) +23. jeff-hykin/cpp-textmate-grammar version 1.14.13 (https://github.com/jeff-hykin/cpp-textmate-grammar) 24. js-beautify version 1.6.8 (https://github.com/beautify-web/js-beautify) 25. Jxck/assert version 1.0.0 (https://github.com/Jxck/assert) 26. language-docker (https://github.com/moby/moby) 27. language-go version 0.44.3 (https://github.com/atom/language-go) 28. language-less version 0.34.2 (https://github.com/atom/language-less) -29. language-php version 0.44.2 (https://github.com/atom/language-php) +29. language-php version 0.44.3 (https://github.com/atom/language-php) 30. language-rust version 0.4.12 (https://github.com/zargony/atom-language-rust) 31. MagicStack/MagicPython version 1.1.1 (https://github.com/MagicStack/MagicPython) 32. marked version 0.6.2 (https://github.com/markedjs/marked) @@ -589,7 +589,7 @@ END OF HTML 5.1 W3C Working Draft NOTICES AND INFORMATION ========================================= MIT License -Copyright (c) 2017 Yuki Ueda +Copyright (c) 2019 Yuki Ueda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 5ee09edfd02..d1cc787db35 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.41.0", - "distro": "30dcc7436405dfa68898d0f3843551c589fc9008", + "distro": "2e24565c8e7c0009905c302d27a0ca7cac7efdc3", "author": { "name": "Microsoft Corporation" }, From 7ddf497849919fae58911920bceaa12bfcffafb3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 2 Dec 2019 23:32:30 +0100 Subject: [PATCH 042/637] Add some inline documentation --- src/vs/vscode.proposed.d.ts | 98 ++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 8 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index e9cc058941c..bced8ed8d58 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -83,14 +83,6 @@ declare module 'vscode' { build(): Uint32Array; } - /** - * A certain token (at index `i` is encoded using 5 uint32 integers): - * - at index `5*i` - `deltaLine`: token line number, relative to `SemanticColoringArea.line` - * - at index `5*i+1` - `deltaStart`: token start character offset inside the line (relative to 0 or the previous token if they are on the same line) - * - at index `5*i+2` - `length`: the length of the token - * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticColoringLegend.tokenTypes` - * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticColoringLegend.tokenModifiers` - */ export class SemanticTokens { readonly resultId?: string; readonly data: Uint32Array; @@ -123,6 +115,96 @@ declare module 'vscode' { * semantic tokens. */ export interface SemanticTokensProvider { + /** + * A file can contain many tokens, perhaps even hundreds of thousands tokens. Therefore, to improve + * the memory consumption around describing semantic tokens, we have decided to avoid allocating objects + * and we have decided to represent tokens from a file as an array of integers. + * + * + * In short, each token takes 5 integers to represent, so a specific token i in the file consists of the following fields: + * - at index `5*i` - `deltaLine`: token line number, relative to the previous token + * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) + * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. + * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes` + * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + * + * + * Here is an example for encoding a file with 3 tokens: + * ``` + * [ { line: 2, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, + * { line: 2, startChar: 10, length: 4, tokenType: "types", tokenModifiers: [] }, + * { line: 5, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } ] + * ``` + * + * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. + * For this example, we will choose the following legend which is passed in when registering the provider: + * ``` + * { tokenTypes: ['', 'properties', 'types', 'classes'], + * tokenModifiers: ['', 'private', 'static'] } + * ``` + * + * 2. The first transformation is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked + * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Token modifiers are a set and they are looked up by a bitmap, + * so a `tokenModifier` value of `6` is first viewed as a bitmap `0b110`, so it will mean `[tokenModifiers[1], tokenModifiers[2]]` because + * bits 1 and 2 are set. Using this legend, the tokens now are: + * ``` + * [ { line: 2, startChar: 5, length: 3, tokenType: 1, tokenModifiers: 6 }, // 6 is 0b110 + * { line: 2, startChar: 10, length: 4, tokenType: 2, tokenModifiers: 0 }, + * { line: 5, startChar: 2, length: 7, tokenType: 3, tokenModifiers: 0 } ] + * ``` + * + * 3. Then, we will encode each token relative to the previous token in the file: + * ``` + * [ { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 1, tokenModifiers: 6 }, + * // this token is on the same line as the first one, so the startChar is made relative + * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 2, tokenModifiers: 0 }, + * // this token is on a different line than the second one, so the startChar remains unchanged + * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 3, tokenModifiers: 0 } ] + * ``` + * + * 4. Finally, the integers are organized in a single array, which is a memory friendly representation: + * ``` + * // 1st token, 2nd token, 3rd token + * [ 2,5,3,1,6, 0,5,4,2,0, 3,2,7,3,0 ] + * ``` + * + * In principle, each call to `provideSemanticTokens` expects a complete representations of the semantic tokens. + * It is possible to simply return all the tokens at each call. + * + * But oftentimes, a small edit in the file will result in a small change to the above delta-based represented tokens. + * (In fact, that is why the above tokens are delta-encoded relative to their corresponding previous tokens). + * In such a case, if VS Code passes in the previous result id, it is possible for an advanced tokenization provider + * to return a delta to the integers array. + * + * To continue with the previous example, suppose a new line has been pressed at the beginning of the file, such that + * all the tokens are now one line lower, and that a new token has appeared since the last result on line 4. + * For example, the tokens might look like: + * ``` + * [ { line: 3, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, + * { line: 3, startChar: 10, length: 4, tokenType: "types", tokenModifiers: [] }, + * { line: 4, startChar: 3, length: 5, tokenType: "properties", tokenModifiers: ["static"] }, + * { line: 6, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } ] + * ``` + * + * The integer encoding of all new tokens would be: + * ``` + * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] + * ``` + * + * A smart tokens provider can compute a diff from the previous result to the new result + * ``` + * [ 2,5,3,1,6, 0,5,4,2,0, 3,2,7,3,0 ] + * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] + * ``` + * and return as simple integer edits the diff: + * ``` + * { edits: [ + * { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3 + * { start: 10, deleteCount: 1, data: [1,3,5,1,2,2] } // replace integer at offset 10 with [1,3,5,1,2,2] + * ]} + * ``` + * All indices expressed in the returned diff represent indices in the old result array, so they all refer to the previous result state. + */ provideSemanticTokens(document: TextDocument, options: SemanticTokensRequestOptions, token: CancellationToken): ProviderResult; } From 3d4d0bf3240ae581f9c54929c07da4a950ab6170 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 2 Dec 2019 14:40:54 -0800 Subject: [PATCH 043/637] Keep track of disposeables --- extensions/search-result/src/extension.ts | 123 +++++++++++----------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index ec90cd28fbd..55e082f35eb 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -12,76 +12,79 @@ const SEARCH_RESULT_SELECTOR = { language: 'search-result' }; let cachedLastParse: { version: number, parse: ParsedSearchResults } | undefined; -export function activate() { +export function activate(context: vscode.ExtensionContext) { + context.subscriptions.push( + vscode.commands.registerCommand('searchResult.rerunSearch', () => vscode.commands.executeCommand('search.action.rerunEditorSearch')), - vscode.commands.registerCommand('searchResult.rerunSearch', () => vscode.commands.executeCommand('search.action.rerunEditorSearch')); + vscode.languages.registerDocumentSymbolProvider(SEARCH_RESULT_SELECTOR, { + provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.DocumentSymbol[] { + const results = parseSearchResults(document, token) + .filter(isFileLine) + .map(line => new vscode.DocumentSymbol( + line.path, + '', + vscode.SymbolKind.File, + line.allLocations.map(({ originSelectionRange }) => originSelectionRange!).reduce((p, c) => p.union(c), line.location.originSelectionRange!), + line.location.originSelectionRange!, + )); - vscode.languages.registerDocumentSymbolProvider(SEARCH_RESULT_SELECTOR, { - provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.DocumentSymbol[] { - const results = parseSearchResults(document, token) - .filter(isFileLine) - .map(line => new vscode.DocumentSymbol( - line.path, - '', - vscode.SymbolKind.File, - line.allLocations.map(({ originSelectionRange }) => originSelectionRange!).reduce((p, c) => p.union(c), line.location.originSelectionRange!), - line.location.originSelectionRange!, - )); - - return results; - } - }); - - vscode.languages.registerCompletionItemProvider(SEARCH_RESULT_SELECTOR, { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position): vscode.CompletionItem[] { - - const line = document.lineAt(position.line); - if (position.line > 3) { return []; } - if (position.character === 0 || (position.character === 1 && line.text === '#')) { - const header = Array.from({ length: 4 }).map((_, i) => document.lineAt(i).text); - - return ['# Query:', '# Flags:', '# Including:', '# Excluding:'] - .filter(suggestion => header.every(line => line.indexOf(suggestion) === -1)) - .map(flag => ({ label: flag, insertText: (flag.slice(position.character)) + ' ' })); + return results; } + }), - if (line.text.indexOf('# Flags:') === -1) { return []; } + vscode.languages.registerCompletionItemProvider(SEARCH_RESULT_SELECTOR, { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position): vscode.CompletionItem[] { - return ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'] - .filter(flag => line.text.indexOf(flag) === -1) - .map(flag => ({ label: flag, insertText: flag + ' ' })); - } - }, '#'); + const line = document.lineAt(position.line); + if (position.line > 3) { return []; } + if (position.character === 0 || (position.character === 1 && line.text === '#')) { + const header = Array.from({ length: 4 }).map((_, i) => document.lineAt(i).text); - vscode.languages.registerDefinitionProvider(SEARCH_RESULT_SELECTOR, { - provideDefinition(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.DefinitionLink[] { - const lineResult = parseSearchResults(document, token)[position.line]; - if (!lineResult) { return []; } - if (lineResult.type === 'file') { - // TODO: The multi-match peek UX isnt very smooth. - // return lineResult.allLocations.length > 1 ? lineResult.allLocations : [lineResult.location]; - return []; + return ['# Query:', '# Flags:', '# Including:', '# Excluding:'] + .filter(suggestion => header.every(line => line.indexOf(suggestion) === -1)) + .map(flag => ({ label: flag, insertText: (flag.slice(position.character)) + ' ' })); + } + + if (line.text.indexOf('# Flags:') === -1) { return []; } + + return ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'] + .filter(flag => line.text.indexOf(flag) === -1) + .map(flag => ({ label: flag, insertText: flag + ' ' })); } + }, '#'), - return [lineResult.location]; - } - }); + vscode.languages.registerDefinitionProvider(SEARCH_RESULT_SELECTOR, { + provideDefinition(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.DefinitionLink[] { + const lineResult = parseSearchResults(document, token)[position.line]; + if (!lineResult) { return []; } + if (lineResult.type === 'file') { + // TODO: The multi-match peek UX isnt very smooth. + // return lineResult.allLocations.length > 1 ? lineResult.allLocations : [lineResult.location]; + return []; + } - vscode.languages.registerDocumentLinkProvider(SEARCH_RESULT_SELECTOR, { - async provideDocumentLinks(document: vscode.TextDocument, token: vscode.CancellationToken): Promise { - return parseSearchResults(document, token) - .filter(({ type }) => type === 'file') - .map(({ location }) => ({ range: location.originSelectionRange!, target: location.targetUri })); - } - }); + return [lineResult.location]; + } + }), - vscode.window.onDidChangeActiveTextEditor(e => { - if (e?.document.languageId === 'search-result') { - // Clear the parse whenever we open a new editor. - // Conservative because things like the URI might remain constant even if the contents change, and re-parsing even large files is relatively fast. - cachedLastParse = undefined; - } - }); + vscode.languages.registerDocumentLinkProvider(SEARCH_RESULT_SELECTOR, { + async provideDocumentLinks(document: vscode.TextDocument, token: vscode.CancellationToken): Promise { + return parseSearchResults(document, token) + .filter(({ type }) => type === 'file') + .map(({ location }) => ({ range: location.originSelectionRange!, target: location.targetUri })); + } + }), + + vscode.window.onDidChangeActiveTextEditor(e => { + if (e?.document.languageId === 'search-result') { + // Clear the parse whenever we open a new editor. + // Conservative because things like the URI might remain constant even if the contents change, and re-parsing even large files is relatively fast. + cachedLastParse = undefined; + } + }), + + { dispose() { cachedLastParse = undefined; } } + ); } From e63912b18c3c7a9564bb2d96cba723df5f4b6051 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 2 Dec 2019 14:41:27 -0800 Subject: [PATCH 044/637] Bump distro, microsoft/vscode-remote-release#1835 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d1cc787db35..7fd8c125aaf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.41.0", - "distro": "2e24565c8e7c0009905c302d27a0ca7cac7efdc3", + "distro": "de758a726231fcf8e04422e65e29cd792f21c6c4", "author": { "name": "Microsoft Corporation" }, From 293cabc6a15616ea0093360dacc6fd8cc3a2cfe0 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 2 Dec 2019 14:58:23 -0800 Subject: [PATCH 045/637] Fix #85915 - don't search open editors from git --- src/vs/workbench/services/search/common/searchService.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/services/search/common/searchService.ts b/src/vs/workbench/services/search/common/searchService.ts index ddbe6ecb49e..65d2ff3bd44 100644 --- a/src/vs/workbench/services/search/common/searchService.ts +++ b/src/vs/workbench/services/search/common/searchService.ts @@ -409,6 +409,11 @@ export class SearchService extends Disposable implements ISearchService { return; } + // Exclude files from the git FileSystemProvider, e.g. to prevent open staged files from showing in search results + if (resource.scheme === 'gitfs') { + return; + } + if (!this.matches(resource, query)) { return; // respect user filters } From 4924a8b805ca2daa6806f51e253b262940add79e Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Mon, 2 Dec 2019 15:30:19 -0800 Subject: [PATCH 046/637] Fix #85629. Resize find widget properly when resizing happens. --- src/vs/editor/contrib/find/findWidget.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index 5c9aee4a2ed..e4a21ad6652 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -706,10 +706,12 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas if (this._resized) { this._findInput.inputBox.layout(); - let findInputWidth = this._findInput.inputBox.width; + let findInputWidth = this._findInput.inputBox.element.clientWidth; if (findInputWidth > 0) { this._replaceInput.width = findInputWidth; } + } else if (this._isReplaceVisible) { + this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } } @@ -1159,13 +1161,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return; } - const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth!) || 0; if (width > maxWidth) { return; } this._domNode.style.width = `${width}px`; - this._findInput.inputBox.width = inputBoxWidth; if (this._isReplaceVisible) { this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } @@ -1197,10 +1197,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas */ } - const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; this._domNode.style.width = `${width}px`; - this._findInput.inputBox.width = inputBoxWidth; if (this._isReplaceVisible) { this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); } From b0fb9f17da7b34ab122d9308c497b900fbe3cada Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Dec 2019 15:43:16 -0800 Subject: [PATCH 047/637] Note image preview's extension kind For #85819 --- extensions/image-preview/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/image-preview/package.json b/extensions/image-preview/package.json index 8be8486a54b..a0664f98e3d 100644 --- a/extensions/image-preview/package.json +++ b/extensions/image-preview/package.json @@ -2,7 +2,7 @@ "name": "image-preview", "displayName": "%displayName%", "description": "%description%", - "extensionKind": "ui", + "extensionKind": ["ui", "workspace"], "version": "1.0.0", "publisher": "vscode", "icon": "icon.png", From cd6c734313c0edf305de238e00a7cb99e913f2cc Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Mon, 2 Dec 2019 16:16:01 -0800 Subject: [PATCH 048/637] remove unused const -- monaco. --- src/vs/editor/contrib/find/findWidget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index e4a21ad6652..eef499b1a0e 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -63,7 +63,7 @@ const PART_WIDTH = 275; const FIND_INPUT_AREA_WIDTH = PART_WIDTH - 54; let MAX_MATCHES_COUNT_WIDTH = 69; -let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */; +// let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */; const FIND_INPUT_AREA_HEIGHT = 33; // The height of Find Widget when Replace Input is not visible. const ctrlEnterReplaceAllWarningPromptedKey = 'ctrlEnterReplaceAll.windows.donotask'; From c72ddff61022ec3ace576dc5964e8e3fdf4bbec2 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 2 Dec 2019 17:22:15 -0800 Subject: [PATCH 049/637] Add issue numbers to proposed API --- src/vs/vscode.proposed.d.ts | 130 +++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index bced8ed8d58..e84f6df0d4a 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -253,7 +253,7 @@ declare module 'vscode' { //#endregion - //#region Rob: search provider + //#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921 /** * The parameters of a query for text search. @@ -397,32 +397,6 @@ declare module 'vscode' { limitHit?: boolean; } - /** - * The parameters of a query for file search. - */ - export interface FileSearchQuery { - /** - * The search pattern to match against file paths. - */ - pattern: string; - } - - /** - * Options that apply to file search. - */ - export interface FileSearchOptions extends SearchOptions { - /** - * The maximum number of results to be returned. - */ - maxResults?: number; - - /** - * A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache, - * and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared. - */ - session?: CancellationToken; - } - /** * A preview of the text result. */ @@ -482,6 +456,50 @@ declare module 'vscode' { export type TextSearchResult = TextSearchMatch | TextSearchContext; + /** + * A TextSearchProvider provides search results for text results inside files in the workspace. + */ + export interface TextSearchProvider { + /** + * Provide results that match the given text pattern. + * @param query The parameters for this query. + * @param options A set of options to consider while searching. + * @param progress A progress callback that must be invoked for all results. + * @param token A cancellation token. + */ + provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress, token: CancellationToken): ProviderResult; + } + + //#endregion + + //#region FileSearchProvider: https://github.com/microsoft/vscode/issues/73524 + + /** + * The parameters of a query for file search. + */ + export interface FileSearchQuery { + /** + * The search pattern to match against file paths. + */ + pattern: string; + } + + /** + * Options that apply to file search. + */ + export interface FileSearchOptions extends SearchOptions { + /** + * The maximum number of results to be returned. + */ + maxResults?: number; + + /** + * A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache, + * and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared. + */ + session?: CancellationToken; + } + /** * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions. * @@ -501,20 +519,34 @@ declare module 'vscode' { provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult; } - /** - * A TextSearchProvider provides search results for text results inside files in the workspace. - */ - export interface TextSearchProvider { + export namespace workspace { /** - * Provide results that match the given text pattern. - * @param query The parameters for this query. - * @param options A set of options to consider while searching. - * @param progress A progress callback that must be invoked for all results. - * @param token A cancellation token. + * Register a search provider. + * + * Only one provider can be registered per scheme. + * + * @param scheme The provider will be invoked for workspace folders that have this file scheme. + * @param provider The provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. */ - provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress, token: CancellationToken): ProviderResult; + export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable; + + /** + * Register a text search provider. + * + * Only one provider can be registered per scheme. + * + * @param scheme The provider will be invoked for workspace folders that have this file scheme. + * @param provider The provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. + */ + export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable; } + //#endregion + + //#region findTextInFiles: https://github.com/microsoft/vscode/issues/59924 + /** * Options that can be set on a findTextInFiles search. */ @@ -579,28 +611,6 @@ declare module 'vscode' { } export namespace workspace { - /** - * Register a search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A [disposable](#Disposable) that unregisters this provider when being disposed. - */ - export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable; - - /** - * Register a text search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A [disposable](#Disposable) that unregisters this provider when being disposed. - */ - export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable; - /** * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace. * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. @@ -729,7 +739,7 @@ declare module 'vscode' { //#endregion - //#region Rob, Matt: logging + //#region LogLevel: https://github.com/microsoft/vscode/issues/85992 /** * The severity level of a log message From fe1231931141afca83e3c7ff29c97f333790868d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Dec 2019 17:34:22 -0800 Subject: [PATCH 050/637] Custom editor save as should replace existing editor --- .../contrib/customEditor/browser/customEditorInput.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index 4ec3e8f7dff..c9394ba4e92 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -17,6 +17,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, Verbosity } from 'vs/workbench/common/editor'; import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; +import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { WebviewEditorOverlay } from 'vs/workbench/contrib/webview/browser/webview'; import { IWebviewWorkbenchService, LazilyResolvedWebviewEditorInput } from 'vs/workbench/contrib/webview/browser/webviewWorkbenchService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -123,7 +124,14 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { return false; // save cancelled } - return await this._model.saveAs(this._editorResource, target, options); + if (!await this._model.saveAs(this._editorResource, target, options)) { + return false; + } + + const replacement = this.handleMove(groupId, target) || this.instantiationService.createInstance(FileEditorInput, target, undefined, undefined); + + await this.editorService.replaceEditors([{ editor: this, replacement, options: { pinned: true } }], groupId); + return true; } public revert(options?: IRevertOptions): Promise { From 529351318e5874cc9720f45a5e24a3c6995b2c54 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Dec 2019 17:53:32 -0800 Subject: [PATCH 051/637] Removing test custom editors --- build/lib/i18n.resources.json | 4 - .../browser/testCustomEditors.ts | 252 ------------------ src/vs/workbench/workbench.common.main.ts | 3 - 3 files changed, 259 deletions(-) delete mode 100644 src/vs/workbench/contrib/testCustomEditors/browser/testCustomEditors.ts diff --git a/build/lib/i18n.resources.json b/build/lib/i18n.resources.json index 6a3f89dc471..e9a4f279631 100644 --- a/build/lib/i18n.resources.json +++ b/build/lib/i18n.resources.json @@ -50,10 +50,6 @@ "name": "vs/workbench/contrib/comments", "project": "vscode-workbench" }, - { - "name": "vs/workbench/contrib/testCustomEditors", - "project": "vscode-workbench" - }, { "name": "vs/workbench/contrib/debug", "project": "vscode-workbench" diff --git a/src/vs/workbench/contrib/testCustomEditors/browser/testCustomEditors.ts b/src/vs/workbench/contrib/testCustomEditors/browser/testCustomEditors.ts deleted file mode 100644 index 661b8412cad..00000000000 --- a/src/vs/workbench/contrib/testCustomEditors/browser/testCustomEditors.ts +++ /dev/null @@ -1,252 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as nls from 'vs/nls'; -import { Action } from 'vs/base/common/actions'; -import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { IEditorInputFactory, EditorInput, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, EditorModel, EditorOptions, GroupIdentifier, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor'; -import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IEditorModel } from 'vs/platform/editor/common/editor'; -import { Dimension, addDisposableListener, EventType } from 'vs/base/browser/dom'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; -import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions'; -import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { URI } from 'vs/base/common/uri'; -import { isEqual } from 'vs/base/common/resources'; -import { generateUuid } from 'vs/base/common/uuid'; -import { CancellationToken } from 'vs/base/common/cancellation'; -import { editorBackground, editorForeground } from 'vs/platform/theme/common/colorRegistry'; -import { IWorkingCopy, IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; -import { env } from 'vs/base/common/process'; - -const CUSTOM_SCHEME = 'testCustomEditor'; -const ENABLE = !!env['VSCODE_DEV']; - -class TestCustomEditorsAction extends Action { - - static readonly ID = 'workbench.action.openCustomEditor'; - static readonly LABEL = nls.localize('openCustomEditor', "Test Open Custom Editor"); - - constructor( - id: string, - label: string, - @IEditorService private readonly editorService: IEditorService, - @IInstantiationService private readonly instantiationService: IInstantiationService - ) { - super(id, label); - } - - async run(): Promise { - const input = this.instantiationService.createInstance(TestCustomEditorInput, URI.parse(`${CUSTOM_SCHEME}:/${generateUuid()}`)); - await this.editorService.openEditor(input); - - return true; - } -} - -class TestCustomEditor extends BaseEditor { - - static ID = 'testCustomEditor'; - - private textArea: HTMLTextAreaElement | undefined = undefined; - - constructor( - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IStorageService storageService: IStorageService - ) { - super(TestCustomEditor.ID, telemetryService, themeService, storageService); - } - - updateStyles(): void { - super.updateStyles(); - - if (this.textArea) { - this.textArea.style.backgroundColor = this.getColor(editorBackground)!.toString(); - this.textArea.style.color = this.getColor(editorForeground)!.toString(); - } - } - - protected createEditor(parent: HTMLElement): void { - this.textArea = document.createElement('textarea'); - this.textArea.style.width = '100%'; - this.textArea.style.height = '100%'; - - parent.appendChild(this.textArea); - - addDisposableListener(this.textArea, EventType.CHANGE, e => this.onDidType()); - addDisposableListener(this.textArea, EventType.KEY_UP, e => this.onDidType()); - - this.updateStyles(); - } - - private onDidType(): void { - if (this._input instanceof TestCustomEditorInput) { - this._input.setValue(this.textArea!.value); - } - } - - async setInput(input: EditorInput, options: EditorOptions | undefined, token: CancellationToken): Promise { - await super.setInput(input, options, token); - - const model = await input.resolve(); - if (model instanceof TestCustomEditorModel) { - this.textArea!.value = model.value; - } - } - - clearInput() { - super.clearInput(); - - this.textArea!.value = ''; - } - - focus(): void { - this.textArea!.focus(); - } - - layout(dimension: Dimension): void { } -} - -class TestCustomEditorInput extends EditorInput implements IWorkingCopy { - private model: TestCustomEditorModel | undefined = undefined; - - private dirty = false; - - readonly capabilities = 0; - - constructor(public readonly resource: URI, @IWorkingCopyService workingCopyService: IWorkingCopyService) { - super(); - - this._register(workingCopyService.registerWorkingCopy(this)); - } - - getResource(): URI { - return this.resource; - } - - getTypeId(): string { - return TestCustomEditor.ID; - } - - getName(): string { - return this.resource.toString(); - } - - setValue(value: string) { - if (this.model) { - if (this.model.value === value) { - return; - } - - this.model.value = value; - } - - this.setDirty(value.length > 0); - } - - private setDirty(dirty: boolean) { - if (this.dirty !== dirty) { - this.dirty = dirty; - this._onDidChangeDirty.fire(); - } - } - - isReadonly(): boolean { - return false; - } - - isDirty(): boolean { - return this.dirty; - } - - async save(groupId: GroupIdentifier, options?: ISaveOptions): Promise { - this.setDirty(false); - - return true; - } - - async saveAs(groupId: GroupIdentifier, options?: ISaveOptions): Promise { - this.setDirty(false); - - return true; - } - - async revert(options?: IRevertOptions): Promise { - this.setDirty(false); - - return true; - } - - async resolve(): Promise { - if (!this.model) { - this.model = new TestCustomEditorModel(this.resource); - } - - return this.model; - } - - matches(other: EditorInput) { - return other instanceof TestCustomEditorInput && isEqual(other.resource, this.resource); - } - - dispose(): void { - this.setDirty(false); - - if (this.model) { - this.model.dispose(); - this.model = undefined; - } - - super.dispose(); - } -} - -class TestCustomEditorModel extends EditorModel { - - public value: string = ''; - - constructor(public readonly resource: URI) { - super(); - } -} - -if (ENABLE) { - Registry.as(EditorExtensions.Editors).registerEditor( - EditorDescriptor.create( - TestCustomEditor, - TestCustomEditor.ID, - nls.localize('testCustomEditor', "Test Custom Editor") - ), - [ - new SyncDescriptor(TestCustomEditorInput), - ] - ); - - const registry = Registry.as(Extensions.WorkbenchActions); - - registry.registerWorkbenchAction(SyncActionDescriptor.create(TestCustomEditorsAction, TestCustomEditorsAction.ID, TestCustomEditorsAction.LABEL), 'Test Open Custom Editor'); - - class TestCustomEditorInputFactory implements IEditorInputFactory { - - serialize(editorInput: TestCustomEditorInput): string { - return JSON.stringify({ - resource: editorInput.resource.toString() - }); - } - - deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): TestCustomEditorInput { - return instantiationService.createInstance(TestCustomEditorInput, URI.parse(JSON.parse(serializedEditorInput).resource)); - } - } - - Registry.as(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(TestCustomEditor.ID, TestCustomEditorInputFactory); -} diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index d7de6c214e4..9f9f8a80d7c 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -260,7 +260,4 @@ import 'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution'; // Code Actions import 'vs/workbench/contrib/codeActions/common/codeActions.contribution'; -// Test Custom Editors -import 'vs/workbench/contrib/testCustomEditors/browser/testCustomEditors'; - //#endregion From eae6eca8cfbb1923f244293d18b01df0591970f0 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 2 Dec 2019 19:39:28 -0800 Subject: [PATCH 052/637] [Search Editor] Add option for context lines --- extensions/search-result/package.json | 10 +++ extensions/search-result/package.nls.json | 3 +- extensions/search-result/src/extension.ts | 11 +-- .../syntaxes/searchResult.tmLanguage.json | 2 +- .../search/browser/search.contribution.ts | 7 +- .../contrib/search/browser/searchActions.ts | 34 +++++++++- .../contrib/search/browser/searchEditor.ts | 68 +++++++++++++++---- .../contrib/search/common/constants.ts | 1 + .../contrib/search/common/searchModel.ts | 19 +++++- 9 files changed, 133 insertions(+), 22 deletions(-) diff --git a/extensions/search-result/package.json b/extensions/search-result/package.json index bc7c6cf951c..0a2af5e0a9d 100644 --- a/extensions/search-result/package.json +++ b/extensions/search-result/package.json @@ -28,6 +28,15 @@ "light": "./src/media/refresh-light.svg", "dark": "./src/media/refresh-dark.svg" } + }, + { + "command": "searchResult.rerunSearchWithContext", + "title": "%searchResult.rerunSearchWithContext.title%", + "category": "Search Result", + "icon": { + "light": "./src/media/refresh-light.svg", + "dark": "./src/media/refresh-dark.svg" + } } ], "menus": { @@ -35,6 +44,7 @@ { "command": "searchResult.rerunSearch", "when": "editorLangId == search-result", + "alt": "searchResult.rerunSearchWithContext", "group": "navigation" } ] diff --git a/extensions/search-result/package.nls.json b/extensions/search-result/package.nls.json index 694f6b61d80..a4b0fb83845 100644 --- a/extensions/search-result/package.nls.json +++ b/extensions/search-result/package.nls.json @@ -1,5 +1,6 @@ { "displayName": "Search Result", "description": "Provides syntax highlighting and language features for tabbed search results.", - "searchResult.rerunSearch.title": "Search Again" + "searchResult.rerunSearch.title": "Search Again", + "searchResult.rerunSearchWithContext.title": "Search Again (Wth Context)" } diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index 55e082f35eb..c88a4feab63 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -7,14 +7,17 @@ import * as vscode from 'vscode'; import * as pathUtils from 'path'; const FILE_LINE_REGEX = /^(\S.*):$/; -const RESULT_LINE_REGEX = /^(\s+)(\d+):(\s+)(.*)$/; +const RESULT_LINE_REGEX = /^(\s+)(\d+)(?::| )(\s+)(.*)$/; const SEARCH_RESULT_SELECTOR = { language: 'search-result' }; +const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:']; +const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch']; let cachedLastParse: { version: number, parse: ParsedSearchResults } | undefined; export function activate(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.commands.registerCommand('searchResult.rerunSearch', () => vscode.commands.executeCommand('search.action.rerunEditorSearch')), + vscode.commands.registerCommand('searchResult.rerunSearchWithContext', () => vscode.commands.executeCommand('search.action.rerunEditorSearchWithContext')), vscode.languages.registerDocumentSymbolProvider(SEARCH_RESULT_SELECTOR, { provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.DocumentSymbol[] { @@ -38,16 +41,16 @@ export function activate(context: vscode.ExtensionContext) { const line = document.lineAt(position.line); if (position.line > 3) { return []; } if (position.character === 0 || (position.character === 1 && line.text === '#')) { - const header = Array.from({ length: 4 }).map((_, i) => document.lineAt(i).text); + const header = Array.from({ length: DIRECTIVES.length }).map((_, i) => document.lineAt(i).text); - return ['# Query:', '# Flags:', '# Including:', '# Excluding:'] + return DIRECTIVES .filter(suggestion => header.every(line => line.indexOf(suggestion) === -1)) .map(flag => ({ label: flag, insertText: (flag.slice(position.character)) + ' ' })); } if (line.text.indexOf('# Flags:') === -1) { return []; } - return ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch'] + return FLAGS .filter(flag => line.text.indexOf(flag) === -1) .map(flag => ({ label: flag, insertText: flag + ' ' })); } diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index 4de2a40ba40..d16ecb8c97c 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -3,7 +3,7 @@ "scopeName": "text.searchResult", "patterns": [ { - "match": "^# (Query|Flags|Including|Excluding): .*$", + "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", "name": "comment" }, { diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index af5b9c2f727..76763901606 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -41,7 +41,7 @@ import { ExplorerFolderContext, ExplorerRootContext, FilesExplorerFocusCondition import { OpenAnythingHandler } from 'vs/workbench/contrib/search/browser/openAnythingHandler'; import { OpenSymbolHandler } from 'vs/workbench/contrib/search/browser/openSymbolHandler'; import { registerContributions as replaceContributions } from 'vs/workbench/contrib/search/browser/replaceContributions'; -import { clearHistoryCommand, ClearSearchResultsAction, CloseReplaceAction, CollapseDeepestExpandedLevelAction, copyAllCommand, copyMatchCommand, copyPathCommand, FocusNextInputAction, FocusNextSearchResultAction, FocusPreviousInputAction, FocusPreviousSearchResultAction, focusSearchListCommand, getSearchView, openSearchView, OpenSearchViewletAction, RefreshAction, RemoveAction, ReplaceAction, ReplaceAllAction, ReplaceAllInFolderAction, ReplaceInFilesAction, toggleCaseSensitiveCommand, toggleRegexCommand, toggleWholeWordCommand, FindInFilesCommand, ToggleSearchOnTypeAction, OpenResultsInEditorAction, RerunEditorSearchAction } from 'vs/workbench/contrib/search/browser/searchActions'; +import { clearHistoryCommand, ClearSearchResultsAction, CloseReplaceAction, CollapseDeepestExpandedLevelAction, copyAllCommand, copyMatchCommand, copyPathCommand, FocusNextInputAction, FocusNextSearchResultAction, FocusPreviousInputAction, FocusPreviousSearchResultAction, focusSearchListCommand, getSearchView, openSearchView, OpenSearchViewletAction, RefreshAction, RemoveAction, ReplaceAction, ReplaceAllAction, ReplaceAllInFolderAction, ReplaceInFilesAction, toggleCaseSensitiveCommand, toggleRegexCommand, toggleWholeWordCommand, FindInFilesCommand, ToggleSearchOnTypeAction, OpenResultsInEditorAction, RerunEditorSearchAction, RerunEditorSearchWithContextAction } from 'vs/workbench/contrib/search/browser/searchActions'; import { SearchPanel } from 'vs/workbench/contrib/search/browser/searchPanel'; import { SearchView, SearchViewPosition } from 'vs/workbench/contrib/search/browser/searchView'; import { SearchViewlet } from 'vs/workbench/contrib/search/browser/searchViewlet'; @@ -651,6 +651,11 @@ registry.registerWorkbenchAction( 'Search Editor: Search Again', category, ContextKeyExpr.and(EditorContextKeys.languageId.isEqualTo('search-result'))); +registry.registerWorkbenchAction( + SyncActionDescriptor.create(RerunEditorSearchWithContextAction, RerunEditorSearchWithContextAction.ID, RerunEditorSearchWithContextAction.LABEL), + 'Search Editor: Search Again (With Context)', category, + ContextKeyExpr.and(EditorContextKeys.languageId.isEqualTo('search-result'))); + // Register Quick Open Handler Registry.as(QuickOpenExtensions.Quickopen).registerDefaultQuickOpenHandler( diff --git a/src/vs/workbench/contrib/search/browser/searchActions.ts b/src/vs/workbench/contrib/search/browser/searchActions.ts index c228d3a1218..b8346873f74 100644 --- a/src/vs/workbench/contrib/search/browser/searchActions.ts +++ b/src/vs/workbench/contrib/search/browser/searchActions.ts @@ -32,6 +32,7 @@ import { ITreeNavigator } from 'vs/base/browser/ui/tree/tree'; import { createEditorFromSearchResult, refreshActiveEditorSearch } from 'vs/workbench/contrib/search/browser/searchEditor'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress'; +import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; export function isSearchViewFocused(viewletService: IViewletService, panelService: IPanelService): boolean { const searchView = getSearchView(viewletService, panelService); @@ -472,7 +473,38 @@ export class RerunEditorSearchAction extends Action { async run() { if (this.configurationService.getValue('search').enableSearchEditorPreview) { await this.progressService.withProgress({ location: ProgressLocation.Window }, - () => refreshActiveEditorSearch(this.editorService, this.instantiationService, this.contextService, this.labelService, this.configurationService)); + () => refreshActiveEditorSearch(undefined, this.editorService, this.instantiationService, this.contextService, this.labelService, this.configurationService)); + } + } +} + +export class RerunEditorSearchWithContextAction extends Action { + + static readonly ID: string = Constants.RerunEditorSearchWithContextCommandId; + static readonly LABEL = nls.localize('search.rerunEditorSearchContext', "Search Again (With Context)"); + + constructor(id: string, label: string, + @IInstantiationService private instantiationService: IInstantiationService, + @IEditorService private editorService: IEditorService, + @IConfigurationService private configurationService: IConfigurationService, + @IWorkspaceContextService private contextService: IWorkspaceContextService, + @ILabelService private labelService: ILabelService, + @IProgressService private progressService: IProgressService, + @IQuickInputService private quickPickService: IQuickInputService + ) { + super(id, label); + } + + async run() { + const lines = await this.quickPickService.input({ + prompt: nls.localize('lines', "Lines of Context"), + value: '2', + validateInput: async (value) => isNaN(parseInt(value)) ? nls.localize('mustBeInteger', "Must enter an integer") : undefined + }); + if (lines === undefined) { return; } + if (this.configurationService.getValue('search').enableSearchEditorPreview) { + await this.progressService.withProgress({ location: ProgressLocation.Window }, + () => refreshActiveEditorSearch(+lines, this.editorService, this.instantiationService, this.contextService, this.labelService, this.configurationService)); } } } diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 4f515b013b1..46792e7b680 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -65,6 +65,7 @@ const matchToSearchResultFormat = (match: Match): { line: string, ranges: Range[ }; type SearchResultSerialization = { text: string[], matchRanges: Range[] }; + function fileMatchToSearchResultFormat(fileMatch: FileMatch, labelFormatter: (x: URI) => string): SearchResultSerialization { const serializedMatches = flatten(fileMatch.matches() .sort(searchMatchComparer) @@ -76,17 +77,37 @@ function fileMatchToSearchResultFormat(fileMatch: FileMatch, labelFormatter: (x: const targetLineNumberToOffset: Record = {}; + const context: { line: string, lineNumber: number }[] = []; + fileMatch.context.forEach((line, lineNumber) => context.push({ line, lineNumber })); + context.sort((a, b) => a.lineNumber - b.lineNumber); + + let lastLine: number | undefined = undefined; + const seenLines = new Set(); serializedMatches.forEach(match => { if (!seenLines.has(match.line)) { + while (context.length && context[0].lineNumber < +match.lineNumber) { + const { line, lineNumber } = context.shift()!; + if (lastLine !== undefined && lineNumber !== lastLine + 1) { + text.push(''); + } + text.push(` ${lineNumber} ${line}`); + lastLine = lineNumber; + } + targetLineNumberToOffset[match.lineNumber] = text.length; seenLines.add(match.line); text.push(match.line); + lastLine = +match.lineNumber; } matchRanges.push(...match.ranges.map(translateRangeLines(targetLineNumberToOffset[match.lineNumber]))); }); + while (context.length) { + const { line, lineNumber } = context.shift()!; + text.push(` ${lineNumber} ${line}`); + } return { text, matchRanges }; } @@ -104,7 +125,7 @@ const flattenSearchResultSerializations = (serializations: SearchResultSerializa return { text, matchRanges }; }; -const contentPatternToSearchResultHeader = (pattern: ITextQuery | null, includes: string, excludes: string): string[] => { +const contentPatternToSearchResultHeader = (pattern: ITextQuery | null, includes: string, excludes: string, contextLines: number): string[] => { if (!pattern) { return []; } const removeNullFalseAndUndefined = (a: (T | null | false | undefined)[]) => a.filter(a => a !== false && a !== null && a !== undefined) as T[]; @@ -123,16 +144,32 @@ const contentPatternToSearchResultHeader = (pattern: ITextQuery | null, includes ]).join(' ')}`, includes ? `# Including: ${includes}` : undefined, excludes ? `# Excluding: ${excludes}` : undefined, + contextLines ? `# ContextLines: ${contextLines}` : undefined, '' ]); }; -const searchHeaderToContentPattern = (header: string[]): { pattern: string, flags: { regex: boolean, wholeWord: boolean, caseSensitive: boolean, ignoreExcludes: boolean }, includes: string, excludes: string } => { - const query = { + +type SearchHeader = { + pattern: string; + flags: { + regex: boolean; + wholeWord: boolean; + caseSensitive: boolean; + ignoreExcludes: boolean; + }; + includes: string; + excludes: string; + context: number | undefined; +}; + +const searchHeaderToContentPattern = (header: string[]): SearchHeader => { + const query: SearchHeader = { pattern: '', flags: { regex: false, caseSensitive: false, ignoreExcludes: false, wholeWord: false }, includes: '', - excludes: '' + excludes: '', + context: undefined }; const unescapeNewlines = (str: string) => str.replace(/\\\\/g, '\\').replace(/\\n/g, '\n'); @@ -145,6 +182,7 @@ const searchHeaderToContentPattern = (header: string[]): { pattern: string, flag case 'Query': query.pattern = unescapeNewlines(value); break; case 'Including': query.includes = value; break; case 'Excluding': query.excludes = value; break; + case 'ContextLines': query.context = +value; break; case 'Flags': { query.flags = { regex: value.indexOf('RegExp') !== -1, @@ -159,19 +197,20 @@ const searchHeaderToContentPattern = (header: string[]): { pattern: string, flag return query; }; -const serializeSearchResultForEditor = (searchResult: SearchResult, rawIncludePattern: string, rawExcludePattern: string, labelFormatter: (x: URI) => string): SearchResultSerialization => { - const header = contentPatternToSearchResultHeader(searchResult.query, rawIncludePattern, rawExcludePattern); +const serializeSearchResultForEditor = (searchResult: SearchResult, rawIncludePattern: string, rawExcludePattern: string, contextLines: number, labelFormatter: (x: URI) => string): SearchResultSerialization => { + const header = contentPatternToSearchResultHeader(searchResult.query, rawIncludePattern, rawExcludePattern, contextLines); const allResults = flattenSearchResultSerializations( - flatten(searchResult.folderMatches().sort(searchMatchComparer) - .map(folderMatch => folderMatch.matches().sort(searchMatchComparer) - .map(fileMatch => fileMatchToSearchResultFormat(fileMatch, labelFormatter))))); + flatten( + searchResult.folderMatches().sort(searchMatchComparer) + .map(folderMatch => folderMatch.matches().sort(searchMatchComparer) + .map(fileMatch => fileMatchToSearchResultFormat(fileMatch, labelFormatter))))); return { matchRanges: allResults.matchRanges.map(translateRangeLines(header.length)), text: header.concat(allResults.text) }; }; export const refreshActiveEditorSearch = - async (editorService: IEditorService, instantiationService: IInstantiationService, contextService: IWorkspaceContextService, labelService: ILabelService, configurationService: IConfigurationService) => { + async (contextLines: number | undefined, editorService: IEditorService, instantiationService: IInstantiationService, contextService: IWorkspaceContextService, labelService: ILabelService, configurationService: IConfigurationService) => { const model = editorService.activeTextEditorWidget?.getModel(); if (!model) { return; } @@ -190,6 +229,8 @@ export const refreshActiveEditorSearch = isWordMatch: contentPattern.flags.wholeWord }; + contextLines = contextLines ?? contentPattern.context ?? 0; + const options: ITextQueryBuilderOptions = { _reason: 'searchEditor', extraFileResources: instantiationService.invokeFunction(getOutOfWorkspaceEditorResources), @@ -202,6 +243,8 @@ export const refreshActiveEditorSearch = matchLines: 1, charsPerLine: 1000 }, + afterContext: contextLines, + beforeContext: contextLines, isSmartCase: configurationService.getValue('search').smartCase, expandPatterns: true }; @@ -220,7 +263,7 @@ export const refreshActiveEditorSearch = await searchModel.search(query); const labelFormatter = (uri: URI): string => labelService.getUriLabel(uri, { relative: true }); - const results = serializeSearchResultForEditor(searchModel.searchResult, '', '', labelFormatter); + const results = serializeSearchResultForEditor(searchModel.searchResult, contentPattern.includes, contentPattern.excludes, contextLines, labelFormatter); textModel.setValue(results.text.join(lineDelimiter)); textModel.deltaDecorations([], results.matchRanges.map(range => ({ range, options: { className: 'searchEditorFindMatch', stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } }))); @@ -233,7 +276,7 @@ export const createEditorFromSearchResult = const labelFormatter = (uri: URI): string => labelService.getUriLabel(uri, { relative: true }); - const results = serializeSearchResultForEditor(searchResult, rawIncludePattern, rawExcludePattern, labelFormatter); + const results = serializeSearchResultForEditor(searchResult, rawIncludePattern, rawExcludePattern, 0, labelFormatter); let possible = { contents: results.text.join(lineDelimiter), @@ -255,7 +298,6 @@ export const createEditorFromSearchResult = model.deltaDecorations([], results.matchRanges.map(range => ({ range, options: { className: 'searchEditorFindMatch', stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } }))); }; -// theming registerThemingParticipant((theme, collector) => { collector.addRule(`.monaco-editor .searchEditorFindMatch { background-color: ${theme.getColor(searchEditorFindMatch)}; }`); diff --git a/src/vs/workbench/contrib/search/common/constants.ts b/src/vs/workbench/contrib/search/common/constants.ts index 483190b6498..b7c72d5d5cd 100644 --- a/src/vs/workbench/contrib/search/common/constants.ts +++ b/src/vs/workbench/contrib/search/common/constants.ts @@ -17,6 +17,7 @@ export const CopyMatchCommandId = 'search.action.copyMatch'; export const CopyAllCommandId = 'search.action.copyAll'; export const OpenInEditorCommandId = 'search.action.openInEditor'; export const RerunEditorSearchCommandId = 'search.action.rerunEditorSearch'; +export const RerunEditorSearchWithContextCommandId = 'search.action.rerunEditorSearchWithContext'; export const ClearSearchHistoryCommandId = 'search.action.clearHistory'; export const FocusSearchListCommandID = 'search.action.focusSearchList'; export const ReplaceActionId = 'search.action.replace'; diff --git a/src/vs/workbench/contrib/search/common/searchModel.ts b/src/vs/workbench/contrib/search/common/searchModel.ts index 18ce0750f09..477b2de22e0 100644 --- a/src/vs/workbench/contrib/search/common/searchModel.ts +++ b/src/vs/workbench/contrib/search/common/searchModel.ts @@ -20,7 +20,7 @@ import { IModelService } from 'vs/editor/common/services/modelService'; import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IProgress, IProgressStep } from 'vs/platform/progress/common/progress'; import { ReplacePattern } from 'vs/workbench/services/search/common/replace'; -import { IFileMatch, IPatternInfo, ISearchComplete, ISearchProgressItem, ISearchConfigurationProperties, ISearchService, ITextQuery, ITextSearchPreviewOptions, ITextSearchMatch, ITextSearchStats, resultIsMatch, ISearchRange, OneLineRange } from 'vs/workbench/services/search/common/search'; +import { IFileMatch, IPatternInfo, ISearchComplete, ISearchProgressItem, ISearchConfigurationProperties, ISearchService, ITextQuery, ITextSearchPreviewOptions, ITextSearchMatch, ITextSearchStats, resultIsMatch, ISearchRange, OneLineRange, ITextSearchContext, ITextSearchResult } from 'vs/workbench/services/search/common/search'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { overviewRulerFindMatchForeground, minimapFindMatch } from 'vs/platform/theme/common/colorRegistry'; import { themeColorFromId } from 'vs/platform/theme/common/themeService'; @@ -197,6 +197,11 @@ export class FileMatch extends Disposable implements IFileMatch { private _updateScheduler: RunOnceScheduler; private _modelDecorations: string[] = []; + private _context: Map = new Map(); + public get context(): Map { + return new Map(this._context); + } + constructor(private _query: IPatternInfo, private _previewOptions: ITextSearchPreviewOptions | undefined, private _maxResults: number | undefined, private _parent: FolderMatch, private rawMatch: IFileMatch, @IModelService private readonly modelService: IModelService, @IReplaceService private readonly replaceService: IReplaceService ) { @@ -221,6 +226,8 @@ export class FileMatch extends Disposable implements IFileMatch { textSearchResultToMatches(rawMatch, this) .forEach(m => this.add(m)); }); + + this.addContext(this.rawMatch.results); } } @@ -375,6 +382,14 @@ export class FileMatch extends Disposable implements IFileMatch { return getBaseLabel(this.resource); } + addContext(results: ITextSearchResult[] | undefined) { + if (!results) { return; } + + results + .filter((result => !resultIsMatch(result)) as ((a: any) => a is ITextSearchContext)) + .forEach(context => this._context.set(context.lineNumber, context.text)); + } + add(match: Match, trigger?: boolean) { this._matches.set(match.id(), match); if (trigger) { @@ -479,6 +494,8 @@ export class FolderMatch extends Disposable { .forEach(m => existingFileMatch.add(m)); }); updated.push(existingFileMatch); + + existingFileMatch.addContext(rawFileMatch.results); } else { const fileMatch = this.instantiationService.createInstance(FileMatch, this._query.contentPattern, this._query.previewOptions, this._query.maxResults, this, rawFileMatch); this.doAdd(fileMatch); From 97855786a014be2440751b038b373c3726e11fe8 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 2 Dec 2019 19:45:07 -0800 Subject: [PATCH 053/637] Fix absolute paths in markdown preview on windows Fixes #84728 We should use `.fsPath` for both parts of the uri in this case. --- .../markdown-language-features/src/markdownEngine.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/markdown-language-features/src/markdownEngine.ts b/extensions/markdown-language-features/src/markdownEngine.ts index d3b88f06c42..33cb220b449 100644 --- a/extensions/markdown-language-features/src/markdownEngine.ts +++ b/extensions/markdown-language-features/src/markdownEngine.ts @@ -242,8 +242,11 @@ export class MarkdownEngine { if (uri.path[0] === '/') { const root = vscode.workspace.getWorkspaceFolder(this.currentDocument!); if (root) { - uri = uri.with({ - path: path.join(root.uri.fsPath, uri.path), + const fileUri = vscode.Uri.file(path.join(root.uri.fsPath, uri.fsPath)); + uri = fileUri.with({ + scheme: uri.scheme, + fragment: uri.fragment, + query: uri.query, }); } } From 28c85551aefd561dba5a71315caf0b05ac08fc4e Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 3 Dec 2019 07:34:59 +0100 Subject: [PATCH 054/637] add test plan item template --- .github/ISSUE_TEMPLATE/test_plan_item.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/test_plan_item.md diff --git a/.github/ISSUE_TEMPLATE/test_plan_item.md b/.github/ISSUE_TEMPLATE/test_plan_item.md new file mode 100644 index 00000000000..aceb28efabb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/test_plan_item.md @@ -0,0 +1,18 @@ +--- +name: Test Plan Item +about: Create a test plan item describing how to test a feature +--- + +Refs: + +- [ ] Mac +- [ ] Linux +- [ ] Windows + +Complexity: + +Authors: + +--- + + From 86076f07711eb2969eddddfe4c9c8237fcf1e81f Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 3 Dec 2019 07:36:29 +0100 Subject: [PATCH 055/637] :lipstick: --- .github/ISSUE_TEMPLATE/test_plan_item.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test_plan_item.md b/.github/ISSUE_TEMPLATE/test_plan_item.md index aceb28efabb..6aedc050556 100644 --- a/.github/ISSUE_TEMPLATE/test_plan_item.md +++ b/.github/ISSUE_TEMPLATE/test_plan_item.md @@ -3,7 +3,7 @@ name: Test Plan Item about: Create a test plan item describing how to test a feature --- -Refs: +Refs: - [ ] Mac - [ ] Linux From 2cb579c4c7a3510cf8a2346800494f997f5be1f9 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 3 Dec 2019 08:16:10 +0100 Subject: [PATCH 056/637] update author line --- .github/ISSUE_TEMPLATE/test_plan_item.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/test_plan_item.md b/.github/ISSUE_TEMPLATE/test_plan_item.md index 6aedc050556..816de53f677 100644 --- a/.github/ISSUE_TEMPLATE/test_plan_item.md +++ b/.github/ISSUE_TEMPLATE/test_plan_item.md @@ -11,7 +11,7 @@ Refs: Complexity: -Authors: +Authors: --- From 491a638b9812d524da219875c09fa2f6edb9d4fa Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 3 Dec 2019 08:41:45 +0100 Subject: [PATCH 057/637] include link to wiki --- .github/ISSUE_TEMPLATE/test_plan_item.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/test_plan_item.md b/.github/ISSUE_TEMPLATE/test_plan_item.md index 816de53f677..f386933832e 100644 --- a/.github/ISSUE_TEMPLATE/test_plan_item.md +++ b/.github/ISSUE_TEMPLATE/test_plan_item.md @@ -13,6 +13,8 @@ Complexity: Authors: + + --- From 56c6acd2fe1a2b7f53d4fd0cf0dfcc27837eb585 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 3 Dec 2019 09:44:10 +0100 Subject: [PATCH 058/637] update semantic test --- .../src/colorizerTestMain.ts | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index 76c1277f2ac..62aab90009d 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -8,31 +8,42 @@ import * as jsoncParser from 'jsonc-parser'; export function activate(context: vscode.ExtensionContext): any { - const tokenModifiers = ['static', 'abstract', 'deprecated']; - const tokenTypes = ['strings', 'types', 'structs', 'classes', 'functions', 'variables']; + const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; + const tokenTypes = ['types', 'structs', 'classes', 'interfaces', 'enums', 'parameterTypes', 'functions', 'variables']; + const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); const semanticHighlightProvider: vscode.SemanticTokensProvider = { provideSemanticTokens(document: vscode.TextDocument): vscode.ProviderResult { const builder = new vscode.SemanticTokensBuilder(); + function addToken(type: string, modifiers: string[], startLine: number, startCharacter: number, length: number) { + let tokenType = legend.tokenTypes.indexOf(type); + if (tokenType === -1) { + tokenType = 0; + } + + let tokenModifiers = 0; + for (let i = 0; i < modifiers.length; i++) { + const index = legend.tokenModifiers.indexOf(modifiers[i]); + if (index !== -1) { + tokenModifiers = tokenModifiers | 1 << index; + } + } + + builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); + } + const visitor: jsoncParser.JSONVisitor = { onObjectProperty: (property: string, _offset: number, length: number, startLine: number, startCharacter: number) => { const [type, ...modifiers] = property.split('.'); - let tokenType = legend.tokenTypes.indexOf(type); - if (tokenType === -1) { - tokenType = 0; + addToken(type, modifiers, startLine, startCharacter, length); + }, + onLiteralValue: (value: any, _offset: number, length: number, startLine: number, startCharacter: number) => { + if (typeof value === 'string') { + const [type, ...modifiers] = value.split('.'); + addToken(type, modifiers, startLine, startCharacter, length); } - - let tokenModifiers = 0; - for (let i = 0; i < modifiers.length; i++) { - const index = legend.tokenModifiers.indexOf(modifiers[i]); - if (index !== -1) { - tokenModifiers = tokenModifiers | 1 << index; - } - } - - builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); } }; jsoncParser.visit(document.getText(), visitor); @@ -42,6 +53,6 @@ export function activate(context: vscode.ExtensionContext): any { }; - context.subscriptions.push(vscode.languages.registerSemanticTokensProvider({ pattern: '**/color-test.json' }, semanticHighlightProvider, legend)); + context.subscriptions.push(vscode.languages.registerSemanticTokensProvider({ pattern: '**/*semantic-test.json' }, semanticHighlightProvider, legend)); } From 36ef46d4d05de205e065931c3db19e85a1f8b268 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 3 Dec 2019 10:39:36 +0100 Subject: [PATCH 059/637] remove tpi template --- .github/ISSUE_TEMPLATE/test_plan_item.md | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/test_plan_item.md diff --git a/.github/ISSUE_TEMPLATE/test_plan_item.md b/.github/ISSUE_TEMPLATE/test_plan_item.md deleted file mode 100644 index f386933832e..00000000000 --- a/.github/ISSUE_TEMPLATE/test_plan_item.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Test Plan Item -about: Create a test plan item describing how to test a feature ---- - -Refs: - -- [ ] Mac -- [ ] Linux -- [ ] Windows - -Complexity: - -Authors: - - - ---- - - From 07241fc8edb0224432eb92cd44fed06a21902bf4 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Tue, 3 Dec 2019 10:43:21 +0100 Subject: [PATCH 060/637] remove space fixes #85869 --- build/win32/code.iss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/win32/code.iss b/build/win32/code.iss index 54bde39080a..5c995f26636 100644 --- a/build/win32/code.iss +++ b/build/win32/code.iss @@ -964,10 +964,10 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBas Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBasename}.exe\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\default.ico" Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\Applications\{#ExeBasename}.exe\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1""" -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu, {#ShellNameShort}}"; Tasks: addcontextmenufiles; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufiles; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufiles Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\*\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: addcontextmenufiles -Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu, {#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey +Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "{cm:OpenWithCodeContextMenu,{#ShellNameShort}}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}"; ValueType: expandsz; ValueName: "Icon"; ValueData: "{app}\{#ExeBasename}.exe"; Tasks: addcontextmenufolders Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\shell\{#RegValueName}\command"; ValueType: expandsz; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%V"""; Tasks: addcontextmenufolders Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\directory\background\shell\{#RegValueName}"; ValueType: expandsz; ValueName: ""; ValueData: "Open w&ith {#ShellNameShort}"; Tasks: addcontextmenufolders; Flags: uninsdeletekey From 8b449d1a0874b52b9a2d088ed1be6a7fd8d0051b Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 3 Dec 2019 10:52:47 +0100 Subject: [PATCH 061/637] semantic token test: fix length, skip unknown tokens --- .../src/colorizerTestMain.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index 62aab90009d..e9536994cf7 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -8,8 +8,8 @@ import * as jsoncParser from 'jsonc-parser'; export function activate(context: vscode.ExtensionContext): any { - const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; const tokenTypes = ['types', 'structs', 'classes', 'interfaces', 'enums', 'parameterTypes', 'functions', 'variables']; + const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); @@ -17,10 +17,12 @@ export function activate(context: vscode.ExtensionContext): any { provideSemanticTokens(document: vscode.TextDocument): vscode.ProviderResult { const builder = new vscode.SemanticTokensBuilder(); - function addToken(type: string, modifiers: string[], startLine: number, startCharacter: number, length: number) { + function addToken(value: string, startLine: number, startCharacter: number, length: number) { + const [type, ...modifiers] = value.split('.'); + let tokenType = legend.tokenTypes.indexOf(type); if (tokenType === -1) { - tokenType = 0; + return; } let tokenModifiers = 0; @@ -31,18 +33,17 @@ export function activate(context: vscode.ExtensionContext): any { } } + builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); } const visitor: jsoncParser.JSONVisitor = { - onObjectProperty: (property: string, _offset: number, length: number, startLine: number, startCharacter: number) => { - const [type, ...modifiers] = property.split('.'); - addToken(type, modifiers, startLine, startCharacter, length); + onObjectProperty: (property: string, _offset: number, _length: number, startLine: number, startCharacter: number) => { + addToken(property, startLine, startCharacter, property.length + 2); }, onLiteralValue: (value: any, _offset: number, length: number, startLine: number, startCharacter: number) => { if (typeof value === 'string') { - const [type, ...modifiers] = value.split('.'); - addToken(type, modifiers, startLine, startCharacter, length); + addToken(value, startLine, startCharacter, length); } } }; From 929080f70cf076ce16716b0495198205fac51d7d Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 3 Dec 2019 16:03:53 +0100 Subject: [PATCH 062/637] JSONC: Completion inserts one extra double quote. Fixes #86078 --- extensions/json-language-features/package.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/extensions/json-language-features/package.json b/extensions/json-language-features/package.json index 37417289ed2..69d898b9e7f 100644 --- a/extensions/json-language-features/package.json +++ b/extensions/json-language-features/package.json @@ -95,11 +95,17 @@ }, "configurationDefaults": { "[json]": { - "editor.quickSuggestions": { - "strings": true - }, - "editor.suggest.insertMode": "replace" - } + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace" + }, + "[jsonc]": { + "editor.quickSuggestions": { + "strings": true + }, + "editor.suggest.insertMode": "replace" + } } }, "dependencies": { From 3c1508c227a0a4a7a10d56e9365b0f5f5d532749 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 3 Dec 2019 16:35:47 +0100 Subject: [PATCH 063/637] fixes #83523 --- .../contrib/debug/browser/debugConfigurationManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index fcfb9fc251b..eecb9c57d6c 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -18,7 +18,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IFileService } from 'vs/platform/files/common/files'; -import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService, IWorkspaceFolder, WorkbenchState, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IDebugAdapterDescriptorFactory, IDebugAdapter, IDebugSession, IAdapterDescriptor, CONTEXT_DEBUG_CONFIGURATION_TYPE, IDebugAdapterFactory } from 'vs/workbench/contrib/debug/common/debug'; @@ -284,7 +284,7 @@ export class ConfigurationManager implements IConfigurationManager { }); }); - this.toDispose.push(this.contextService.onDidChangeWorkspaceFolders(() => { + this.toDispose.push(Event.any(this.contextService.onDidChangeWorkspaceFolders, this.contextService.onDidChangeWorkbenchState)(() => { this.initLaunches(); const toSelect = this.selectedLaunch || (this.launches.length > 0 ? this.launches[0] : undefined); this.selectConfiguration(toSelect); From 9d47191895b0705f689a234c1a4e1e790303cb70 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Tue, 3 Dec 2019 10:37:36 -0800 Subject: [PATCH 064/637] Re #85313. Fix suggest widget position for extension editor. --- .../contrib/codeEditor/browser/simpleEditorOptions.ts | 4 ++-- .../browser/suggestEnabledInput/suggestEnabledInput.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts index ac40c376e27..ff80bd1ec20 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts @@ -13,7 +13,7 @@ import { SelectionClipboardContributionID } from 'vs/workbench/contrib/codeEdito import { TabCompletionController } from 'vs/workbench/contrib/snippets/browser/tabCompletion'; import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions'; -export function getSimpleEditorOptions(): IEditorOptions { +export function getSimpleEditorOptions(fixedOverflowWidgets: boolean = true): IEditorOptions { return { wordWrap: 'on', overviewRulerLanes: 0, @@ -30,7 +30,7 @@ export function getSimpleEditorOptions(): IEditorOptions { overviewRulerBorder: false, scrollBeyondLastLine: false, renderLineHighlight: 'none', - fixedOverflowWidgets: true, + fixedOverflowWidgets: fixedOverflowWidgets, acceptSuggestionOnEnter: 'smart', minimap: { enabled: false diff --git a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts index b9731888148..eb0499385ca 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts @@ -126,7 +126,7 @@ export class SuggestEnabledInput extends Widget implements IThemable { this.placeholderText = append(this.stylingContainer, $('.suggest-input-placeholder', undefined, options.placeholderText || '')); const editorOptions: IEditorOptions = mixin( - getSimpleEditorOptions(), + getSimpleEditorOptions(false), getSuggestEnabledInputOptions(ariaLabel)); this.inputWidget = instantiationService.createInstance(CodeEditorWidget, this.stylingContainer, From 74ffa7942a107b9cfc45525e508ac601b79aacc1 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Tue, 3 Dec 2019 11:11:53 -0800 Subject: [PATCH 065/637] Fix layers overlap and cutting at edges. (#85724) * Fix layers overlap and cutting at edges. * limit part focus within css to windows and linux only --- src/vs/workbench/browser/media/part.css | 21 ++++++++++++++++++- .../activitybar/media/activitybarpart.css | 15 ------------- .../parts/sidebar/media/sidebarpart.css | 4 +--- .../parts/titlebar/media/titlebarpart.css | 16 +------------- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/src/vs/workbench/browser/media/part.css b/src/vs/workbench/browser/media/part.css index 89dd7fe4c9b..46c88e56c1d 100644 --- a/src/vs/workbench/browser/media/part.css +++ b/src/vs/workbench/browser/media/part.css @@ -5,7 +5,26 @@ .monaco-workbench .part { box-sizing: border-box; - overflow: hidden; +} + +.monaco-workbench.windows.chromium .part, +.monaco-workbench.linux.chromium .part { + /* + * Explicitly put the part onto its own layer to help Chrome to + * render the content with LCD-anti-aliasing. By partioning the + * workbench into multiple layers, we can ensure that a bad + * behaving part is not making another part fallback to greyscale + * rendering. + * + * macOS: does not render LCD-anti-aliased. + */ + transform: translate3d(0px, 0px, 0px); + position: relative; +} + +.monaco-workbench.windows.chromium .part:focus-within, +.monaco-workbench.linux.chromium .part:focus-within { + z-index: 1000; } .monaco-workbench .part > .title { diff --git a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css index 09bb59d2980..cbc3d14705b 100644 --- a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css +++ b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css @@ -7,21 +7,6 @@ width: 48px; } -.monaco-workbench.windows.chromium .part.activitybar, -.monaco-workbench.linux.chromium .part.activitybar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - overflow: visible; /* when a new layer is created, we need to set overflow visible to avoid clipping the menubar */ -} - .monaco-workbench .activitybar > .content { height: 100%; display: flex; diff --git a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css index 1e2fad096a3..8307e81f13e 100644 --- a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css +++ b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css @@ -17,9 +17,7 @@ transform: translate3d(0px, 0px, 0px); } -.monaco-workbench .part.sidebar > .content { - overflow: hidden; -} + .monaco-workbench.nosidebar > .part.sidebar { display: none !important; diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 54c67324b61..c44fc4bcac5 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -19,21 +19,7 @@ display: flex; } -.monaco-workbench.windows .part.titlebar, -.monaco-workbench.linux .part.titlebar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - position: relative; - z-index: 1000; /* move the entire titlebar above the workbench, except modals/dialogs */ -} + .monaco-workbench .part.titlebar > .titlebar-drag-region { top: 0; From a868166d9ece2af3be2579ce5c873117790db87b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 3 Dec 2019 17:35:47 -0500 Subject: [PATCH 066/637] Removes codicons support in markdown images Will come back in a different form soon --- src/vs/base/browser/markdownRenderer.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index 0a80b7cf934..58da2e0be68 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -15,7 +15,6 @@ import { cloneAndChange } from 'vs/base/common/objects'; import { escape } from 'vs/base/common/strings'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; export interface MarkdownRenderOptions extends FormattedTextRenderOptions { codeBlockRenderer?: (modeId: string, value: string) => Promise; @@ -73,10 +72,6 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende const renderer = new marked.Renderer(); renderer.image = (href: string, title: string, text: string) => { - if (href && href.indexOf('vscode-icon://codicon/') === 0) { - return renderCodicons(`$(${URI.parse(href).path.substr(1)})`); - } - let dimensions: string[] = []; let attributes: string[] = []; if (href) { From e1c3efa3be837f78680bf4208d0b7a6b7a84a456 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 3 Dec 2019 15:49:33 -0800 Subject: [PATCH 067/637] Fix #86051 --- src/vs/workbench/contrib/remote/browser/remoteViewlet.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css index 39b5cdec500..f0b017e457a 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css +++ b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css @@ -35,5 +35,5 @@ } .monaco-workbench .part > .title > .title-actions .switch-remote > .monaco-select-box { - padding-left: 3px; + padding: 0 22px 0 6px; } From f0a557f56ecd7eb614357e777e124827d3cbb1dd Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 3 Dec 2019 15:54:28 -0800 Subject: [PATCH 068/637] Fix #86031, add rounded corners for remote input on mac --- src/vs/workbench/contrib/remote/browser/remoteViewlet.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css index f0b017e457a..211bdc00027 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css +++ b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css @@ -27,6 +27,11 @@ height: 20px; flex-shrink: 1; margin-top: 7px; + border-radius: 4px; +} + +.monaco-workbench.mac .part > .title > .title-actions .switch-remote { + border-radius: 4px; } .switch-remote > .monaco-select-box { From 5c3ecb4e101d1ca3252cb034edab6f9504efef2d Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 3 Dec 2019 15:55:48 -0800 Subject: [PATCH 069/637] Remove extra line for #86031 --- src/vs/workbench/contrib/remote/browser/remoteViewlet.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css index 211bdc00027..c8f0d9f2964 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteViewlet.css +++ b/src/vs/workbench/contrib/remote/browser/remoteViewlet.css @@ -27,7 +27,6 @@ height: 20px; flex-shrink: 1; margin-top: 7px; - border-radius: 4px; } .monaco-workbench.mac .part > .title > .title-actions .switch-remote { From f4909e4f8e166d94086828b018b7c3eb54867038 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Tue, 3 Dec 2019 15:58:12 -0800 Subject: [PATCH 070/637] Add enum descriptions to scm.diffDecorations setting, fixes #86206 --- src/vs/workbench/contrib/scm/browser/scm.contribution.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index 0c40988389f..0021ac28e7d 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -81,6 +81,13 @@ Registry.as(ConfigurationExtensions.Configuration).regis 'scm.diffDecorations': { type: 'string', enum: ['all', 'gutter', 'overview', 'minimap', 'none'], + enumDescriptions: [ + localize('scm.diffDecorations.all', "Show the diff decorations in all available locations."), + localize('scm.diffDecorations.gutter', "Show the diff decorations only in the editor gutter."), + localize('scm.diffDecorations.overviewRuler', "Show the diff decorations only in the overview ruler."), + localize('scm.diffDecorations.minimap', "Show the diff decorations only in the minimap."), + localize('scm.diffDecorations.none', "Do not show the diff decorations.") + ], default: 'all', description: localize('diffDecorations', "Controls diff decorations in the editor.") }, From 2df315c3755dcd6de77385015e21e61134e84154 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 3 Dec 2019 15:58:31 -0800 Subject: [PATCH 071/637] Fix #86136 --- .../contrib/debug/browser/debugCallStackContribution.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts index ee78a18990e..a598a33d021 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts @@ -239,5 +239,5 @@ const focusedStackFrameColor = registerColor('editor.focusedStackFrameHighlightB const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.')); const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.')); const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.')); -const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for breakpoints.')); -const debugIconBreakpointStackframeFocusedForeground = registerColor('debugIcon.breakpointStackframeFocusedForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeFocusedForeground', 'Icon color for breakpoints.')); +const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for breakpoint stack frames.')); +const debugIconBreakpointStackframeFocusedForeground = registerColor('debugIcon.breakpointStackframeFocusedForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeFocusedForeground', 'Icon color for breakpoint stack frames that are focused.')); From 9794f2ba37fac4cb51478ac725f78f9a31e0ad30 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 3 Dec 2019 16:07:25 -0800 Subject: [PATCH 072/637] Fix #86126 --- .../contrib/debug/browser/debugCallStackContribution.ts | 2 +- .../contrib/debug/browser/media/debug.contribution.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts index a598a33d021..2959b8fd357 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts @@ -186,7 +186,7 @@ registerThemingParticipant((theme, collector) => { .monaco-workbench .codicon-debug-breakpoint-function, .monaco-workbench .codicon-debug-breakpoint-data, .monaco-workbench .codicon-debug-breakpoint-unsupported, - .monaco-workbench .codicon-debug-hint:not(*[class*='codicon-debug-breakpoint']) , + .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), .monaco-workbench .codicon-debug-breakpoint-stackframe-dot, .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after { color: ${debugIconBreakpointColor} !important; diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index 47fdbe45c60..215fb619865 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -7,7 +7,7 @@ cursor: pointer; } -.codicon-debug-hint:not(*[class*='codicon-debug-breakpoint']) { +.codicon-debug-hint:not([class*='codicon-debug-breakpoint']) { opacity: .4 !important; } From 27a00daa4031d394d73cdedc980f0a47c8be212a Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Tue, 3 Dec 2019 16:13:29 -0800 Subject: [PATCH 073/637] Increse search rendering delay. Fixes #86179 --- src/vs/workbench/contrib/search/common/searchModel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/common/searchModel.ts b/src/vs/workbench/contrib/search/common/searchModel.ts index 477b2de22e0..641a7557a37 100644 --- a/src/vs/workbench/contrib/search/common/searchModel.ts +++ b/src/vs/workbench/contrib/search/common/searchModel.ts @@ -999,7 +999,7 @@ export class SearchModel extends Disposable { this._replacePattern = new ReplacePattern(this.replaceString, this._searchQuery.contentPattern); // In search on type case, delay the streaming of results just a bit, so that we don't flash the only "local results" fast path - this._startStreamDelay = new Promise(resolve => setTimeout(resolve, this.searchConfig.searchOnType ? 100 : 0)); + this._startStreamDelay = new Promise(resolve => setTimeout(resolve, this.searchConfig.searchOnType ? 150 : 0)); const tokenSource = this.currentCancelTokenSource = new CancellationTokenSource(); const currentRequest = this.searchService.textSearch(this._searchQuery, this.currentCancelTokenSource.token, p => { From 43e3581aa635406ada2d8138d7ee242ddabefc1c Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 3 Dec 2019 16:44:20 -0800 Subject: [PATCH 074/637] Make sure custom editor prompt is not instantly dismissed by focus change Fixes #81765 --- src/vs/workbench/contrib/customEditor/browser/customEditors.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts index ea3e9dcdaf1..49e2d2fcb4d 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts @@ -335,6 +335,9 @@ export class CustomEditorContribution implements IWorkbenchContribution { return { override: (async () => { const standardEditor = await this.editorService.openEditor(editor, { ...options, ignoreOverrides: true }, group); + // Give a moment to make sure the editor is showing. + // Otherwise the focus shift can cause the prompt to be dismissed right away. + await new Promise(resolve => setTimeout(resolve, 20)); const selectedEditor = await this.customEditorService.promptOpenWith(resource, options, group); if (selectedEditor && selectedEditor.input) { await group.replaceEditors([{ From 2111655b67a3cd7a85320003e862f0e4b1d547e0 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 4 Dec 2019 09:32:50 +0100 Subject: [PATCH 075/637] Disable view hiding for the remote explorer (#86110) Fixes https://github.com/microsoft/vscode/issues/86039 --- .../browser/parts/views/viewsViewlet.ts | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index 1399797b257..b178ef2f317 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -101,8 +101,16 @@ export abstract class ViewContainerViewlet extends PaneViewlet implements IViews this.focus(); } - getContextMenuActions(): IAction[] { + getContextMenuActions(viewDescriptor?: IViewDescriptor): IAction[] { const result: IAction[] = []; + if (viewDescriptor) { + result.push({ + id: `${viewDescriptor.id}.removeView`, + label: localize('hideView', "Hide"), + enabled: viewDescriptor.canToggleVisibility, + run: () => this.toggleViewVisibility(viewDescriptor.id) + }); + } const viewToggleActions = this.viewsModel.viewDescriptors.map(viewDescriptor => ({ id: `${viewDescriptor.id}.toggleVisibility`, label: viewDescriptor.name, @@ -111,13 +119,17 @@ export abstract class ViewContainerViewlet extends PaneViewlet implements IViews run: () => this.toggleViewVisibility(viewDescriptor.id) })); - result.push(...viewToggleActions); - const parentActions = this.getViewletContextMenuActions(); - if (viewToggleActions.length && parentActions.length) { + if (result.length && viewToggleActions.length) { result.push(new Separator()); } + result.push(...viewToggleActions); + const parentActions = this.getViewletContextMenuActions(); + if (result.length && parentActions.length) { + result.push(new Separator()); + } result.push(...parentActions); + return result; } @@ -249,17 +261,7 @@ export abstract class ViewContainerViewlet extends PaneViewlet implements IViews event.stopPropagation(); event.preventDefault(); - const actions: IAction[] = []; - actions.push({ - id: `${viewDescriptor.id}.removeView`, - label: localize('hideView', "Hide"), - enabled: viewDescriptor.canToggleVisibility, - run: () => this.toggleViewVisibility(viewDescriptor.id) - }); - const otherActions = this.getContextMenuActions(); - if (otherActions.length) { - actions.push(...[new Separator(), ...otherActions]); - } + const actions: IAction[] = this.getContextMenuActions(viewDescriptor); let anchor: { x: number, y: number } = { x: event.posx, y: event.posy }; this.contextMenuService.showContextMenu({ From a43fc5fcb907b313765068f5ee3c641207a71bcb Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 10:39:39 +0100 Subject: [PATCH 076/637] increase debug toolbar z-index --- src/vs/workbench/contrib/debug/browser/media/debugToolBar.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css b/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css index 56d48297c37..70847c6647a 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css +++ b/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css @@ -5,7 +5,7 @@ .monaco-workbench .debug-toolbar { position: absolute; - z-index: 200; + z-index: 1000; height: 32px; display: flex; padding-left: 7px; From 7f1975a4fb29d0a788c21f17eb2aad056fec22d8 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 4 Dec 2019 10:52:25 +0100 Subject: [PATCH 077/637] Revert "Fix layers overlap and cutting at edges. (#85724)" This reverts commit 74ffa7942a107b9cfc45525e508ac601b79aacc1. --- src/vs/workbench/browser/media/part.css | 21 +------------------ .../activitybar/media/activitybarpart.css | 15 +++++++++++++ .../parts/sidebar/media/sidebarpart.css | 4 +++- .../parts/titlebar/media/titlebarpart.css | 16 +++++++++++++- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/browser/media/part.css b/src/vs/workbench/browser/media/part.css index 46c88e56c1d..89dd7fe4c9b 100644 --- a/src/vs/workbench/browser/media/part.css +++ b/src/vs/workbench/browser/media/part.css @@ -5,26 +5,7 @@ .monaco-workbench .part { box-sizing: border-box; -} - -.monaco-workbench.windows.chromium .part, -.monaco-workbench.linux.chromium .part { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - position: relative; -} - -.monaco-workbench.windows.chromium .part:focus-within, -.monaco-workbench.linux.chromium .part:focus-within { - z-index: 1000; + overflow: hidden; } .monaco-workbench .part > .title { diff --git a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css index cbc3d14705b..09bb59d2980 100644 --- a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css +++ b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css @@ -7,6 +7,21 @@ width: 48px; } +.monaco-workbench.windows.chromium .part.activitybar, +.monaco-workbench.linux.chromium .part.activitybar { + /* + * Explicitly put the part onto its own layer to help Chrome to + * render the content with LCD-anti-aliasing. By partioning the + * workbench into multiple layers, we can ensure that a bad + * behaving part is not making another part fallback to greyscale + * rendering. + * + * macOS: does not render LCD-anti-aliased. + */ + transform: translate3d(0px, 0px, 0px); + overflow: visible; /* when a new layer is created, we need to set overflow visible to avoid clipping the menubar */ +} + .monaco-workbench .activitybar > .content { height: 100%; display: flex; diff --git a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css index 8307e81f13e..1e2fad096a3 100644 --- a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css +++ b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css @@ -17,7 +17,9 @@ transform: translate3d(0px, 0px, 0px); } - +.monaco-workbench .part.sidebar > .content { + overflow: hidden; +} .monaco-workbench.nosidebar > .part.sidebar { display: none !important; diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index c44fc4bcac5..54c67324b61 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -19,7 +19,21 @@ display: flex; } - +.monaco-workbench.windows .part.titlebar, +.monaco-workbench.linux .part.titlebar { + /* + * Explicitly put the part onto its own layer to help Chrome to + * render the content with LCD-anti-aliasing. By partioning the + * workbench into multiple layers, we can ensure that a bad + * behaving part is not making another part fallback to greyscale + * rendering. + * + * macOS: does not render LCD-anti-aliased. + */ + transform: translate3d(0px, 0px, 0px); + position: relative; + z-index: 1000; /* move the entire titlebar above the workbench, except modals/dialogs */ +} .monaco-workbench .part.titlebar > .titlebar-drag-region { top: 0; From 9fd2603b485fdb874aefeecaa2a83ed4d884505d Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 4 Dec 2019 10:57:18 +0100 Subject: [PATCH 078/637] Remote explorer drop down should respect context keys Fixes #86209 --- src/vs/workbench/contrib/remote/browser/explorerViewItems.ts | 5 +++-- src/vs/workbench/contrib/remote/browser/remote.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts index 3cd6c869fca..4026be069da 100644 --- a/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts +++ b/src/vs/workbench/contrib/remote/browser/explorerViewItems.ts @@ -20,6 +20,7 @@ import { startsWith } from 'vs/base/common/strings'; import { isStringArray } from 'vs/base/common/types'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; export interface IRemoteSelectItem extends ISelectOptionItem { authority: string[]; @@ -85,10 +86,10 @@ export class SwitchRemoteViewItem extends SelectActionViewItem { return this.optionsItems[index]; } - static createOptionItems(views: IViewDescriptor[]): IRemoteSelectItem[] { + static createOptionItems(views: IViewDescriptor[], contextKeyService: IContextKeyService): IRemoteSelectItem[] { let options: IRemoteSelectItem[] = []; views.forEach(view => { - if (view.group && startsWith(view.group, 'targets') && view.remoteAuthority) { + if (view.group && startsWith(view.group, 'targets') && view.remoteAuthority && (!view.when || contextKeyService.contextMatchesRules(view.when))) { options.push({ text: view.name, authority: isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority] }); } }); diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 2d7afa657bf..030b5bf6370 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -280,6 +280,7 @@ export class RemoteViewlet extends FilterViewContainerViewlet { @IExtensionService extensionService: IExtensionService, @IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, + @IContextKeyService private readonly contextKeyService: IContextKeyService ) { super(VIEWLET_ID, remoteExplorerService.onDidChangeTargetType, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); } @@ -290,7 +291,7 @@ export class RemoteViewlet extends FilterViewContainerViewlet { public getActionViewItem(action: Action): IActionViewItem | undefined { if (action.id === SwitchRemoteAction.ID) { - return this.instantiationService.createInstance(SwitchRemoteViewItem, action, SwitchRemoteViewItem.createOptionItems(Registry.as(Extensions.ViewsRegistry).getViews(VIEW_CONTAINER))); + return this.instantiationService.createInstance(SwitchRemoteViewItem, action, SwitchRemoteViewItem.createOptionItems(Registry.as(Extensions.ViewsRegistry).getViews(VIEW_CONTAINER), this.contextKeyService)); } return super.getActionViewItem(action); From 510ca01434d037e19119575b00a7e50376d5c3ac Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 4 Dec 2019 11:09:03 +0100 Subject: [PATCH 079/637] Fix #86157 --- tslint.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tslint.json b/tslint.json index a0feadaf2c0..06adddd9c6e 100644 --- a/tslint.json +++ b/tslint.json @@ -75,6 +75,7 @@ "target": "**/vs/base/test/common/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/common/**", "**/vs/base/test/common/**" @@ -101,6 +102,7 @@ "target": "**/vs/base/test/browser/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/{common,browser}/**", "**/vs/base/test/{common,browser}/**" @@ -237,6 +239,7 @@ "target": "**/vs/editor/test/common/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/common/**", "**/vs/platform/*/common/**", @@ -259,6 +262,7 @@ "target": "**/vs/editor/test/browser/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/{common,browser}/**", "**/vs/platform/*/{common,browser}/**", @@ -281,6 +285,7 @@ "target": "**/vs/editor/standalone/test/common/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/common/**", "**/vs/platform/*/common/**", @@ -306,6 +311,7 @@ "target": "**/vs/editor/standalone/test/browser/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/{common,browser}/**", "**/vs/platform/*/{common,browser}/**", @@ -319,6 +325,7 @@ "target": "**/vs/editor/contrib/*/test/**", "restrictions": [ "assert", + "sinon", "vs/nls", "**/vs/base/{common,browser}/**", "**/vs/base/test/{common,browser}/**", From 82e9ac871eda24ab8ff5c9c38c46da6e109486cb Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 4 Dec 2019 11:19:27 +0100 Subject: [PATCH 080/637] Fixes #86132: Avoid using bitmap in API docs --- src/vs/vscode.proposed.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 62fc13b6430..251d6830ea3 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -144,8 +144,8 @@ declare module 'vscode' { * ``` * * 2. The first transformation is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked - * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Token modifiers are a set and they are looked up by a bitmap, - * so a `tokenModifier` value of `6` is first viewed as a bitmap `0b110`, so it will mean `[tokenModifiers[1], tokenModifiers[2]]` because + * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, + * so a `tokenModifier` value of `6` is first viewed as binary `0b110`, which means `[tokenModifiers[1], tokenModifiers[2]]` because * bits 1 and 2 are set. Using this legend, the tokens now are: * ``` * [ { line: 2, startChar: 5, length: 3, tokenType: 1, tokenModifiers: 6 }, // 6 is 0b110 From d82cd8740ba8069f5c8e54182ccd62e4f20ca037 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 4 Dec 2019 11:28:24 +0100 Subject: [PATCH 081/637] highlight root in peek, https://github.com/microsoft/vscode/issues/86128 --- .../contrib/callHierarchy/browser/callHierarchyPeek.ts | 6 +++++- .../contrib/callHierarchy/browser/callHierarchyTree.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index df5446fd52b..25fe8bade28 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -325,7 +325,11 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget { // set decorations for caller ranges (if in the same file) let decorations: IModelDeltaDecoration[] = []; let fullRange: IRange | undefined; - for (const loc of element.locations) { + let locations = element.locations; + if (!locations) { + locations = [{ uri: element.item.uri, range: element.item.selectionRange }]; + } + for (const loc of locations) { if (loc.uri.toString() === previewUri.toString()) { decorations.push({ range: loc.range, options }); fullRange = !fullRange ? loc.range : Range.plusRange(loc.range, fullRange); diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts index a00b49e0d01..c412f7b992a 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.ts @@ -17,7 +17,7 @@ import { Range } from 'vs/editor/common/core/range'; export class Call { constructor( readonly item: CallHierarchyItem, - readonly locations: Location[], + readonly locations: Location[] | undefined, readonly model: CallHierarchyModel, readonly parent: Call | undefined ) { } @@ -43,7 +43,7 @@ export class DataSource implements IAsyncDataSource { async getChildren(element: CallHierarchyModel | Call): Promise { if (element instanceof CallHierarchyModel) { - return [new Call(element.root, [], element, undefined)]; + return [new Call(element.root, undefined, element, undefined)]; } const { model, item } = element; From 49a150f406da247ae15118d1c3d3637c8acafb47 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 4 Dec 2019 11:29:58 +0100 Subject: [PATCH 082/637] update references view extension --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index f5c1750229c..e2f11ebf0b3 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -31,7 +31,7 @@ }, { "name": "ms-vscode.references-view", - "version": "0.0.39", + "version": "0.0.40", "repo": "https://github.com/Microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", From 59e50ec94ce19f6126e1d81b811acc6ba8de0a52 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 4 Dec 2019 11:45:32 +0100 Subject: [PATCH 083/637] fix #86048 --- src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts b/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts index 9d9bc68a558..879f3b9aaf9 100644 --- a/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts +++ b/src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ReferencesModel, OneReference } from 'vs/editor/contrib/gotoSymbol/referencesModel'; -import { RawContextKey, IContextKeyService, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; @@ -155,10 +155,7 @@ registerEditorCommand(new class extends EditorCommand { constructor() { super({ id: 'editor.gotoNextSymbolFromResult', - precondition: ContextKeyExpr.and( - ctxHasSymbols, - ContextKeyExpr.equals('config.editor.gotoLocation.multiple', 'goto') - ), + precondition: ctxHasSymbols, kbOpts: { weight: KeybindingWeight.EditorContrib, primary: KeyCode.F12 From 7d7cb80a87dcc8a79907720feba43d744340e2bf Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 12:34:04 +0100 Subject: [PATCH 084/637] fixes #86113 --- src/vs/workbench/contrib/debug/browser/debug.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index a32eb210b31..2ee642b2c86 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -84,7 +84,7 @@ class OpenDebugPanelAction extends TogglePanelAction { Registry.as(ViewletExtensions.Viewlets).registerViewlet(ViewletDescriptor.create( DebugViewlet, VIEWLET_ID, - nls.localize('debugAndRun', "Debug And Run"), + nls.localize('debugAndRun', "Debug and Run"), 'codicon-debug', 3 )); From 312701fe711a1f2b840f9887e564530b690d4eae Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 12:51:30 +0100 Subject: [PATCH 085/637] fixes #86111 --- .../contrib/debug/browser/startView.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/startView.ts b/src/vs/workbench/contrib/debug/browser/startView.ts index a390eb4c524..bfade3e4b0e 100644 --- a/src/vs/workbench/contrib/debug/browser/startView.ts +++ b/src/vs/workbench/contrib/debug/browser/startView.ts @@ -21,6 +21,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { equals } from 'vs/base/common/arrays'; +import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { KeyCode } from 'vs/base/common/keyCodes'; const $ = dom.$; export class StartView extends ViewletPane { @@ -72,16 +74,12 @@ export class StartView extends ViewletPane { const setSecondMessage = () => { secondMessageElement.textContent = localize('specifyHowToRun', "To futher configure Debug and Run"); - const clickElement = $('span.click'); - clickElement.textContent = localize('configure', " create a launch.json file."); - clickElement.onclick = () => this.commandService.executeCommand(ConfigureAction.ID); + const clickElement = this.createClickElement(localize('configure', " create a launch.json file."), () => this.commandService.executeCommand(ConfigureAction.ID)); this.secondMessageContainer.appendChild(clickElement); }; const setSecondMessageWithFolder = () => { secondMessageElement.textContent = localize('noLaunchConfiguration', "To futher configure Debug and Run, "); - const clickElement = $('span.click'); - clickElement.textContent = localize('openFolder', " open a folder"); - clickElement.onclick = () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false }); + const clickElement = this.createClickElement(localize('openFolder', " open a folder"), () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false })); this.secondMessageContainer.appendChild(clickElement); const moreText = $('span.moreText'); @@ -106,10 +104,7 @@ export class StartView extends ViewletPane { } if (!enabled && emptyWorkbench) { - const clickElement = $('span.click'); - clickElement.textContent = localize('openFile', "Open a file"); - clickElement.onclick = () => this.dialogService.pickFileAndOpen({ forceNewWindow: false }); - + const clickElement = this.createClickElement(localize('openFile', "Open a file"), () => this.dialogService.pickFileAndOpen({ forceNewWindow: false })); this.firstMessageContainer.appendChild(clickElement); const firstMessageElement = $('span'); this.firstMessageContainer.appendChild(firstMessageElement); @@ -121,6 +116,21 @@ export class StartView extends ViewletPane { } } + private createClickElement(textContent: string, action: () => any): HTMLSpanElement { + const clickElement = $('span.click'); + clickElement.textContent = textContent; + clickElement.onclick = action; + clickElement.tabIndex = 0; + clickElement.onkeyup = (e) => { + const keyboardEvent = new StandardKeyboardEvent(e); + if (keyboardEvent.keyCode === KeyCode.Enter || (keyboardEvent.keyCode === KeyCode.Space)) { + action(); + } + }; + + return clickElement; + } + protected renderBody(container: HTMLElement): void { this.firstMessageContainer = $('.top-section'); container.appendChild(this.firstMessageContainer); From 60d44109226c3f2d00ad32e89678292c1d51fd27 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 4 Dec 2019 14:16:00 +0100 Subject: [PATCH 086/637] Fix #85638 --- src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css index 8dde95a5b7e..560bb371cbf 100644 --- a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css +++ b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css @@ -51,7 +51,6 @@ .monaco-workbench .part.statusbar > .left-items { flex-grow: 1; /* left items push right items to the far right end */ - overflow: hidden; /* Hide the overflowing entries */ } .monaco-workbench .part.statusbar > .items-container > .statusbar-item { From 8e5169a6bfedfa23602293330a0ca70edd413c3f Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 14:27:40 +0100 Subject: [PATCH 087/637] fixes #85977 --- .../contrib/debug/browser/debugConfigurationManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index eecb9c57d6c..f67c70db9d8 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -80,7 +80,7 @@ export class ConfigurationManager implements IConfigurationManager { const previousSelectedRoot = this.storageService.get(DEBUG_SELECTED_ROOT, StorageScope.WORKSPACE); const previousSelectedLaunch = this.launches.filter(l => l.uri.toString() === previousSelectedRoot).pop(); this.debugConfigurationTypeContext = CONTEXT_DEBUG_CONFIGURATION_TYPE.bindTo(contextKeyService); - if (previousSelectedLaunch) { + if (previousSelectedLaunch && previousSelectedLaunch.getConfigurationNames().length) { this.selectConfiguration(previousSelectedLaunch, this.storageService.get(DEBUG_SELECTED_CONFIG_NAME_KEY, StorageScope.WORKSPACE)); } else if (this.launches.length > 0) { const rootUri = historyService.getLastActiveWorkspaceRoot(); From 6ee34c59734ef4a2b0323b9cbb72ac1d0d092912 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 14:34:28 +0100 Subject: [PATCH 088/637] fixes #86112 --- src/vs/workbench/contrib/debug/browser/debugService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 56e0f0c8a42..24dc3d59a8c 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -232,7 +232,8 @@ export class DebugService implements IDebugService { if (this.previousState !== state) { this.debugState.set(getStateLabel(state)); this.inDebugMode.set(state !== State.Inactive); - this.debugUx.set(!!(state !== State.Inactive || this.configurationManager.selectedConfiguration.name) ? 'default' : 'simple'); + // Only show the simple ux if debug is not yet started and if no launch.json exists + this.debugUx.set(((state !== State.Inactive && state !== State.Initializing) || this.configurationManager.selectedConfiguration.name) ? 'default' : 'simple'); this.previousState = state; this._onDidChangeState.fire(state); } From 0dbe568b59c9fd213bddc5ddc730a4892f3b011c Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 14:53:02 +0100 Subject: [PATCH 089/637] fixes #86103 --- .../contrib/customEditor/browser/commands.ts | 3 ++- .../browser/externalTerminal.contribution.ts | 4 ++-- .../contrib/files/browser/fileCommands.ts | 12 +++++++----- src/vs/workbench/contrib/files/browser/files.ts | 16 ++++++---------- .../electron-browser/fileActions.contribution.ts | 3 ++- .../search/browser/search.contribution.ts | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/commands.ts b/src/vs/workbench/contrib/customEditor/browser/commands.ts index cf1118961f2..7b384f6c7d1 100644 --- a/src/vs/workbench/contrib/customEditor/browser/commands.ts +++ b/src/vs/workbench/contrib/customEditor/browser/commands.ts @@ -20,6 +20,7 @@ import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, import { getMultiSelectedResources } from 'vs/workbench/contrib/files/browser/files'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { IExplorerService } from 'vs/workbench/contrib/files/common/files'; const viewCategory = nls.localize('viewCategory', "View"); @@ -34,7 +35,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: EditorContextKeys.focus.toNegated(), handler: async (accessor: ServicesAccessor, resource: URI | object) => { const editorService = accessor.get(IEditorService); - const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, accessor.get(IExplorerService)); const targetResource = firstOrDefault(resources); if (!targetResource) { return; diff --git a/src/vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution.ts b/src/vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution.ts index e4a7454fb10..92c391fad15 100644 --- a/src/vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution.ts +++ b/src/vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution.ts @@ -24,6 +24,7 @@ import { distinct } from 'vs/base/common/arrays'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { optional } from 'vs/platform/instantiation/common/instantiation'; +import { IExplorerService } from 'vs/workbench/contrib/files/common/files'; const OPEN_IN_TERMINAL_COMMAND_ID = 'openInTerminal'; @@ -37,7 +38,7 @@ CommandsRegistry.registerCommand({ const integratedTerminalService = accessor.get(IIntegratedTerminalService); const remoteAgentService = accessor.get(IRemoteAgentService); - const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, accessor.get(IExplorerService)); return fileService.resolveAll(resources.map(r => ({ resource: r }))).then(async stats => { const targets = distinct(stats.filter(data => data.success)); // Always use integrated terminal when using a remote @@ -162,4 +163,3 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { command: openConsoleCommand, when: ResourceContextKey.Scheme.isEqualTo(Schemas.vscodeRemote) }); - diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index f09033db891..3dcc31af8e9 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -119,7 +119,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const editorService = accessor.get(IEditorService); const listService = accessor.get(IListService); const fileService = accessor.get(IFileService); - const resources = getMultiSelectedResources(resource, listService, editorService); + const explorerService = accessor.get(IExplorerService); + const resources = getMultiSelectedResources(resource, listService, editorService, explorerService); // Set side input if (resources.length) { @@ -201,7 +202,8 @@ CommandsRegistry.registerCommand({ id: COMPARE_SELECTED_COMMAND_ID, handler: (accessor, resource: URI | object) => { const editorService = accessor.get(IEditorService); - const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService); + const explorerService = accessor.get(IExplorerService); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, explorerService); if (resources.length === 2) { return editorService.openEditor({ @@ -251,7 +253,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }, id: COPY_PATH_COMMAND_ID, handler: async (accessor, resource: URI | object) => { - const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)); await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(ILabelService)); } }); @@ -265,7 +267,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ }, id: COPY_RELATIVE_PATH_COMMAND_ID, handler: async (accessor, resource: URI | object) => { - const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)); await resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(ILabelService)); } }); @@ -488,7 +490,7 @@ CommandsRegistry.registerCommand({ const workspaceEditingService = accessor.get(IWorkspaceEditingService); const contextService = accessor.get(IWorkspaceContextService); const workspace = contextService.getWorkspace(); - const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)).filter(r => + const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)).filter(r => // Need to verify resources are workspaces since multi selection can trigger this command on some non workspace resources workspace.folders.some(f => isEqual(f.uri, r)) ); diff --git a/src/vs/workbench/contrib/files/browser/files.ts b/src/vs/workbench/contrib/files/browser/files.ts index 7746773311f..c501bd0f486 100644 --- a/src/vs/workbench/contrib/files/browser/files.ts +++ b/src/vs/workbench/contrib/files/browser/files.ts @@ -5,7 +5,7 @@ import { URI } from 'vs/base/common/uri'; import { IListService } from 'vs/platform/list/browser/listService'; -import { OpenEditor } from 'vs/workbench/contrib/files/common/files'; +import { OpenEditor, IExplorerService } from 'vs/workbench/contrib/files/common/files'; import { toResource, SideBySideEditor, IEditorIdentifier } from 'vs/workbench/common/editor'; import { List } from 'vs/base/browser/ui/list/listWidget'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -53,19 +53,15 @@ export function getResourceForCommand(resource: URI | object | undefined, listSe return editorService.activeEditor ? toResource(editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }) : undefined; } -export function getMultiSelectedResources(resource: URI | object | undefined, listService: IListService, editorService: IEditorService): Array { +export function getMultiSelectedResources(resource: URI | object | undefined, listService: IListService, editorService: IEditorService, explorerService: IExplorerService): Array { const list = listService.lastFocusedList; if (list?.getHTMLElement() === document.activeElement) { // Explorer if (list instanceof AsyncDataTree) { - const selection = list.getSelection().map((fs: ExplorerItem) => fs.resource); - const focusedElements = list.getFocus(); - const focus = focusedElements.length ? focusedElements[0] : undefined; - const mainUriStr = URI.isUri(resource) ? resource.toString() : focus instanceof ExplorerItem ? focus.resource.toString() : undefined; - // If the resource is passed it has to be a part of the returned context. - // We only respect the selection if it contains the focused element. - if (selection.some(s => URI.isUri(s) && s.toString() === mainUriStr)) { - return selection; + // Explorer + const context = explorerService.getContext(true); + if (context.length) { + return context.map(c => c.resource); } } diff --git a/src/vs/workbench/contrib/files/electron-browser/fileActions.contribution.ts b/src/vs/workbench/contrib/files/electron-browser/fileActions.contribution.ts index 9c63d009f8d..fc370f6d577 100644 --- a/src/vs/workbench/contrib/files/electron-browser/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/electron-browser/fileActions.contribution.ts @@ -24,6 +24,7 @@ import { appendToCommandPalette, appendEditorTitleContextMenuItem } from 'vs/wor import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { ShowOpenedFileInNewWindow } from 'vs/workbench/contrib/files/browser/fileActions'; +import { IExplorerService } from 'vs/workbench/contrib/files/common/files'; const REVEAL_IN_OS_COMMAND_ID = 'revealFileInOS'; const REVEAL_IN_OS_LABEL = isWindows ? nls.localize('revealInWindows', "Reveal in Explorer") : isMacintosh ? nls.localize('revealInMac', "Reveal in Finder") : nls.localize('openContainer', "Open Containing Folder"); @@ -37,7 +38,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_R }, handler: (accessor: ServicesAccessor, resource: URI | object) => { - const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)); + const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)); revealResourcesInOS(resources, accessor.get(IElectronService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService)); } }); diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index 76763901606..c487eddae0b 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -396,7 +396,7 @@ const searchInFolderCommand: ICommandHandler = (accessor, resource?: URI) => { const panelService = accessor.get(IPanelService); const fileService = accessor.get(IFileService); const configurationService = accessor.get(IConfigurationService); - const resources = getMultiSelectedResources(resource, listService, accessor.get(IEditorService)); + const resources = getMultiSelectedResources(resource, listService, accessor.get(IEditorService), accessor.get(IExplorerService)); return openSearchView(viewletService, panelService, configurationService, true).then(searchView => { if (resources && resources.length && searchView) { From 6b0fce926bde0005e612c2c133e79bc7aa1a1106 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Wed, 4 Dec 2019 14:56:54 +0100 Subject: [PATCH 090/637] Add missing properties (fixes microsoft/vscode-remote-release#1961) --- .../schemas/attachContainer.schema.json | 4 ++++ .../configuration-editing/schemas/devContainer.schema.json | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/extensions/configuration-editing/schemas/attachContainer.schema.json b/extensions/configuration-editing/schemas/attachContainer.schema.json index ba0df4b33dc..65f79624518 100644 --- a/extensions/configuration-editing/schemas/attachContainer.schema.json +++ b/extensions/configuration-editing/schemas/attachContainer.schema.json @@ -18,6 +18,10 @@ "type": "integer" } }, + "settings": { + "$ref": "vscode://schemas/settings/machine", + "description": "Machine specific settings that should be copied into the container." + }, "remoteEnv": { "type": "object", "additionalProperties": { diff --git a/extensions/configuration-editing/schemas/devContainer.schema.json b/extensions/configuration-editing/schemas/devContainer.schema.json index 631c58e82b5..710c2a26c60 100644 --- a/extensions/configuration-editing/schemas/devContainer.schema.json +++ b/extensions/configuration-editing/schemas/devContainer.schema.json @@ -84,6 +84,13 @@ "type": "boolean", "description": "Controls whether on Linux the container's user should be updated with the local user's UID and GID. On by default." }, + "mounts": { + "type": "array", + "description": "Mount points to set up when creating the container. See Docker's documentation for the --mount option for the supported syntax.", + "items": { + "type": "string" + } + }, "runArgs": { "type": "array", "description": "The arguments required when starting in the container.", From af60c01ff0db9ee482f1e146ddabddf32fa87bd5 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 4 Dec 2019 15:05:33 +0100 Subject: [PATCH 091/637] Fix #86135 --- .../contrib/markers/browser/markersPanel.ts | 47 +++++++++++++++++-- .../contrib/markers/browser/messages.ts | 1 + 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/markers/browser/markersPanel.ts b/src/vs/workbench/contrib/markers/browser/markersPanel.ts index 321d56b444e..f2159a61fea 100644 --- a/src/vs/workbench/contrib/markers/browser/markersPanel.ts +++ b/src/vs/workbench/contrib/markers/browser/markersPanel.ts @@ -37,7 +37,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { Separator, ActionViewItem, ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { IMenuService, MenuId } from 'vs/platform/actions/common/actions'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { domEvent } from 'vs/base/browser/event'; import { ResourceLabels } from 'vs/workbench/browser/labels'; import { IMarker } from 'vs/platform/markers/common/markers'; @@ -46,6 +46,7 @@ import { MementoObject } from 'vs/workbench/common/memento'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; import { PANEL_BACKGROUND } from 'vs/workbench/common/theme'; +import { KeyCode } from 'vs/base/common/keyCodes'; function createResourceMarkersIterator(resourceMarkers: ResourceMarkers): Iterator> { const markersIt = Iterator.fromArray(resourceMarkers.markers); @@ -520,10 +521,14 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { if (filtered === 0) { this.messageBoxContainer.style.display = 'block'; this.messageBoxContainer.setAttribute('tabIndex', '0'); - if (total > 0) { - this.renderFilteredByFilterMessage(this.messageBoxContainer); + if (this.filterAction.activeFile) { + this.renderFilterMessageForActiveFile(this.messageBoxContainer); } else { - this.renderNoProblemsMessage(this.messageBoxContainer); + if (total > 0) { + this.renderFilteredByFilterMessage(this.messageBoxContainer); + } else { + this.renderNoProblemsMessage(this.messageBoxContainer); + } } } else { this.messageBoxContainer.style.display = 'none'; @@ -536,18 +541,52 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { } } + private renderFilterMessageForActiveFile(container: HTMLElement): void { + if (this.currentActiveResource && this.markersWorkbenchService.markersModel.getResourceMarkers(this.currentActiveResource)) { + this.renderFilteredByFilterMessage(container); + } else { + this.renderNoProblemsMessageForActiveFile(container); + } + } + private renderFilteredByFilterMessage(container: HTMLElement) { const span1 = dom.append(container, dom.$('span')); span1.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS; + const link = dom.append(container, dom.$('a.messageAction')); + link.textContent = localize('clearFilter', "Clear Filters"); + link.setAttribute('tabIndex', '0'); + const span2 = dom.append(container, dom.$('span')); + span2.textContent = '.'; + dom.addStandardDisposableListener(link, dom.EventType.CLICK, () => this.clearFilters()); + dom.addStandardDisposableListener(link, dom.EventType.KEY_DOWN, (e: IKeyboardEvent) => { + if (e.equals(KeyCode.Enter) || e.equals(KeyCode.Space)) { + this.clearFilters(); + e.stopPropagation(); + } + }); this.ariaLabelElement.setAttribute('aria-label', Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS); } + private renderNoProblemsMessageForActiveFile(container: HTMLElement) { + const span = dom.append(container, dom.$('span')); + span.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT; + this.ariaLabelElement.setAttribute('aria-label', Messages.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT); + } + private renderNoProblemsMessage(container: HTMLElement) { const span = dom.append(container, dom.$('span')); span.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_BUILT; this.ariaLabelElement.setAttribute('aria-label', Messages.MARKERS_PANEL_NO_PROBLEMS_BUILT); } + private clearFilters(): void { + this.filterAction.filterText = ''; + this.filterAction.excludedFiles = false; + this.filterAction.showErrors = true; + this.filterAction.showWarnings = true; + this.filterAction.showInfos = true; + } + private autoReveal(focus: boolean = false): void { // No need to auto reveal if active file filter is on if (this.filterAction.activeFile) { diff --git a/src/vs/workbench/contrib/markers/browser/messages.ts b/src/vs/workbench/contrib/markers/browser/messages.ts index 438ebcd5588..7275dc27c43 100644 --- a/src/vs/workbench/contrib/markers/browser/messages.ts +++ b/src/vs/workbench/contrib/markers/browser/messages.ts @@ -21,6 +21,7 @@ export default class Messages { public static MARKERS_PANEL_TITLE_PROBLEMS: string = nls.localize('markers.panel.title.problems', "Problems"); public static MARKERS_PANEL_NO_PROBLEMS_BUILT: string = nls.localize('markers.panel.no.problems.build', "No problems have been detected in the workspace so far."); + public static MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT: string = nls.localize('markers.panel.no.problems.activeFile.build', "No problems have been detected in the current file so far."); public static MARKERS_PANEL_NO_PROBLEMS_FILTERS: string = nls.localize('markers.panel.no.problems.filters', "No results found with provided filter criteria."); public static MARKERS_PANEL_ACTION_TOOLTIP_MORE_FILTERS: string = nls.localize('markers.panel.action.moreFilters', "More Filters..."); From d75b73b1c9e7efa35cd306f950a580cd84cacbc2 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 15:05:50 +0100 Subject: [PATCH 092/637] User canceled a download. In case there were multiple files selected we should cancel the remainder of the prompts fixes #86100 --- src/vs/workbench/contrib/files/browser/fileActions.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 8fc60ca17e9..43beeb606fd 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -980,7 +980,12 @@ const downloadFileHandler = (accessor: ServicesAccessor) => { const explorerService = accessor.get(IExplorerService); const stats = explorerService.getContext(true); + let canceled = false; stats.forEach(async s => { + if (canceled) { + return; + } + if (isWeb) { if (!s.isDirectory) { triggerDownload(asDomUri(s.resource), s.name); @@ -999,6 +1004,9 @@ const downloadFileHandler = (accessor: ServicesAccessor) => { }); if (destination) { await textFileService.copy(s.resource, destination); + } else { + // User canceled a download. In case there were multiple files selected we should cancel the remainder of the prompts #86100 + canceled = true; } } }); From c03d5ed006b241fcd77ee78696a0fbbcc65473d4 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 4 Dec 2019 15:16:05 +0100 Subject: [PATCH 093/637] Add 'Documentation' to ? hover in remote explorer --- src/vs/workbench/contrib/remote/browser/remote.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 030b5bf6370..70ab4f4fc52 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -236,7 +236,7 @@ class IssueReporterItem extends HelpItemBase { class HelpAction extends Action { static readonly ID = 'remote.explorer.help'; - static readonly LABEL = nls.localize('remote.explorer.help', "Help and Feedback"); + static readonly LABEL = nls.localize('remote.explorer.help', "Help, Documentation, and Feedback"); private helpModel: HelpModel; constructor(id: string, From ef121d2d876e98114bf92062a779f3773dd916fc Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Wed, 4 Dec 2019 14:43:17 +0100 Subject: [PATCH 094/637] Remove incomplete checks (fixes #85844) --- src/vs/base/browser/ui/iconLabel/iconLabel.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index 425f657432c..30b4246b9cf 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -163,18 +163,11 @@ export class IconLabel extends Disposable { class Label { - private label: string | string[] | undefined = undefined; private singleLabel: HTMLElement | undefined = undefined; constructor(private container: HTMLElement) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { - if (this.label === label) { - return; - } - - this.label = label; - if (typeof label === 'string') { if (!this.singleLabel) { this.container.innerHTML = ''; @@ -224,18 +217,11 @@ function splitMatches(labels: string[], separator: string, matches: IMatch[] | u class LabelWithHighlights { - private label: string | string[] | undefined = undefined; private singleLabel: HighlightedLabel | undefined = undefined; constructor(private container: HTMLElement, private supportCodicons: boolean) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { - if (this.label === label) { - return; - } - - this.label = label; - if (typeof label === 'string') { if (!this.singleLabel) { this.container.innerHTML = ''; From 669d0ab44e4110de5517d8c87b0b306c89bfba3a Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 4 Dec 2019 15:12:42 +0100 Subject: [PATCH 095/637] [json] make result limit configurable. Fixes #84259 --- extensions/json-language-features/client/src/jsonMain.ts | 4 +++- extensions/json-language-features/package.json | 5 +++++ extensions/json-language-features/package.nls.json | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/json-language-features/client/src/jsonMain.ts b/extensions/json-language-features/client/src/jsonMain.ts index 23c42f795c9..cb318b46518 100644 --- a/extensions/json-language-features/client/src/jsonMain.ts +++ b/extensions/json-language-features/client/src/jsonMain.ts @@ -351,6 +351,8 @@ function getSchemaAssociation(_context: ExtensionContext): ISchemaAssociations { function getSettings(): Settings { let httpSettings = workspace.getConfiguration('http'); + let resultLimit: number = Math.trunc(Math.max(0, Number(workspace.getConfiguration().get('json.maxItemsComputed')))) || 5000; + let settings: Settings = { http: { proxy: httpSettings.get('proxy'), @@ -358,7 +360,7 @@ function getSettings(): Settings { }, json: { schemas: [], - resultLimit: 5000 + resultLimit } }; let schemaSettingsById: { [schemaId: string]: JSONSchemaSettings } = Object.create(null); diff --git a/extensions/json-language-features/package.json b/extensions/json-language-features/package.json index 69d898b9e7f..09f7c6c1643 100644 --- a/extensions/json-language-features/package.json +++ b/extensions/json-language-features/package.json @@ -90,6 +90,11 @@ "default": true, "description": "%json.colorDecorators.enable.desc%", "deprecationMessage": "%json.colorDecorators.enable.deprecationMessage%" + }, + "json.maxItemsComputed": { + "type": "number", + "default": 5000, + "description": "%json.maxItemsComputed.desc%" } } }, diff --git a/extensions/json-language-features/package.nls.json b/extensions/json-language-features/package.nls.json index c61e7b70e8f..5d132ccd776 100644 --- a/extensions/json-language-features/package.nls.json +++ b/extensions/json-language-features/package.nls.json @@ -11,5 +11,6 @@ "json.colorDecorators.enable.desc": "Enables or disables color decorators", "json.colorDecorators.enable.deprecationMessage": "The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.", "json.schemaResolutionErrorMessage": "Unable to resolve schema.", - "json.clickToRetry": "Click to retry." + "json.clickToRetry": "Click to retry.", + "json.maxItemsComputed.desc": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)." } From 235ceb4d387bdd32ff3830d0f5aeb225ae88c6d8 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 4 Dec 2019 15:40:58 +0100 Subject: [PATCH 096/637] [json] update service --- extensions/json-language-features/server/package.json | 2 +- extensions/json-language-features/server/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/json-language-features/server/package.json b/extensions/json-language-features/server/package.json index b4992717f5b..64a9c5f5eba 100644 --- a/extensions/json-language-features/server/package.json +++ b/extensions/json-language-features/server/package.json @@ -14,7 +14,7 @@ "dependencies": { "jsonc-parser": "^2.2.0", "request-light": "^0.2.5", - "vscode-json-languageservice": "^3.4.8", + "vscode-json-languageservice": "^3.4.9", "vscode-languageserver": "^6.0.0-next.3", "vscode-uri": "^2.1.1" }, diff --git a/extensions/json-language-features/server/yarn.lock b/extensions/json-language-features/server/yarn.lock index b5fcaf44bab..7ebc93341c6 100644 --- a/extensions/json-language-features/server/yarn.lock +++ b/extensions/json-language-features/server/yarn.lock @@ -80,10 +80,10 @@ request-light@^0.2.5: https-proxy-agent "^2.2.3" vscode-nls "^4.1.1" -vscode-json-languageservice@^3.4.8: - version "3.4.8" - resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.4.8.tgz#2fc14e0a2603ed704ab57e29f3bcce75106be2bd" - integrity sha512-8h3VjUU4r37LVleIV7YGYs6MlnwHs4qR002cJsL3Z/ebrKzgab1OkwzGocAAJY21rnLhVy4KjnIy7oN1XGPlqA== +vscode-json-languageservice@^3.4.9: + version "3.4.9" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.4.9.tgz#7ce485bb0f9a07b4d879c988baac9be2222909ad" + integrity sha512-4VCpZ9ooea/Zc/MTnj1ccc9C7rqcoinKVQLhLoi6jw6yueSf4y4tg/YIUiPPVMlEAG7ZCPS+NVmqxisQ+mOsSw== dependencies: jsonc-parser "^2.2.0" vscode-languageserver-textdocument "^1.0.0-next.4" From efd633a2fb1a954eeb4469a38c8e69610ad3e9a1 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 4 Dec 2019 15:55:48 +0100 Subject: [PATCH 097/637] Fix #86062 --- .../userDataSync/common/userDataSyncUtil.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.ts b/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.ts index 237e55c17e4..947f5521b8b 100644 --- a/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.ts +++ b/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.ts @@ -10,6 +10,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { FormattingOptions } from 'vs/base/common/jsonFormatter'; import { URI } from 'vs/base/common/uri'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; +import { ITextResourcePropertiesService, ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; class UserDataSyncUtilService implements IUserDataSyncUtilService { @@ -18,6 +19,8 @@ class UserDataSyncUtilService implements IUserDataSyncUtilService { constructor( @IKeybindingService private readonly keybindingsService: IKeybindingService, @ITextModelService private readonly textModelService: ITextModelService, + @ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService, + @ITextResourceConfigurationService private readonly textResourceConfigurationService: ITextResourceConfigurationService, ) { } public async resolveUserBindings(userBindings: string[]): Promise> { @@ -29,11 +32,19 @@ class UserDataSyncUtilService implements IUserDataSyncUtilService { } async resolveFormattingOptions(resource: URI): Promise { - const modelReference = await this.textModelService.createModelReference(resource); - const { insertSpaces, tabSize } = modelReference.object.textEditorModel.getOptions(); - const eol = modelReference.object.textEditorModel.getEOL(); - modelReference.dispose(); - return { eol, insertSpaces, tabSize }; + try { + const modelReference = await this.textModelService.createModelReference(resource); + const { insertSpaces, tabSize } = modelReference.object.textEditorModel.getOptions(); + const eol = modelReference.object.textEditorModel.getEOL(); + modelReference.dispose(); + return { eol, insertSpaces, tabSize }; + } catch (e) { + } + return { + eol: this.textResourcePropertiesService.getEOL(resource), + insertSpaces: this.textResourceConfigurationService.getValue(resource, 'editor.insertSpaces'), + tabSize: this.textResourceConfigurationService.getValue(resource, 'editor.tabSize') + }; } } From 1ce943831d1c520ac974367f19e86870c509e658 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 4 Dec 2019 15:57:48 +0100 Subject: [PATCH 098/637] [json] mention setting to change limit --- .../json-language-features/client/src/jsonMain.ts | 10 ++++++++++ extensions/json-language-features/server/README.md | 11 +++++++++++ .../server/src/jsonServerMain.ts | 6 +++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/extensions/json-language-features/client/src/jsonMain.ts b/extensions/json-language-features/client/src/jsonMain.ts index cb318b46518..32c0d422643 100644 --- a/extensions/json-language-features/client/src/jsonMain.ts +++ b/extensions/json-language-features/client/src/jsonMain.ts @@ -44,6 +44,10 @@ namespace SchemaAssociationNotification { export const type: NotificationType = new NotificationType('json/schemaAssociations'); } +namespace ResultLimitReachedNotification { + export const type: NotificationType = new NotificationType('json/resultLimitReached'); +} + interface IPackageInfo { name: string; version: string; @@ -270,6 +274,12 @@ export function activate(context: ExtensionContext) { updateFormatterRegistration(); toDispose.push({ dispose: () => rangeFormatting && rangeFormatting.dispose() }); toDispose.push(workspace.onDidChangeConfiguration(e => e.affectsConfiguration('html.format.enable') && updateFormatterRegistration())); + + + client.onNotification(ResultLimitReachedNotification.type, message => { + window.showInformationMessage(`${message}\nUse setting 'json.maxItemsComputed' to configure the limit.`); + }); + }); let languageConfiguration: LanguageConfiguration = { diff --git a/extensions/json-language-features/server/README.md b/extensions/json-language-features/server/README.md index 71356e3c441..66fd8437d6a 100644 --- a/extensions/json-language-features/server/README.md +++ b/extensions/json-language-features/server/README.md @@ -63,6 +63,7 @@ The server supports the following settings: - `fileMatch`: an array of file names or paths (separated by `/`). `*` can be used as a wildcard. - `url`: The URL of the schema, optional when also a schema is provided. - `schema`: The schema content. + - `resultLimit`: The max number foldig ranges and otline symbols to be computed (for performance reasons) ```json { @@ -153,6 +154,16 @@ Notification: - method: 'json/schemaContent' - params: `string` the URL of the schema that has changed. +### Item Limit + +If the setting `resultLimit` is set, the JSON language server will limit the number of folding ranges and document symbols computed. +When the limit is reached, a notification `json/resultLimitReached` is sent that can be shown that camn be shown to the user. + +Notification: +- method: 'json/resultLimitReached' +- params: a human readable string to show to the user. + + ## Try The JSON language server is shipped with [Visual Studio Code](https://code.visualstudio.com/) as part of the built-in VSCode extension `json-language-features`. The server is started when the first JSON file is opened. The [VSCode JSON documentation](https://code.visualstudio.com/docs/languages/json) for detailed information on the user experience and has more information on how to configure the language support. diff --git a/extensions/json-language-features/server/src/jsonServerMain.ts b/extensions/json-language-features/server/src/jsonServerMain.ts index 975f27b481d..4b058d12350 100644 --- a/extensions/json-language-features/server/src/jsonServerMain.ts +++ b/extensions/json-language-features/server/src/jsonServerMain.ts @@ -35,6 +35,10 @@ namespace SchemaContentChangeNotification { export const type: NotificationType = new NotificationType('json/schemaContent'); } +namespace ResultLimitReachedNotification { + export const type: NotificationType = new NotificationType('json/resultLimitReached'); +} + namespace ForceValidateRequest { export const type: RequestType = new RequestType('json/validate'); } @@ -211,7 +215,7 @@ namespace LimitExceededWarnings { } else { warning = { features: { [name]: name } }; warning.timeout = setTimeout(() => { - connection.window.showInformationMessage(`${posix.basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`); + connection.sendNotification(ResultLimitReachedNotification.type, `${posix.basename(uri)}: For performance reasons, ${Object.keys(warning.features).join(' and ')} have been limited to ${resultLimit} items.`); warning.timeout = undefined; }, 2000); pendingWarnings[uri] = warning; From 0f31ed29482b4032ea4e81ad4b6b4afd740ec692 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 16:09:43 +0100 Subject: [PATCH 099/637] fixes #85880 --- src/vs/workbench/contrib/files/browser/views/explorerView.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index dd98498ed43..022d76e86ad 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -297,6 +297,10 @@ export class ExplorerView extends ViewletPane { for (const stat of this.tree.getSelection()) { const controller = this.renderer.getCompressedNavigationController(stat); + if (controller && focusedStat && focusedStat !== stat && controller === this.compressedNavigationController) { + // This stat is compact with the focused one, it should not be part of the selection + continue; + } if (controller) { selectedStats.push(...controller.items); From 073bb36f406a981d8b2489d88fcde2446373851d Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 16:25:36 +0100 Subject: [PATCH 100/637] fixes #83525 --- .../contrib/debug/browser/debugConfigurationManager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index f67c70db9d8..ba79a6e94b6 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -496,10 +496,13 @@ abstract class AbstractLaunch { getConfigurationNames(includeCompounds = true): string[] { const config = this.getConfig(); - if (!config || !config.configurations || !Array.isArray(config.configurations)) { + if (!config || (!Array.isArray(config.configurations) && !Array.isArray(config.compounds))) { return []; } else { - const names = config.configurations.filter(cfg => cfg && typeof cfg.name === 'string').map(cfg => cfg.name); + const names: string[] = []; + if (config.configurations) { + names.push(...config.configurations.filter(cfg => cfg && typeof cfg.name === 'string').map(cfg => cfg.name)); + } if (includeCompounds && config.compounds) { if (config.compounds) { names.push(...config.compounds.filter(compound => typeof compound.name === 'string' && compound.configurations && compound.configurations.length) From 6d2eeee28aba86c329ac659acf8bfe2ab0390ab9 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 16:54:34 +0100 Subject: [PATCH 101/637] fixes #85938 --- src/vs/base/browser/ui/tree/abstractTree.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 5f40e3d8987..3699ee509d0 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -14,7 +14,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree'; import { ISpliceable } from 'vs/base/common/sequence'; import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd'; -import { range, equals, distinctES6, fromSet } from 'vs/base/common/arrays'; +import { range, equals, distinctES6, fromSet, distinct } from 'vs/base/common/arrays'; import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView'; import { domEvent } from 'vs/base/browser/event'; import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters'; @@ -997,7 +997,7 @@ class Trait { } private _set(nodes: ITreeNode[], silent: boolean, browserEvent?: UIEvent): void { - this.nodes = [...nodes]; + this.nodes = nodes.length > 1 && this.identityProvider ? distinct(nodes, node => this.identityProvider!.getId(node.element).toString()) : [...nodes]; this.elements = undefined; this._nodeSet = undefined; From a3846fb58d3ecb18df155b18624c9280c542fb33 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 17:07:21 +0100 Subject: [PATCH 102/637] explorer: not needed workaround --- src/vs/workbench/contrib/files/browser/views/explorerView.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 022d76e86ad..f09b093513a 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -297,11 +297,6 @@ export class ExplorerView extends ViewletPane { for (const stat of this.tree.getSelection()) { const controller = this.renderer.getCompressedNavigationController(stat); - if (controller && focusedStat && focusedStat !== stat && controller === this.compressedNavigationController) { - // This stat is compact with the focused one, it should not be part of the selection - continue; - } - if (controller) { selectedStats.push(...controller.items); } else { From 957b895664172a58b6728ea62a0594b622f60347 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Wed, 4 Dec 2019 08:28:13 -0800 Subject: [PATCH 103/637] Fix #86050 --- src/vs/workbench/browser/media/style.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/browser/media/style.css b/src/vs/workbench/browser/media/style.css index f6c7bd7b620..bb6b38de289 100644 --- a/src/vs/workbench/browser/media/style.css +++ b/src/vs/workbench/browser/media/style.css @@ -180,6 +180,9 @@ body.web { .monaco-workbench select { -webkit-appearance: none; -moz-appearance: none; + /* Hides inner border from FF */ + border-block: none; + border-inline: none; } .monaco-workbench .select-container { From 429c2a58dcf73ba22052b3a34d43a746862cfe24 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 17:29:10 +0100 Subject: [PATCH 104/637] Revert "Remove incomplete checks (fixes #85844)" This reverts commit ef121d2d876e98114bf92062a779f3773dd916fc. --- src/vs/base/browser/ui/iconLabel/iconLabel.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index 30b4246b9cf..425f657432c 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -163,11 +163,18 @@ export class IconLabel extends Disposable { class Label { + private label: string | string[] | undefined = undefined; private singleLabel: HTMLElement | undefined = undefined; constructor(private container: HTMLElement) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { + if (this.label === label) { + return; + } + + this.label = label; + if (typeof label === 'string') { if (!this.singleLabel) { this.container.innerHTML = ''; @@ -217,11 +224,18 @@ function splitMatches(labels: string[], separator: string, matches: IMatch[] | u class LabelWithHighlights { + private label: string | string[] | undefined = undefined; private singleLabel: HighlightedLabel | undefined = undefined; constructor(private container: HTMLElement, private supportCodicons: boolean) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { + if (this.label === label) { + return; + } + + this.label = label; + if (typeof label === 'string') { if (!this.singleLabel) { this.container.innerHTML = ''; From 85291a67f3cf9d89b602924c565a3e07a8aeff38 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 17:35:18 +0100 Subject: [PATCH 105/637] fixes #85844 --- src/vs/base/browser/ui/iconLabel/iconLabel.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/base/browser/ui/iconLabel/iconLabel.ts b/src/vs/base/browser/ui/iconLabel/iconLabel.ts index 425f657432c..254aed56902 100644 --- a/src/vs/base/browser/ui/iconLabel/iconLabel.ts +++ b/src/vs/base/browser/ui/iconLabel/iconLabel.ts @@ -9,6 +9,7 @@ import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlighte import { IMatch } from 'vs/base/common/filters'; import { Disposable } from 'vs/base/common/lifecycle'; import { Range } from 'vs/base/common/range'; +import { equals } from 'vs/base/common/objects'; export interface IIconLabelCreationOptions { supportHighlights?: boolean; @@ -165,15 +166,17 @@ class Label { private label: string | string[] | undefined = undefined; private singleLabel: HTMLElement | undefined = undefined; + private options: IIconLabelValueOptions | undefined; constructor(private container: HTMLElement) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { - if (this.label === label) { + if (this.label === label && equals(this.options, options)) { return; } this.label = label; + this.options = options; if (typeof label === 'string') { if (!this.singleLabel) { @@ -226,15 +229,17 @@ class LabelWithHighlights { private label: string | string[] | undefined = undefined; private singleLabel: HighlightedLabel | undefined = undefined; + private options: IIconLabelValueOptions | undefined; constructor(private container: HTMLElement, private supportCodicons: boolean) { } setLabel(label: string | string[], options?: IIconLabelValueOptions): void { - if (this.label === label) { + if (this.label === label && equals(this.options, options)) { return; } this.label = label; + this.options = options; if (typeof label === 'string') { if (!this.singleLabel) { From 721f2274694681dadd860dc2a6e5c986f869b6df Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 18:02:42 +0100 Subject: [PATCH 106/637] fixes #86034 --- .../contrib/debug/browser/debugViewlet.ts | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts index 9a195bec864..d84b2cff137 100644 --- a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts @@ -15,7 +15,7 @@ import { StartDebugActionViewItem, FocusSessionActionViewItem } from 'vs/workben import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IProgressService } from 'vs/platform/progress/common/progress'; -import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { IThemeService } from 'vs/platform/theme/common/themeService'; @@ -119,22 +119,27 @@ export class DebugViewlet extends ViewContainerViewlet { if (CONTEXT_DEBUG_UX.getValue(this.contextKeyService) === 'simple') { return []; } - if (this.showInitialDebugActions) { - return [this.startAction, this.configureAction, this.toggleReplAction]; + if (!this.showInitialDebugActions) { + + if (!this.debugToolBarMenu) { + this.debugToolBarMenu = this.menuService.createMenu(MenuId.DebugToolBar, this.contextKeyService); + this._register(this.debugToolBarMenu); + } + + const { actions, disposable } = DebugToolBar.getActions(this.debugToolBarMenu, this.debugService, this.instantiationService); + if (this.disposeOnTitleUpdate) { + dispose(this.disposeOnTitleUpdate); + } + this.disposeOnTitleUpdate = disposable; + + return actions; } - if (!this.debugToolBarMenu) { - this.debugToolBarMenu = this.menuService.createMenu(MenuId.DebugToolBar, this.contextKeyService); - this._register(this.debugToolBarMenu); + if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) { + return [this.toggleReplAction]; } - const { actions, disposable } = DebugToolBar.getActions(this.debugToolBarMenu, this.debugService, this.instantiationService); - if (this.disposeOnTitleUpdate) { - dispose(this.disposeOnTitleUpdate); - } - this.disposeOnTitleUpdate = disposable; - - return actions; + return [this.startAction, this.configureAction, this.toggleReplAction]; } get showInitialDebugActions(): boolean { From 1a32116c63ecda2d72333bd8fc7de0e4dbcb0d6a Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 4 Dec 2019 09:04:39 -0800 Subject: [PATCH 107/637] Make rendererType use markdown enum descriptions Fixes #86182 --- .../workbench/contrib/terminal/browser/terminal.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index 661e638a8e6..fa6e554525e 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -215,7 +215,7 @@ configurationRegistry.registerConfiguration({ 'terminal.integrated.rendererType': { type: 'string', enum: ['auto', 'canvas', 'dom', 'experimentalWebgl'], - enumDescriptions: [ + markdownEnumDescriptions: [ nls.localize('terminal.integrated.rendererType.auto', "Let VS Code guess which renderer to use."), nls.localize('terminal.integrated.rendererType.canvas', "Use the standard GPU/canvas-based renderer."), nls.localize('terminal.integrated.rendererType.dom', "Use the fallback DOM-based renderer."), From f3e74022beb260aef486f5c6cc7026a8de20354d Mon Sep 17 00:00:00 2001 From: Robert Jin Date: Wed, 4 Dec 2019 16:59:17 +0000 Subject: [PATCH 108/637] fix #85937: prevent duplicate selections --- src/vs/base/browser/ui/tree/abstractTree.ts | 2 +- src/vs/base/browser/ui/tree/asyncDataTree.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 3699ee509d0..c7580993acb 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -997,7 +997,7 @@ class Trait { } private _set(nodes: ITreeNode[], silent: boolean, browserEvent?: UIEvent): void { - this.nodes = nodes.length > 1 && this.identityProvider ? distinct(nodes, node => this.identityProvider!.getId(node.element).toString()) : [...nodes]; + this.nodes = [...nodes]; this.elements = undefined; this._nodeSet = undefined; diff --git a/src/vs/base/browser/ui/tree/asyncDataTree.ts b/src/vs/base/browser/ui/tree/asyncDataTree.ts index c21a3a80964..91a1f9ddf9d 100644 --- a/src/vs/base/browser/ui/tree/asyncDataTree.ts +++ b/src/vs/base/browser/ui/tree/asyncDataTree.ts @@ -1189,14 +1189,16 @@ export class CompressibleAsyncDataTree extends As if (compressedNode) { for (let i = 0; i < compressedNode.elements.length; i++) { const id = getId(compressedNode.elements[i].element as T); + const element = compressedNode.elements[compressedNode.elements.length - 1].element as T; - if (oldSelection.has(id)) { - selection.push(compressedNode.elements[compressedNode.elements.length - 1].element as T); + // github.com/microsoft/vscode/issues/85938 + if (oldSelection.has(id) && selection.indexOf(element) === -1) { + selection.push(element); didChangeSelection = true; } - if (oldFocus.has(id)) { - focus.push(compressedNode.elements[compressedNode.elements.length - 1].element as T); + if (oldFocus.has(id) && focus.indexOf(element) === -1) { + focus.push(element); didChangeFocus = true; } } From f42ab17ac2a82172b17db5a4064888ee9304da73 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 4 Dec 2019 09:12:42 -0800 Subject: [PATCH 109/637] Use markdown in terminal contributions correctly Fixes #86287 --- .../contrib/terminal/browser/terminal.contribution.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index fa6e554525e..6fec1c4ede7 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -170,7 +170,7 @@ configurationRegistry.registerConfiguration({ default: DEFAULT_LINE_HEIGHT }, 'terminal.integrated.minimumContrastRatio': { - description: nls.localize('terminal.integrated.minimumContrastRatio', "When set the foreground color of each cell will change to try meet the contrast ratio specified. Example values:\n\n- 1: The default, do nothing.\n- 4.5: Minimum for WCAG AA compliance.\n- 7: Minimum for WCAG AAA compliance.\n- 21: White on black or black on white."), + markdownDescription: nls.localize('terminal.integrated.minimumContrastRatio', "When set the foreground color of each cell will change to try meet the contrast ratio specified. Example values:\n\n- 1: The default, do nothing.\n- 4.5: Minimum for WCAG AA compliance.\n- 7: Minimum for WCAG AAA compliance.\n- 21: White on black or black on white."), type: 'number', default: 1 }, @@ -205,7 +205,7 @@ configurationRegistry.registerConfiguration({ markdownDescription: nls.localize('terminal.integrated.detectLocale', "Controls whether to detect and set the `$LANG` environment variable to a UTF-8 compliant option since VS Code's terminal only supports UTF-8 encoded data coming from the shell."), type: 'string', enum: ['auto', 'off', 'on'], - enumDescriptions: [ + markdownEnumDescriptions: [ nls.localize('terminal.integrated.detectLocale.auto', "Set the `$LANG` environment variable if the existing variable does not exist or it does not end in `'.UTF-8'`."), nls.localize('terminal.integrated.detectLocale.off', "Do not set the `$LANG` environment variable."), nls.localize('terminal.integrated.detectLocale.on', "Always set the `$LANG` environment variable.") @@ -252,7 +252,7 @@ configurationRegistry.registerConfiguration({ default: false }, 'terminal.integrated.commandsToSkipShell': { - description: nls.localize('terminal.integrated.commandsToSkipShell', "A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open.\nDefault Skipped Commands:\n\n{0}", DEFAULT_COMMANDS_TO_SKIP_SHELL.sort().map(command => `- ${command}`).join('\n')), + markdownDescription: nls.localize('terminal.integrated.commandsToSkipShell', "A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open.\nDefault Skipped Commands:\n\n{0}", DEFAULT_COMMANDS_TO_SKIP_SHELL.sort().map(command => `- ${command}`).join('\n')), type: 'array', items: { type: 'string' @@ -260,7 +260,7 @@ configurationRegistry.registerConfiguration({ default: [] }, 'terminal.integrated.allowChords': { - markdownDescription: nls.localize('terminal.integrated.allowChords', "Whether or not to allow chord keybindings in the terminal. Note that when this is true and the keystroke results in a chord it will bypass `terminal.integrated.commandsToSkipShell`, setting this to false is particularly useful when you want ctrl+k to go to your shell (not VS Code)."), + markdownDescription: nls.localize('terminal.integrated.allowChords', "Whether or not to allow chord keybindings in the terminal. Note that when this is true and the keystroke results in a chord it will bypass `#terminal.integrated.commandsToSkipShell#`, setting this to false is particularly useful when you want ctrl+k to go to your shell (not VS Code)."), type: 'boolean', default: true }, From a56829c2258accf1767c9a1137fa2a5cd545fedf Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 4 Dec 2019 18:13:44 +0100 Subject: [PATCH 110/637] remove unused import --- src/vs/base/browser/ui/tree/abstractTree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index c7580993acb..5f40e3d8987 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -14,7 +14,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree'; import { ISpliceable } from 'vs/base/common/sequence'; import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd'; -import { range, equals, distinctES6, fromSet, distinct } from 'vs/base/common/arrays'; +import { range, equals, distinctES6, fromSet } from 'vs/base/common/arrays'; import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView'; import { domEvent } from 'vs/base/browser/event'; import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters'; From 0fd472271d9c0cc8f923319418eaf7c559f9bee0 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 10:02:23 -0800 Subject: [PATCH 111/637] Make all search-result editors have no line numbers And make that configurable --- extensions/search-result/package.json | 5 +++++ src/vs/workbench/contrib/search/browser/searchEditor.ts | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/search-result/package.json b/extensions/search-result/package.json index 0a2af5e0a9d..5e7482b6033 100644 --- a/extensions/search-result/package.json +++ b/extensions/search-result/package.json @@ -19,6 +19,11 @@ "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:search-result ./tsconfig.json" }, "contributes": { + "configurationDefaults": { + "[search-result]": { + "editor.lineNumbers": "off" + } + }, "commands": [ { "command": "searchResult.rerunSearch", diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 46792e7b680..b2bc36fbd06 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -291,8 +291,6 @@ export const createEditorFromSearchResult = const editor = await editorService.openEditor(possible); const control = editor?.getControl()!; - control.updateOptions({ lineNumbers: 'off' }); - const model = control.getModel() as ITextModel; model.deltaDecorations([], results.matchRanges.map(range => ({ range, options: { className: 'searchEditorFindMatch', stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } }))); From 8ea7ce058e483c2bed0a6aac2a358368a3cf1b59 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Wed, 4 Dec 2019 10:19:04 -0800 Subject: [PATCH 112/637] Update high contrast scm diff decoration colors, fixes #86197 --- .../contrib/scm/browser/dirtydiffDecorator.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts index a3cac4fbe01..4da76571bbd 100644 --- a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts @@ -809,37 +809,37 @@ export class DirtyDiffController extends Disposable implements IEditorContributi export const editorGutterModifiedBackground = registerColor('editorGutter.modifiedBackground', { dark: new Color(new RGBA(12, 125, 157)), light: new Color(new RGBA(102, 175, 224)), - hc: new Color(new RGBA(0, 73, 122)) + hc: new Color(new RGBA(0, 155, 249)) }, nls.localize('editorGutterModifiedBackground', "Editor gutter background color for lines that are modified.")); export const editorGutterAddedBackground = registerColor('editorGutter.addedBackground', { dark: new Color(new RGBA(88, 124, 12)), light: new Color(new RGBA(129, 184, 139)), - hc: new Color(new RGBA(27, 82, 37)) + hc: new Color(new RGBA(51, 171, 78)) }, nls.localize('editorGutterAddedBackground', "Editor gutter background color for lines that are added.")); export const editorGutterDeletedBackground = registerColor('editorGutter.deletedBackground', { dark: new Color(new RGBA(148, 21, 27)), light: new Color(new RGBA(202, 75, 81)), - hc: new Color(new RGBA(141, 14, 20)) + hc: new Color(new RGBA(252, 93, 109)) }, nls.localize('editorGutterDeletedBackground', "Editor gutter background color for lines that are deleted.")); export const minimapGutterModifiedBackground = registerColor('minimapGutter.modifiedBackground', { dark: new Color(new RGBA(12, 125, 157)), light: new Color(new RGBA(102, 175, 224)), - hc: new Color(new RGBA(0, 73, 122)) + hc: new Color(new RGBA(0, 155, 249)) }, nls.localize('minimapGutterModifiedBackground', "Minimap gutter background color for lines that are modified.")); export const minimapGutterAddedBackground = registerColor('minimapGutter.addedBackground', { dark: new Color(new RGBA(88, 124, 12)), light: new Color(new RGBA(129, 184, 139)), - hc: new Color(new RGBA(27, 82, 37)) + hc: new Color(new RGBA(51, 171, 78)) }, nls.localize('minimapGutterAddedBackground', "Minimap gutter background color for lines that are added.")); export const minimapGutterDeletedBackground = registerColor('minimapGutter.deletedBackground', { dark: new Color(new RGBA(148, 21, 27)), light: new Color(new RGBA(202, 75, 81)), - hc: new Color(new RGBA(141, 14, 20)) + hc: new Color(new RGBA(252, 93, 109)) }, nls.localize('minimapGutterDeletedBackground', "Minimap gutter background color for lines that are deleted.")); const overviewRulerDefault = new Color(new RGBA(0, 122, 204, 0.6)); From ed4d8133763c29fb41f9a6c04ed4e73d2b129db2 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 10:21:07 -0800 Subject: [PATCH 113/637] Don't create duplicate identical search-editors. Fixes #86118 --- .../contrib/search/browser/searchEditor.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index b2bc36fbd06..725ab6f93d0 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -12,7 +12,7 @@ import { URI } from 'vs/base/common/uri'; import { ITextQuery, IPatternInfo, ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search'; import * as network from 'vs/base/common/network'; import { Range } from 'vs/editor/common/core/range'; -import { ITextModel, TrackedRangeStickiness } from 'vs/editor/common/model'; +import { ITextModel, TrackedRangeStickiness, EndOfLinePreference } from 'vs/editor/common/model'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ITextQueryBuilderOptions, QueryBuilder } from 'vs/workbench/contrib/search/common/queryBuilder'; import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search'; @@ -20,6 +20,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { searchEditorFindMatch, searchEditorFindMatchBorder } from 'vs/platform/theme/common/colorRegistry'; +import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput'; // Using \r\n on Windows inserts an extra newline between results. const lineDelimiter = '\n'; @@ -277,16 +278,25 @@ export const createEditorFromSearchResult = const labelFormatter = (uri: URI): string => labelService.getUriLabel(uri, { relative: true }); const results = serializeSearchResultForEditor(searchResult, rawIncludePattern, rawExcludePattern, 0, labelFormatter); - + const contents = results.text.join(lineDelimiter); let possible = { - contents: results.text.join(lineDelimiter), + contents, mode: 'search-result', resource: URI.from({ scheme: network.Schemas.untitled, path: searchTerm }) }; let id = 0; - while (editorService.getOpened(possible)) { + let existing = editorService.getOpened(possible); + while (existing) { + if (existing instanceof UntitledTextEditorInput) { + const model = await existing.resolve(); + const existingContents = model.textEditorModel.getValue(EndOfLinePreference.LF); + if (existingContents === contents) { + break; + } + } possible.resource = possible.resource.with({ path: searchTerm + '-' + ++id }); + existing = editorService.getOpened(possible); } const editor = await editorService.openEditor(possible); From c0bc9d8a2aed1c914bd99ae71d03a121eaa8ee68 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 4 Dec 2019 10:27:21 -0800 Subject: [PATCH 114/637] Add links to WCAG for minimumContrastRatio Fixes #86144 --- .../workbench/contrib/terminal/browser/terminal.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index 6fec1c4ede7..ba65ed8a973 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -170,7 +170,7 @@ configurationRegistry.registerConfiguration({ default: DEFAULT_LINE_HEIGHT }, 'terminal.integrated.minimumContrastRatio': { - markdownDescription: nls.localize('terminal.integrated.minimumContrastRatio', "When set the foreground color of each cell will change to try meet the contrast ratio specified. Example values:\n\n- 1: The default, do nothing.\n- 4.5: Minimum for WCAG AA compliance.\n- 7: Minimum for WCAG AAA compliance.\n- 21: White on black or black on white."), + markdownDescription: nls.localize('terminal.integrated.minimumContrastRatio', "When set the foreground color of each cell will change to try meet the contrast ratio specified. Example values:\n\n- 1: The default, do nothing.\n- 4.5: Minimum for [WCAG AA compliance](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html).\n- 7: Minimum for [WCAG AAA compliance](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast7.html).\n- 21: White on black or black on white."), type: 'number', default: 1 }, From 43b0b9a7d570fd8ce2dbc6ee5c7bd6ec45b73c8e Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Wed, 4 Dec 2019 10:29:55 -0800 Subject: [PATCH 115/637] Update dropdown styles #86050 --- src/vs/workbench/browser/media/style.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/media/style.css b/src/vs/workbench/browser/media/style.css index bb6b38de289..b97ac21dda0 100644 --- a/src/vs/workbench/browser/media/style.css +++ b/src/vs/workbench/browser/media/style.css @@ -181,8 +181,7 @@ body.web { -webkit-appearance: none; -moz-appearance: none; /* Hides inner border from FF */ - border-block: none; - border-inline: none; + border: 1px solid; } .monaco-workbench .select-container { From 0034c13dc2988abaf2654965a74ace3ed1e87be0 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 10:30:20 -0800 Subject: [PATCH 116/637] Clean up excluding code-search results. Fixes #86195. --- .../workbench/contrib/search/browser/search.contribution.ts | 2 +- src/vs/workbench/contrib/search/common/searchModel.ts | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index c487eddae0b..98a487a1695 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -695,7 +695,7 @@ configurationRegistry.registerConfiguration({ 'search.exclude': { type: 'object', markdownDescription: nls.localize('exclude', "Configure glob patterns for excluding files and folders in searches. Inherits all glob patterns from the `#files.exclude#` setting. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options)."), - default: { '**/node_modules': true, '**/bower_components': true }, + default: { '**/node_modules': true, '**/bower_components': true, '**/*.code-search': true }, additionalProperties: { anyOf: [ { diff --git a/src/vs/workbench/contrib/search/common/searchModel.ts b/src/vs/workbench/contrib/search/common/searchModel.ts index 641a7557a37..99d8a29887d 100644 --- a/src/vs/workbench/contrib/search/common/searchModel.ts +++ b/src/vs/workbench/contrib/search/common/searchModel.ts @@ -982,11 +982,6 @@ export class SearchModel extends Disposable { search(query: ITextQuery, onProgress?: (result: ISearchProgressItem) => void): Promise { this.cancelSearch(); - // Exclude Search Editor results unless explicity included - const searchEditorFilenameGlob = `**/*.code-search`; - if (!query.includePattern || !query.includePattern[searchEditorFilenameGlob]) { - query.excludePattern = { ...(query.excludePattern ?? {}), [searchEditorFilenameGlob]: true }; - } this._searchQuery = query; if (!this.searchConfig.searchOnType) { From 9fd89ca3493e74dc659f4b5ab4319c10f15072e3 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 10:24:56 -0800 Subject: [PATCH 117/637] Pick up TS 3.7.3 final --- extensions/package.json | 2 +- extensions/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/package.json b/extensions/package.json index d1030bbe6dd..65d512cb8a5 100644 --- a/extensions/package.json +++ b/extensions/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "Dependencies shared by all extensions", "dependencies": { - "typescript": "3.7.3-insiders.20191123" + "typescript": "3.7.3" }, "scripts": { "postinstall": "node ./postinstall" diff --git a/extensions/yarn.lock b/extensions/yarn.lock index f2e7ae95079..a8eb51df657 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@3.7.3-insiders.20191123: - version "3.7.3-insiders.20191123" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3-insiders.20191123.tgz#f3bef33a2a3f6e02f11bcc0c20b6f0de526f17fd" - integrity sha512-b+tLx4D0a6SeuaCa7iehdgkRKHsS67FkioQWw+0REjVNOYZ+AqJ0NjlnomK1hEUvSzSNrH9Du+m+Yiv7JlVpSg== +typescript@3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== From 57455124b52ebdf06d1b24fb8690a8f5a4d6f661 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 10:57:19 -0800 Subject: [PATCH 118/637] Make sure we also log the typescript error properties on fatal error telemetry events Fixes #86205 We already log error metadata for failed requests. However we don't include this on the fatalError event. This makes investigation of these errors difficult --- .../src/tsServer/server.ts | 55 +++++++++++-------- .../src/tsServer/serverError.ts | 18 ++++++ .../src/typescriptServiceClient.ts | 19 ++++--- 3 files changed, 61 insertions(+), 31 deletions(-) diff --git a/extensions/typescript-language-features/src/tsServer/server.ts b/extensions/typescript-language-features/src/tsServer/server.ts index e4f9acd1975..782c1c56f05 100644 --- a/extensions/typescript-language-features/src/tsServer/server.ts +++ b/extensions/typescript-language-features/src/tsServer/server.ts @@ -60,7 +60,7 @@ export interface ITypeScriptServer { } export interface TsServerDelegate { - onFatalError(command: string): void; + onFatalError(command: string, error: Error): void; } export interface TsServerProcess { @@ -222,21 +222,13 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe if (!executeInfo.token || !executeInfo.token.isCancellationRequested) { /* __GDPR__ "languageServiceErrorResponse" : { - "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "message" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, - "stack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, - "errortext" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, "${include}": [ - "${TypeScriptCommonProperties}" + "${TypeScriptCommonProperties}", + "${TypeScriptRequestErrorProperties}" ] } */ - this._telemetryReporter.logTelemetry('languageServiceErrorResponse', { - command: err.serverCommand, - message: err.serverMessage || '', - stack: err.serverStack || '', - errortext: err.serverErrorText || '', - }); + this._telemetryReporter.logTelemetry('languageServiceErrorResponse', err.telemetry); } } @@ -367,9 +359,8 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ } else if (SyntaxRoutingTsServer.sharedCommands.has(command)) { // Dispatch to both server but only return from syntax one - const enum RequestState { Unresolved, Resolved, Errored } - let syntaxRequestState = RequestState.Unresolved; - let semanticRequestState = RequestState.Unresolved; + let syntaxRequestState: RequestState.State = RequestState.Unresolved; + let semanticRequestState: RequestState.State = RequestState.Unresolved; // Also make sure we never cancel requests to just one server let token: vscode.CancellationToken | undefined = undefined; @@ -394,16 +385,16 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ semanticRequest .then(result => { semanticRequestState = RequestState.Resolved; - if (syntaxRequestState === RequestState.Errored) { + if (syntaxRequestState.type === RequestState.Type.Errored) { // We've gone out of sync - this._delegate.onFatalError(command); + this._delegate.onFatalError(command, syntaxRequestState.err); } return result; }, err => { - semanticRequestState = RequestState.Errored; + semanticRequestState = new RequestState.Errored(err); if (syntaxRequestState === RequestState.Resolved) { // We've gone out of sync - this._delegate.onFatalError(command); + this._delegate.onFatalError(command, err); } throw err; }); @@ -413,16 +404,16 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ syntaxRequest .then(result => { syntaxRequestState = RequestState.Resolved; - if (semanticRequestState === RequestState.Errored) { + if (semanticRequestState.type === RequestState.Type.Errored) { // We've gone out of sync - this._delegate.onFatalError(command); + this._delegate.onFatalError(command, semanticRequestState.err); } return result; }, err => { - syntaxRequestState = RequestState.Errored; + syntaxRequestState = new RequestState.Errored(err); if (semanticRequestState === RequestState.Resolved) { // We've gone out of sync - this._delegate.onFatalError(command); + this._delegate.onFatalError(command, err); } throw err; }); @@ -433,3 +424,21 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ } } } + +namespace RequestState { + export const enum Type { Unresolved, Resolved, Errored } + + export const Unresolved = { type: Type.Unresolved } as const; + + export const Resolved = { type: Type.Resolved } as const; + + export class Errored { + readonly type = Type.Errored; + + constructor( + public readonly err: Error + ) { } + } + + export type State = typeof Unresolved | typeof Resolved | Errored; +} diff --git a/extensions/typescript-language-features/src/tsServer/serverError.ts b/extensions/typescript-language-features/src/tsServer/serverError.ts index 7f58aa6b0f5..5c844b5f4da 100644 --- a/extensions/typescript-language-features/src/tsServer/serverError.ts +++ b/extensions/typescript-language-features/src/tsServer/serverError.ts @@ -7,6 +7,7 @@ import * as Proto from '../protocol'; import { escapeRegExp } from '../utils/regexp'; import { TypeScriptVersion } from '../utils/versionProvider'; + export class TypeScriptServerError extends Error { public static create( serverId: string, @@ -31,6 +32,23 @@ export class TypeScriptServerError extends Error { public get serverCommand() { return this.response.command; } + public get telemetry() { + /* __GDPR__FRAGMENT__ + "TypeScriptRequestErrorProperties" : { + "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "message" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, + "stack" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" }, + "errortext" : { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" } + } + */ + return { + command: this.serverCommand, + message: this.serverMessage || '', + stack: this.serverStack || '', + errortext: this.serverErrorText || '', + } as const; + } + /** * Given a `errorText` from a tsserver request indicating failure in handling a request, * prepares a payload for telemetry-logging. diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index f45cb960dca..b3385c4c393 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -11,7 +11,9 @@ import BufferSyncSupport from './features/bufferSyncSupport'; import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics'; import * as Proto from './protocol'; import { ITypeScriptServer } from './tsServer/server'; -import { ITypeScriptServiceClient, ServerResponse, TypeScriptRequests, ExecConfig } from './typescriptService'; +import { TypeScriptServerError } from './tsServer/serverError'; +import { TypeScriptServerSpawner } from './tsServer/spawner'; +import { ExecConfig, ITypeScriptServiceClient, ServerResponse, TypeScriptRequests } from './typescriptService'; import API from './utils/api'; import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration'; import { Disposable } from './utils/dispose'; @@ -25,7 +27,6 @@ import Tracer from './utils/tracer'; import { inferredProjectConfig } from './utils/tsconfig'; import { TypeScriptVersionPicker } from './utils/versionPicker'; import { TypeScriptVersion, TypeScriptVersionProvider } from './utils/versionProvider'; -import { TypeScriptServerSpawner } from './tsServer/spawner'; const localize = nls.loadMessageBundle(); @@ -314,7 +315,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType this.onDidChangeTypeScriptVersion(currentVersion); let mytoken = ++this.token; const handle = this.typescriptServerSpawner.spawn(currentVersion, this.configuration, this.pluginManager, { - onFatalError: (command) => this.fatalError(command), + onFatalError: (command, err) => this.fatalError(command, err), }); this.serverState = new ServerState.Running(handle, apiVersion, undefined, true); this.lastStart = Date.now(); @@ -670,7 +671,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType } if (config?.nonRecoverable) { - execution.catch(() => this.fatalError(command)); + execution.catch(err => this.fatalError(command, err)); } return execution; @@ -704,14 +705,16 @@ export default class TypeScriptServiceClient extends Disposable implements IType return this.bufferSyncSupport.interuptGetErr(f); } - private fatalError(command: string): void { + private fatalError(command: string, error: Error): void { /* __GDPR__ "fatalError" : { - "${include}": [ "${TypeScriptCommonProperties}" ], - "command" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + "${include}": [ + "${TypeScriptCommonProperties}", + "${TypeScriptRequestErrorProperties}" + ] } */ - this.logTelemetry('fatalError', { command }); + this.logTelemetry('fatalError', { command, ...(error instanceof TypeScriptServerError ? error.telemetry : {}) }); console.error(`A non-recoverable error occured while executing tsserver command: ${command}`); if (this.serverState.type === ServerState.Type.Running) { From 49ebe301861ef831bcc21581fabc747ec8eb88ac Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Wed, 4 Dec 2019 11:08:17 -0800 Subject: [PATCH 119/637] Fix #86294, update stack frame color token names --- .../debug/browser/debugCallStackContribution.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts index 2959b8fd357..ee22aee0239 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts @@ -212,17 +212,17 @@ registerThemingParticipant((theme, collector) => { `); } - const debugIconBreakpointStackframeColor = theme.getColor(debugIconBreakpointStackframeForeground); - if (debugIconBreakpointStackframeColor) { + const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); + if (debugIconBreakpointCurrentStackframeForegroundColor) { collector.addRule(` .monaco-workbench .codicon-debug-breakpoint-stackframe, .monaco-workbench .codicon-debug-breakpoint-stackframe-dot::after { - color: ${debugIconBreakpointStackframeColor} !important; + color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; } `); } - const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeFocusedForeground); + const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground); if (debugIconBreakpointStackframeFocusedColor) { collector.addRule(` .monaco-workbench .codicon-debug-breakpoint-stackframe-focused { @@ -239,5 +239,5 @@ const focusedStackFrameColor = registerColor('editor.focusedStackFrameHighlightB const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.')); const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.')); const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.')); -const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for breakpoint stack frames.')); -const debugIconBreakpointStackframeFocusedForeground = registerColor('debugIcon.breakpointStackframeFocusedForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeFocusedForeground', 'Icon color for breakpoint stack frames that are focused.')); +const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.')); +const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.')); From 4bbb7aa8bd6fe09a240d652272633c7eacdd813f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 4 Dec 2019 11:15:42 -0800 Subject: [PATCH 120/637] xterm@4.3.0-beta.28.vscode.1 Diff: https://github.com/xtermjs/xterm.js/compare/397d053...8341c35 Fixes #86142 --- package.json | 2 +- remote/package.json | 2 +- remote/web/package.json | 2 +- remote/web/yarn.lock | 8 ++++---- remote/yarn.lock | 8 ++++---- yarn.lock | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 7fd8c125aaf..bf1a2181ead 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "vscode-ripgrep": "^1.5.7", "vscode-sqlite3": "4.0.9", "vscode-textmate": "4.4.0", - "xterm": "4.3.0-beta.28", + "xterm": "4.3.0-beta.28.vscode.1", "xterm-addon-search": "0.4.0-beta4", "xterm-addon-web-links": "0.2.1", "xterm-addon-webgl": "0.4.0-beta.11", diff --git a/remote/package.json b/remote/package.json index 216a7c37015..891ae131f63 100644 --- a/remote/package.json +++ b/remote/package.json @@ -20,7 +20,7 @@ "vscode-proxy-agent": "^0.5.2", "vscode-ripgrep": "^1.5.7", "vscode-textmate": "4.4.0", - "xterm": "4.3.0-beta.28", + "xterm": "4.3.0-beta.28.vscode.1", "xterm-addon-search": "0.4.0-beta4", "xterm-addon-web-links": "0.2.1", "xterm-addon-webgl": "0.4.0-beta.11", diff --git a/remote/web/package.json b/remote/web/package.json index 2a0519d282d..0aed404aaba 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -5,7 +5,7 @@ "onigasm-umd": "2.2.5", "semver-umd": "^5.5.3", "vscode-textmate": "4.4.0", - "xterm": "4.3.0-beta.28", + "xterm": "4.3.0-beta.28.vscode.1", "xterm-addon-search": "0.4.0-beta4", "xterm-addon-web-links": "0.2.1", "xterm-addon-webgl": "0.4.0-beta.11" diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 1e2d3f0de21..18078da8d19 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -46,7 +46,7 @@ xterm-addon-webgl@0.4.0-beta.11: resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta.11.tgz#0e4a7242e2353cf74aba55e5a5bdc0b4ec87ad10" integrity sha512-AteDxm1RFy1WnjY9r5iJSETozLebvUkR+jextdZk/ASsK21vsYK0DuVWwRI8afgiN2hUVhxcxuHEJUOV+CJDQA== -xterm@4.3.0-beta.28: - version "4.3.0-beta.28" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.tgz#80f7c4ba8f6ee3c953e6f33f8ce5aef08d5a8354" - integrity sha512-WWZ4XCvce5h+klL6ObwtMauJff/n2KGGOwJJkDbJhrAjVy2a77GKgAedJTDDFGgKJ6ix1d7puHtVSSKflIVaDQ== +xterm@4.3.0-beta.28.vscode.1: + version "4.3.0-beta.28.vscode.1" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.vscode.1.tgz#89b85398b5801708e833d08bf92b2124fa128943" + integrity sha512-JNHNZyDtAWnybJTrenPzD6g/yXpHOvPqmjau91Up4onRbjQYMSNlth17SqaES68DKn/+4kcIl2c/RG5SXJjvGw== diff --git a/remote/yarn.lock b/remote/yarn.lock index 6b661b17e47..a45c4d94ff5 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -433,10 +433,10 @@ xterm-addon-webgl@0.4.0-beta.11: resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta.11.tgz#0e4a7242e2353cf74aba55e5a5bdc0b4ec87ad10" integrity sha512-AteDxm1RFy1WnjY9r5iJSETozLebvUkR+jextdZk/ASsK21vsYK0DuVWwRI8afgiN2hUVhxcxuHEJUOV+CJDQA== -xterm@4.3.0-beta.28: - version "4.3.0-beta.28" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.tgz#80f7c4ba8f6ee3c953e6f33f8ce5aef08d5a8354" - integrity sha512-WWZ4XCvce5h+klL6ObwtMauJff/n2KGGOwJJkDbJhrAjVy2a77GKgAedJTDDFGgKJ6ix1d7puHtVSSKflIVaDQ== +xterm@4.3.0-beta.28.vscode.1: + version "4.3.0-beta.28.vscode.1" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.vscode.1.tgz#89b85398b5801708e833d08bf92b2124fa128943" + integrity sha512-JNHNZyDtAWnybJTrenPzD6g/yXpHOvPqmjau91Up4onRbjQYMSNlth17SqaES68DKn/+4kcIl2c/RG5SXJjvGw== yauzl@^2.9.2: version "2.10.0" diff --git a/yarn.lock b/yarn.lock index a4b936375f7..edbbc9743d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9374,10 +9374,10 @@ xterm-addon-webgl@0.4.0-beta.11: resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta.11.tgz#0e4a7242e2353cf74aba55e5a5bdc0b4ec87ad10" integrity sha512-AteDxm1RFy1WnjY9r5iJSETozLebvUkR+jextdZk/ASsK21vsYK0DuVWwRI8afgiN2hUVhxcxuHEJUOV+CJDQA== -xterm@4.3.0-beta.28: - version "4.3.0-beta.28" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.tgz#80f7c4ba8f6ee3c953e6f33f8ce5aef08d5a8354" - integrity sha512-WWZ4XCvce5h+klL6ObwtMauJff/n2KGGOwJJkDbJhrAjVy2a77GKgAedJTDDFGgKJ6ix1d7puHtVSSKflIVaDQ== +xterm@4.3.0-beta.28.vscode.1: + version "4.3.0-beta.28.vscode.1" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta.28.vscode.1.tgz#89b85398b5801708e833d08bf92b2124fa128943" + integrity sha512-JNHNZyDtAWnybJTrenPzD6g/yXpHOvPqmjau91Up4onRbjQYMSNlth17SqaES68DKn/+4kcIl2c/RG5SXJjvGw== y18n@^3.2.1: version "3.2.1" From 44a6a7645685f02f507466c2e7c7a8f6ec1a7db9 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 11:17:07 -0800 Subject: [PATCH 121/637] Fix search editor query string unescaping (Fixes #86203) --- .../contrib/search/browser/searchEditor.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 725ab6f93d0..46d8c80250b 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -21,6 +21,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { searchEditorFindMatch, searchEditorFindMatchBorder } from 'vs/platform/theme/common/colorRegistry'; import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput'; +import { localize } from 'vs/nls'; // Using \r\n on Windows inserts an extra newline between results. const lineDelimiter = '\n'; @@ -173,7 +174,28 @@ const searchHeaderToContentPattern = (header: string[]): SearchHeader => { context: undefined }; - const unescapeNewlines = (str: string) => str.replace(/\\\\/g, '\\').replace(/\\n/g, '\n'); + const unescapeNewlines = (str: string) => { + let out = ''; + for (let i = 0; i < str.length; i++) { + if (str[i] === '\\') { + i++; + const escaped = str[i]; + + if (escaped === 'n') { + out += '\n'; + } + else if (escaped === '\\') { + out += '\\'; + } + else { + throw Error(localize('invalidQueryStringError', "All backslashes in Query string must be escaped (\\\\)")); + } + } else { + out += str[i]; + } + } + return out; + }; const parseYML = /^# ([^:]*): (.*)$/; for (const line of header) { const parsed = parseYML.exec(line); From bb46c283287bd6b5e3417478ea5664e4993e6b0d Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 4 Dec 2019 11:19:46 -0800 Subject: [PATCH 122/637] Update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf1a2181ead..751de76f58a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.41.0", - "distro": "de758a726231fcf8e04422e65e29cd792f21c6c4", + "distro": "17f1b806c349d58f96b4aef97ae59d836e2c5605", "author": { "name": "Microsoft Corporation" }, From 187c067b276b317704e458a1fae3636fadbd05d7 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 11:29:32 -0800 Subject: [PATCH 123/637] Fix typo in command name --- extensions/search-result/package.nls.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/search-result/package.nls.json b/extensions/search-result/package.nls.json index a4b0fb83845..ce90d23c09c 100644 --- a/extensions/search-result/package.nls.json +++ b/extensions/search-result/package.nls.json @@ -2,5 +2,5 @@ "displayName": "Search Result", "description": "Provides syntax highlighting and language features for tabbed search results.", "searchResult.rerunSearch.title": "Search Again", - "searchResult.rerunSearchWithContext.title": "Search Again (Wth Context)" + "searchResult.rerunSearchWithContext.title": "Search Again (With Context)" } From 520c9998c3c3b8ffeee697f3b0b982c7826b0cb2 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 11:41:57 -0800 Subject: [PATCH 124/637] Increase search input history delay, and skip delay on enter. Fixes #86288. --- src/vs/workbench/contrib/search/browser/searchView.ts | 2 +- src/vs/workbench/contrib/search/browser/searchWidget.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 419611a9462..2d97255d2d6 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -206,7 +206,7 @@ export class SearchView extends ViewletPane { this.delayedRefresh = this._register(new Delayer(250)); - this.addToSearchHistoryDelayer = this._register(new Delayer(500)); + this.addToSearchHistoryDelayer = this._register(new Delayer(2000)); this.actions = [ this._register(this.instantiationService.createInstance(ClearSearchResultsAction, ClearSearchResultsAction.ID, ClearSearchResultsAction.LABEL)), diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index a7ebbd9cb19..3c9a7a6b1fd 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -466,6 +466,7 @@ export class SearchWidget extends Widget { } if (keyboardEvent.equals(KeyCode.Enter)) { + this.searchInput.onSearchSubmit(); this.submitSearch(); keyboardEvent.preventDefault(); } From 72779d523412a6df73d585efdb2f903c340b56ca Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 11:53:55 -0800 Subject: [PATCH 125/637] Fix "Cannot create regex from empty string" in search editor. Closes #86200. --- src/vs/workbench/contrib/search/browser/searchEditor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 46d8c80250b..9b54955af67 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -239,7 +239,7 @@ export const refreshActiveEditorSearch = const textModel = model as ITextModel; - const header = textModel.getValueInRange(new Range(1, 1, 5, 1)) + const header = textModel.getValueInRange(new Range(1, 1, 5, 1), EndOfLinePreference.LF) .split(lineDelimiter) .filter(line => line.indexOf('# ') === 0); From 03a567127f119a17ee83d80c45c2083b764f2fc6 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 14:13:04 -0800 Subject: [PATCH 126/637] [Search] Fix focus sometimes going to wrong element. Fixes #86234 --- src/vs/workbench/contrib/search/browser/searchView.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 2d97255d2d6..d11471d7ff7 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -963,13 +963,15 @@ export class SearchView extends ViewletPane { return this.searchWidget && this.searchWidget.searchInput.getValue().length > 0; } - clearSearchResults(): void { + clearSearchResults(clearInput = true): void { this.viewModel.searchResult.clear(); this.showEmptyStage(true); if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) { this.showSearchWithoutFolderMessage(); } - this.searchWidget.clear(); + if (clearInput) { + this.searchWidget.clear(); + } this.viewModel.cancelSearch(); this.updateActions(); @@ -1202,7 +1204,7 @@ export class SearchView extends ViewletPane { const useExcludesAndIgnoreFiles = this.inputPatternExcludes.useExcludesAndIgnoreFiles(); if (contentPattern.length === 0) { - this.clearSearchResults(); + this.clearSearchResults(false); this.clearMessage(); return; } From 73c788749636c6278898d6f2774c6e9449de1cf2 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 15:35:19 -0800 Subject: [PATCH 127/637] [Search Editor] Make clicking take you to the location you clicked. Ref #86190. --- extensions/search-result/src/extension.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index c88a4feab63..6956a63d329 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -7,7 +7,7 @@ import * as vscode from 'vscode'; import * as pathUtils from 'path'; const FILE_LINE_REGEX = /^(\S.*):$/; -const RESULT_LINE_REGEX = /^(\s+)(\d+)(?::| )(\s+)(.*)$/; +const RESULT_LINE_REGEX = /^(\s+)(\d+)(:| )(\s+)(.*)$/; const SEARCH_RESULT_SELECTOR = { language: 'search-result' }; const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:']; const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch']; @@ -66,7 +66,13 @@ export function activate(context: vscode.ExtensionContext) { return []; } - return [lineResult.location]; + const translateRangeSidewaysBy = (r: vscode.Range, n: number) => + r.with({ start: new vscode.Position(r.start.line, Math.max(0, n - r.start.character)), end: new vscode.Position(r.end.line, Math.max(0, n - r.end.character)) }); + + return [{ + ...lineResult.location, + targetSelectionRange: translateRangeSidewaysBy(lineResult.location.targetSelectionRange!, position.character - 1) + }]; } }), @@ -166,13 +172,14 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell const resultLine = RESULT_LINE_REGEX.exec(line); if (resultLine) { - const [, indentation, _lineNumber, resultIndentation] = resultLine; + const [, indentation, _lineNumber, seperator, resultIndentation] = resultLine; const lineNumber = +_lineNumber - 1; - const resultStart = (indentation + _lineNumber + ':' + resultIndentation).length; + const resultStart = (indentation + _lineNumber + seperator + resultIndentation).length; + const metadataOffset = (indentation + _lineNumber + seperator).length; const location: vscode.LocationLink = { targetRange: new vscode.Range(Math.max(lineNumber - 3, 0), 0, lineNumber + 3, line.length), - targetSelectionRange: new vscode.Range(lineNumber, 0, lineNumber, line.length), + targetSelectionRange: new vscode.Range(lineNumber, metadataOffset, lineNumber, metadataOffset), targetUri: currentTarget, originSelectionRange: new vscode.Range(i, resultStart, i, line.length), }; From 5a84679fd7aca1156f800c76e8b884fe566353ad Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 15:19:00 -0800 Subject: [PATCH 128/637] Remove tga from documented supported image format list For #84533 --- extensions/image-preview/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/image-preview/README.md b/extensions/image-preview/README.md index ccb5ac3954a..d3f0bd6cb6c 100644 --- a/extensions/image-preview/README.md +++ b/extensions/image-preview/README.md @@ -13,5 +13,4 @@ Supported image formats: - `*.bmp` - `*.gif` - `*.ico` -- `*.tga` - `*.webp` From bc68bd20916de9c3ad196a0e8c8731550bdac13f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 15:35:53 -0800 Subject: [PATCH 129/637] Use monospace font for overloads From #84682 This prevents slight shifting of the parameter hints box while going through the overloads --- src/vs/editor/contrib/parameterHints/parameterHints.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.css b/src/vs/editor/contrib/parameterHints/parameterHints.css index e77cb357003..83e1d3bcb3a 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.css +++ b/src/vs/editor/contrib/parameterHints/parameterHints.css @@ -95,6 +95,7 @@ height: 12px; line-height: 12px; opacity: 0.5; + font-family: var(--monaco-monospace-font); } .monaco-editor .parameter-hints-widget .signature .parameter.active { From a07b2fbef408f2f1ee7810e80d02f10373ed4c3b Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 15:36:40 -0800 Subject: [PATCH 130/637] Fix parameter hints overload border not taking up entire height For #84682 --- src/vs/editor/contrib/parameterHints/parameterHints.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.css b/src/vs/editor/contrib/parameterHints/parameterHints.css index 83e1d3bcb3a..dde72560cc5 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.css +++ b/src/vs/editor/contrib/parameterHints/parameterHints.css @@ -34,6 +34,7 @@ .monaco-editor .parameter-hints-widget .body { display: flex; flex-direction: column; + min-height: 100%; } .monaco-editor .parameter-hints-widget .signature { From 02a1ddcf96a7a1f4eb88ebc3524138fed89f7b9d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 4 Dec 2019 15:37:41 -0800 Subject: [PATCH 131/637] Add slight padding to overload count Fixes #86334 --- src/vs/editor/contrib/parameterHints/parameterHints.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.css b/src/vs/editor/contrib/parameterHints/parameterHints.css index dde72560cc5..c764f5e9581 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.css +++ b/src/vs/editor/contrib/parameterHints/parameterHints.css @@ -73,6 +73,7 @@ .monaco-editor .parameter-hints-widget.multiple .controls { display: flex; + padding: 0 2px; } .monaco-editor .parameter-hints-widget.multiple .button { From 401c633b4d92f827efc810eff6a1924fdcf3c60b Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 15:59:40 -0800 Subject: [PATCH 132/637] [Search on Type] Dont trigger search on initalizatioon. Fixes #86129. --- .../contrib/search/browser/patternInputWidget.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/patternInputWidget.ts b/src/vs/workbench/contrib/search/browser/patternInputWidget.ts index 0d41239f527..b5502c58cf9 100644 --- a/src/vs/workbench/contrib/search/browser/patternInputWidget.ts +++ b/src/vs/workbench/contrib/search/browser/patternInputWidget.ts @@ -149,12 +149,6 @@ export class PatternInputWidget extends Widget { this._register(attachInputBoxStyler(this.inputBox, this.themeService)); this.inputFocusTracker = dom.trackFocus(this.inputBox.inputElement); this.onkeyup(this.inputBox.inputElement, (keyboardEvent) => this.onInputKeyUp(keyboardEvent)); - this._register(this.inputBox.onDidChange(() => { - if (this.searchConfig.searchOnType) { - this._onCancel.fire(); - this.searchOnTypeDelayer.trigger(() => this._onSubmit.fire(true), this.searchConfig.searchOnTypeDebouncePeriod); - } - })); const controls = document.createElement('div'); controls.className = 'controls'; @@ -176,6 +170,10 @@ export class PatternInputWidget extends Widget { this._onCancel.fire(); return; default: + if (this.searchConfig.searchOnType) { + this._onCancel.fire(); + this.searchOnTypeDelayer.trigger(() => this._onSubmit.fire(true), this.searchConfig.searchOnTypeDebouncePeriod); + } return; } } From d3cda21f0e7e3187d53b4db9c52465f1cc660d74 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 4 Dec 2019 16:11:32 -0800 Subject: [PATCH 133/637] Make default search editor result highlight a bit less transparent. Closes #86185. --- src/vs/platform/theme/common/colorRegistry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/theme/common/colorRegistry.ts b/src/vs/platform/theme/common/colorRegistry.ts index 43163b757bc..1fb0eb51c41 100644 --- a/src/vs/platform/theme/common/colorRegistry.ts +++ b/src/vs/platform/theme/common/colorRegistry.ts @@ -304,8 +304,8 @@ export const editorFindRangeHighlightBorder = registerColor('editor.findRangeHig * * Distinct from normal editor find match to allow for better differentiation */ -export const searchEditorFindMatch = registerColor('searchEditor.findMatchBackground', { light: transparent(editorFindMatchHighlight, 0.5), dark: transparent(editorFindMatchHighlight, 0.5), hc: editorFindMatchHighlight }, nls.localize('searchEditor.queryMatch', "Color of the Search Editor query matches.")); -export const searchEditorFindMatchBorder = registerColor('searchEditor.findMatchBorder', { light: transparent(editorFindMatchHighlightBorder, 0.5), dark: transparent(editorFindMatchHighlightBorder, 0.5), hc: editorFindMatchHighlightBorder }, nls.localize('searchEditor.editorFindMatchBorder', "Border color of the Search Editor query matches.")); +export const searchEditorFindMatch = registerColor('searchEditor.findMatchBackground', { light: transparent(editorFindMatchHighlight, 0.66), dark: transparent(editorFindMatchHighlight, 0.66), hc: editorFindMatchHighlight }, nls.localize('searchEditor.queryMatch', "Color of the Search Editor query matches.")); +export const searchEditorFindMatchBorder = registerColor('searchEditor.findMatchBorder', { light: transparent(editorFindMatchHighlightBorder, 0.66), dark: transparent(editorFindMatchHighlightBorder, 0.66), hc: editorFindMatchHighlightBorder }, nls.localize('searchEditor.editorFindMatchBorder', "Border color of the Search Editor query matches.")); /** * Editor hover From 88e80b9a18b2cc3de0ca3a02977c3e2d4b088a60 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 4 Dec 2019 16:05:33 -0800 Subject: [PATCH 134/637] debug: restart as extension host if any parent is an extension host --- .../contrib/debug/browser/debugService.ts | 12 +++++---- .../contrib/debug/common/debugUtils.ts | 27 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 24dc3d59a8c..81841ebec67 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -41,7 +41,7 @@ import { deepClone, equals } from 'vs/base/common/objects'; import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, REPL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IEnablement, IBreakpoint, IBreakpointData, ICompound, IGlobalConfig, IStackFrame, AdapterEndEvent, getStateLabel, IDebugSessionOptions, CONTEXT_DEBUG_UX } from 'vs/workbench/contrib/debug/common/debug'; -import { isExtensionHostDebugging } from 'vs/workbench/contrib/debug/common/debugUtils'; +import { getExtensionHostDebugSession } from 'vs/workbench/contrib/debug/common/debugUtils'; import { isErrorWithActions, createErrorWithActions } from 'vs/base/common/errorsWithActions'; import { RunOnceScheduler } from 'vs/base/common/async'; import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug'; @@ -539,8 +539,9 @@ export class DebugService implements IDebugService { } // 'Run without debugging' mode VSCode must terminate the extension host. More details: #3905 - if (isExtensionHostDebugging(session.configuration) && session.state === State.Running && session.configuration.noDebug) { - this.extensionHostDebugService.close(session.getId()); + const extensionDebugSession = getExtensionHostDebugSession(session); + if (extensionDebugSession && extensionDebugSession.state === State.Running && extensionDebugSession.configuration.noDebug) { + this.extensionHostDebugService.close(extensionDebugSession.getId()); } this.telemetryDebugSessionStop(session, adapterExitEvent); @@ -590,10 +591,11 @@ export class DebugService implements IDebugService { return this.runTaskAndCheckErrors(session.root, session.configuration.preLaunchTask); }; - if (isExtensionHostDebugging(session.configuration)) { + const extensionDebugSession = getExtensionHostDebugSession(session); + if (extensionDebugSession) { const taskResult = await runTasks(); if (taskResult === TaskRunResult.Success) { - this.extensionHostDebugService.reload(session.getId()); + this.extensionHostDebugService.reload(extensionDebugSession.getId()); } return; diff --git a/src/vs/workbench/contrib/debug/common/debugUtils.ts b/src/vs/workbench/contrib/debug/common/debugUtils.ts index 38aebf4b083..89c02df8bb7 100644 --- a/src/vs/workbench/contrib/debug/common/debugUtils.ts +++ b/src/vs/workbench/contrib/debug/common/debugUtils.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { equalsIgnoreCase } from 'vs/base/common/strings'; -import { IConfig, IDebuggerContribution, IDebugSession } from 'vs/workbench/contrib/debug/common/debug'; +import { IDebuggerContribution, IDebugSession } from 'vs/workbench/contrib/debug/common/debug'; import { URI as uri } from 'vs/base/common/uri'; import { isAbsolute } from 'vs/base/common/path'; import { deepClone } from 'vs/base/common/objects'; @@ -24,19 +24,28 @@ export function formatPII(value: string, excludePII: boolean, args: { [key: stri } export function isSessionAttach(session: IDebugSession): boolean { - return !session.parentSession && session.configuration.request === 'attach' && !isExtensionHostDebugging(session.configuration); + return !session.parentSession && session.configuration.request === 'attach' && !getExtensionHostDebugSession(session); } -export function isExtensionHostDebugging(config: IConfig) { - if (!config.type) { - return false; +/** + * Returns the session or any parent which is an extension host debug session. + * Returns undefined if there's none. + */ +export function getExtensionHostDebugSession(session: IDebugSession): IDebugSession | void { + let type = session.configuration.type; + if (!type) { + return; } - const type = config.type === 'vslsShare' - ? (config).adapterProxy.configuration.type - : config.type; + if (type === 'vslsShare') { + type = (session.configuration).adapterProxy.configuration.type; + } - return equalsIgnoreCase(type, 'extensionhost') || equalsIgnoreCase(type, 'pwa-extensionhost'); + if (equalsIgnoreCase(type, 'extensionhost') || equalsIgnoreCase(type, 'pwa-extensionhost')) { + return session; + } + + return session.parentSession ? getExtensionHostDebugSession(session.parentSession) : undefined; } // only a debugger contributions with a label, program, or runtime attribute is considered a "defining" or "main" debugger contribution From beb8a0c7b7a1a383181c7bab6f99f007e0629d43 Mon Sep 17 00:00:00 2001 From: rebornix Date: Wed, 4 Dec 2019 16:26:41 -0800 Subject: [PATCH 135/637] Fix #86347. Fixed overflow widget only for extension viewlet --- .../browser/suggestEnabledInput/suggestEnabledInput.ts | 3 ++- .../workbench/contrib/extensions/browser/extensionsViewlet.ts | 2 +- .../workbench/contrib/preferences/browser/settingsEditor2.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts index eb0499385ca..ee09a61a8e6 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts @@ -72,6 +72,7 @@ interface SuggestEnabledInputOptions { * Context key tracking the focus state of this element */ focusContextKey?: IContextKey; + fixedOverflowWidgets?: boolean; } export interface ISuggestEnabledInputStyleOverrides extends IStyleOverrides { @@ -126,7 +127,7 @@ export class SuggestEnabledInput extends Widget implements IThemable { this.placeholderText = append(this.stylingContainer, $('.suggest-input-placeholder', undefined, options.placeholderText || '')); const editorOptions: IEditorOptions = mixin( - getSimpleEditorOptions(false), + getSimpleEditorOptions(!!options.fixedOverflowWidgets), getSuggestEnabledInputOptions(ariaLabel)); this.inputWidget = instantiationService.createInstance(CodeEditorWidget, this.stylingContainer, diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 4ac7d34337e..669297557d5 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -405,7 +405,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio else { return 'd'; } }, provideResults: (query: string) => Query.suggestions(query) - }, placeholder, 'extensions:searchinput', { placeholderText: placeholder, value: searchValue })); + }, placeholder, 'extensions:searchinput', { placeholderText: placeholder, value: searchValue, fixedOverflowWidgets: false })); if (this.searchBox.getValue()) { this.triggerSearch(); diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 09467700dd5..e339ce2784e 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -406,6 +406,7 @@ export class SettingsEditor2 extends BaseEditor { }, searchBoxLabel, 'settingseditor:searchinput' + SettingsEditor2.NUM_INSTANCES++, { placeholderText: searchBoxLabel, focusContextKey: this.searchFocusContextKey, + fixedOverflowWidgets: true // TODO: Aria-live }) ); From e904ef98a86987d39d710230c9359dd1d06611df Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 4 Dec 2019 16:41:54 -0800 Subject: [PATCH 136/637] fix empty group issue refs #85440 --- src/vs/editor/contrib/contextmenu/contextmenu.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index 6a301ba93e4..6114c170cce 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -148,19 +148,29 @@ export class ContextMenuController implements IEditorContribution { // translate them into other actions for (let group of groups) { const [, actions] = group; + let addedItems = 0; for (const action of actions) { if (action instanceof SubmenuItemAction) { const subActions = this._getMenuActions(model, action.item.submenu); if (subActions.length > 0) { result.push(new ContextSubMenu(action.label, subActions)); + addedItems++; } } else { result.push(action); + addedItems++; } } - result.push(new Separator()); + + if (addedItems) { + result.push(new Separator()); + } } - result.pop(); // remove last separator + + if (result.length) { + result.pop(); // remove last separator + } + return result; } From 52de8700e7446ed6ac88e91c0d20c549af23f711 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Wed, 4 Dec 2019 16:51:41 -0800 Subject: [PATCH 137/637] Fix #86211 --- extensions/html-language-features/client/src/htmlMain.ts | 2 +- extensions/html-language-features/package.json | 4 ++-- extensions/html-language-features/package.nls.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/html-language-features/client/src/htmlMain.ts b/extensions/html-language-features/client/src/htmlMain.ts index 4d900214bd1..9a4d392ff28 100644 --- a/extensions/html-language-features/client/src/htmlMain.ts +++ b/extensions/html-language-features/client/src/htmlMain.ts @@ -118,7 +118,7 @@ export function activate(context: ExtensionContext) { return client.sendRequest(MatchingTagPositionRequest.type, param); }; - disposable = activateMatchingTagSelection(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.autoSelectingMatchingTags'); + disposable = activateMatchingTagSelection(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag'); toDispose.push(disposable); disposable = client.onTelemetry(e => { diff --git a/extensions/html-language-features/package.json b/extensions/html-language-features/package.json index 5dedb79987b..696c2dda852 100644 --- a/extensions/html-language-features/package.json +++ b/extensions/html-language-features/package.json @@ -161,11 +161,11 @@ "default": true, "description": "%html.autoClosingTags%" }, - "html.autoSelectingMatchingTags": { + "html.mirrorCursorOnMatchingTag": { "type": "boolean", "scope": "resource", "default": true, - "description": "%html.autoSelectingMatchingTags%" + "description": "%html.mirrorCursorOnMatchingTag%" }, "html.trace.server": { "type": "string", diff --git a/extensions/html-language-features/package.nls.json b/extensions/html-language-features/package.nls.json index 4e4d666b9f7..8fa34d25270 100644 --- a/extensions/html-language-features/package.nls.json +++ b/extensions/html-language-features/package.nls.json @@ -25,5 +25,5 @@ "html.validate.scripts": "Controls whether the built-in HTML language support validates embedded scripts.", "html.validate.styles": "Controls whether the built-in HTML language support validates embedded styles.", "html.autoClosingTags": "Enable/disable autoclosing of HTML tags.", - "html.autoSelectingMatchingTags": "Enable/disable auto selecting matching HTML tags." + "html.mirrorCursorOnMatchingTag": "Enable/disable mirroring cursor on matching HTML tag." } From f460070daa3593b543f58e17ad58754763be6784 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Wed, 4 Dec 2019 16:54:28 -0800 Subject: [PATCH 138/637] Update scm colors in ruler --- src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts index 4da76571bbd..29189ddcb10 100644 --- a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts @@ -843,9 +843,9 @@ export const minimapGutterDeletedBackground = registerColor('minimapGutter.delet }, nls.localize('minimapGutterDeletedBackground', "Minimap gutter background color for lines that are deleted.")); const overviewRulerDefault = new Color(new RGBA(0, 122, 204, 0.6)); -export const overviewRulerModifiedForeground = registerColor('editorOverviewRuler.modifiedForeground', { dark: overviewRulerDefault, light: overviewRulerDefault, hc: overviewRulerDefault }, nls.localize('overviewRulerModifiedForeground', 'Overview ruler marker color for modified content.')); -export const overviewRulerAddedForeground = registerColor('editorOverviewRuler.addedForeground', { dark: overviewRulerDefault, light: overviewRulerDefault, hc: overviewRulerDefault }, nls.localize('overviewRulerAddedForeground', 'Overview ruler marker color for added content.')); -export const overviewRulerDeletedForeground = registerColor('editorOverviewRuler.deletedForeground', { dark: overviewRulerDefault, light: overviewRulerDefault, hc: overviewRulerDefault }, nls.localize('overviewRulerDeletedForeground', 'Overview ruler marker color for deleted content.')); +export const overviewRulerModifiedForeground = registerColor('editorOverviewRuler.modifiedForeground', { dark: editorGutterModifiedBackground, light: editorGutterModifiedBackground, hc: editorGutterModifiedBackground }, nls.localize('overviewRulerModifiedForeground', 'Overview ruler marker color for modified content.')); +export const overviewRulerAddedForeground = registerColor('editorOverviewRuler.addedForeground', { dark: editorGutterAddedBackground, light: editorGutterAddedBackground, hc: editorGutterAddedBackground }, nls.localize('overviewRulerAddedForeground', 'Overview ruler marker color for added content.')); +export const overviewRulerDeletedForeground = registerColor('editorOverviewRuler.deletedForeground', { dark: editorGutterDeletedBackground, light: editorGutterDeletedBackground, hc: editorGutterDeletedBackground }, nls.localize('overviewRulerDeletedForeground', 'Overview ruler marker color for deleted content.')); class DirtyDiffDecorator extends Disposable { From f966d27d9adddefd86b05e023332af4f1a58793a Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Wed, 4 Dec 2019 16:58:10 -0800 Subject: [PATCH 139/637] Update css service --- extensions/css-language-features/server/package.json | 2 +- extensions/css-language-features/server/yarn.lock | 8 ++++---- extensions/html-language-features/server/package.json | 2 +- extensions/html-language-features/server/yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/css-language-features/server/package.json b/extensions/css-language-features/server/package.json index c5aacd3d41c..5ff5b49c5f3 100644 --- a/extensions/css-language-features/server/package.json +++ b/extensions/css-language-features/server/package.json @@ -9,7 +9,7 @@ }, "main": "./out/cssServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.22", + "vscode-css-languageservice": "^4.0.3-next.23", "vscode-languageserver": "^6.0.0-next.3" }, "devDependencies": { diff --git a/extensions/css-language-features/server/yarn.lock b/extensions/css-language-features/server/yarn.lock index 00e2de5a14b..6191a8ffcd5 100644 --- a/extensions/css-language-features/server/yarn.lock +++ b/extensions/css-language-features/server/yarn.lock @@ -781,10 +781,10 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.22: - version "4.0.3-next.22" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.22.tgz#ddb23a7086807f0e098f069ad91a8e3b7a696cbb" - integrity sha512-j7+S/0LPn/pTe/CQ8WscDttW5J3aY5Ls6bo/Cz8ZdlBjHl7DbrbZ2rEl5Qd6aKbg0ZdgjWVxGqjjgZFzh+O9/w== +vscode-css-languageservice@^4.0.3-next.23: + version "4.0.3-next.23" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff" + integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg== dependencies: vscode-languageserver-textdocument "^1.0.0-next.4" vscode-languageserver-types "^3.15.0-next.6" diff --git a/extensions/html-language-features/server/package.json b/extensions/html-language-features/server/package.json index 2cc1a5b2323..27661b072bd 100644 --- a/extensions/html-language-features/server/package.json +++ b/extensions/html-language-features/server/package.json @@ -9,7 +9,7 @@ }, "main": "./out/htmlServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.22", + "vscode-css-languageservice": "^4.0.3-next.23", "vscode-html-languageservice": "^3.0.4-next.11", "vscode-languageserver": "^6.0.0-next.3", "vscode-nls": "^4.1.1", diff --git a/extensions/html-language-features/server/yarn.lock b/extensions/html-language-features/server/yarn.lock index 3185f2943f6..395953969f4 100644 --- a/extensions/html-language-features/server/yarn.lock +++ b/extensions/html-language-features/server/yarn.lock @@ -611,10 +611,10 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.22: - version "4.0.3-next.22" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.22.tgz#ddb23a7086807f0e098f069ad91a8e3b7a696cbb" - integrity sha512-j7+S/0LPn/pTe/CQ8WscDttW5J3aY5Ls6bo/Cz8ZdlBjHl7DbrbZ2rEl5Qd6aKbg0ZdgjWVxGqjjgZFzh+O9/w== +vscode-css-languageservice@^4.0.3-next.23: + version "4.0.3-next.23" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff" + integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg== dependencies: vscode-languageserver-textdocument "^1.0.0-next.4" vscode-languageserver-types "^3.15.0-next.6" From bbf00d8ea6aa7e825ca3393364d746fe401d3299 Mon Sep 17 00:00:00 2001 From: SteVen Batten <6561887+sbatten@users.noreply.github.com> Date: Wed, 4 Dec 2019 18:06:46 -0800 Subject: [PATCH 140/637] attempt #2 (#86354) * Another attempt * tweak titlebar z index --- src/vs/workbench/browser/media/part.css | 5 +++++ .../browser/parts/activitybar/media/activitybarpart.css | 1 + .../workbench/browser/parts/sidebar/media/sidebarpart.css | 6 ++---- .../workbench/browser/parts/titlebar/media/titlebarpart.css | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/browser/media/part.css b/src/vs/workbench/browser/media/part.css index 89dd7fe4c9b..d71cf8f50d1 100644 --- a/src/vs/workbench/browser/media/part.css +++ b/src/vs/workbench/browser/media/part.css @@ -8,6 +8,11 @@ overflow: hidden; } +.monaco-workbench.windows.chromium .part:focus-within, +.monaco-workbench.linux.chromium .part:focus-within { + z-index: 500; +} + .monaco-workbench .part > .title { display: none; /* Parts have to opt in to show title area */ } diff --git a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css index 09bb59d2980..4dc487ae5d0 100644 --- a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css +++ b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css @@ -20,6 +20,7 @@ */ transform: translate3d(0px, 0px, 0px); overflow: visible; /* when a new layer is created, we need to set overflow visible to avoid clipping the menubar */ + position: relative; } .monaco-workbench .activitybar > .content { diff --git a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css index 1e2fad096a3..ac2845f9c4b 100644 --- a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css +++ b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css @@ -15,10 +15,8 @@ * macOS: does not render LCD-anti-aliased. */ transform: translate3d(0px, 0px, 0px); -} - -.monaco-workbench .part.sidebar > .content { - overflow: hidden; + overflow: visible; + position: relative; } .monaco-workbench.nosidebar > .part.sidebar { diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 54c67324b61..e71467abfc9 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -32,7 +32,7 @@ */ transform: translate3d(0px, 0px, 0px); position: relative; - z-index: 1000; /* move the entire titlebar above the workbench, except modals/dialogs */ + z-index: 1500 !important; /* move the entire titlebar above the workbench, except modals/dialogs */ } .monaco-workbench .part.titlebar > .titlebar-drag-region { From 52de2192507804ec088387bd996d6e6f171c9ef2 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Dec 2019 07:59:09 +0100 Subject: [PATCH 141/637] Fix #86353 --- src/vs/workbench/browser/parts/editor/editorStatus.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 71ac2878d4e..848ff70c8d7 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -851,6 +851,7 @@ class ShowCurrentMarkerInStatusbarContribution extends Disposable { update(editor: ICodeEditor | undefined): void { this.editor = editor; + this.updateMarkers(); this.updateStatus(); } From d2c5d5e1184ca78d051813b17255568158bf8f3a Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Dec 2019 08:13:14 +0100 Subject: [PATCH 142/637] Fix #86292 --- .../electron-browser/media/runtimeExtensionsEditor.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/contrib/extensions/electron-browser/media/runtimeExtensionsEditor.css b/src/vs/workbench/contrib/extensions/electron-browser/media/runtimeExtensionsEditor.css index cedd8541829..47a318e4411 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/media/runtimeExtensionsEditor.css +++ b/src/vs/workbench/contrib/extensions/electron-browser/media/runtimeExtensionsEditor.css @@ -22,6 +22,10 @@ font-weight: bold; } +.runtime-extensions-editor .extension .desc .msg .codicon { + vertical-align: middle; +} + .runtime-extensions-editor .extension .time { padding: 4px; text-align: right; From f3f658369f117d12b0ae6960555b4b2845178fd8 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Dec 2019 09:24:39 +0100 Subject: [PATCH 143/637] fix #86067 --- .../userDataSync/common/keybindingsSync.ts | 25 +++---------------- .../userDataSync/common/settingsSync.ts | 24 +++--------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/src/vs/platform/userDataSync/common/keybindingsSync.ts b/src/vs/platform/userDataSync/common/keybindingsSync.ts index f278643a849..269065cd9a0 100644 --- a/src/vs/platform/userDataSync/common/keybindingsSync.ts +++ b/src/vs/platform/userDataSync/common/keybindingsSync.ts @@ -11,10 +11,10 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { parse, ParseError } from 'vs/base/common/json'; import { localize } from 'vs/nls'; import { Emitter, Event } from 'vs/base/common/event'; -import { CancelablePromise, createCancelablePromise, ThrottledDelayer } from 'vs/base/common/async'; +import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { URI } from 'vs/base/common/uri'; -import { joinPath } from 'vs/base/common/resources'; +import { joinPath, dirname } from 'vs/base/common/resources'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { CancellationToken } from 'vs/base/common/cancellation'; import { OS, OperatingSystem } from 'vs/base/common/platform'; @@ -46,7 +46,6 @@ export class KeybindingsSynchroniser extends Disposable implements ISynchroniser private _onDidChangStatus: Emitter = this._register(new Emitter()); readonly onDidChangeStatus: Event = this._onDidChangStatus.event; - private readonly throttledDelayer: ThrottledDelayer; private _onDidChangeLocal: Emitter = this._register(new Emitter()); readonly onDidChangeLocal: Event = this._onDidChangeLocal.event; @@ -62,24 +61,8 @@ export class KeybindingsSynchroniser extends Disposable implements ISynchroniser ) { super(); this.lastSyncKeybindingsResource = joinPath(this.environmentService.userRoamingDataHome, '.lastSyncKeybindings.json'); - this.throttledDelayer = this._register(new ThrottledDelayer(500)); - this._register(this.fileService.watch(this.environmentService.keybindingsResource)); - this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.environmentService.keybindingsResource))(() => this.throttledDelayer.trigger(() => this.onDidChangeKeybindings()))); - } - - private async onDidChangeKeybindings(): Promise { - const localFileContent = await this.getLocalContent(); - const lastSyncData = await this.getLastSyncUserData(); - if (localFileContent && lastSyncData) { - if (localFileContent.value.toString() !== lastSyncData.content) { - this._onDidChangeLocal.fire(); - return; - } - } - if (!localFileContent || !lastSyncData) { - this._onDidChangeLocal.fire(); - return; - } + this._register(this.fileService.watch(dirname(this.environmentService.keybindingsResource))); + this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.environmentService.keybindingsResource))(() => this._onDidChangeLocal.fire())); } private setStatus(status: SyncStatus): void { diff --git a/src/vs/platform/userDataSync/common/settingsSync.ts b/src/vs/platform/userDataSync/common/settingsSync.ts index ecefa974966..4532f40b9dd 100644 --- a/src/vs/platform/userDataSync/common/settingsSync.ts +++ b/src/vs/platform/userDataSync/common/settingsSync.ts @@ -10,10 +10,10 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { parse, ParseError } from 'vs/base/common/json'; import { localize } from 'vs/nls'; import { Emitter, Event } from 'vs/base/common/event'; -import { CancelablePromise, createCancelablePromise, ThrottledDelayer } from 'vs/base/common/async'; +import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { URI } from 'vs/base/common/uri'; -import { joinPath } from 'vs/base/common/resources'; +import { joinPath, dirname } from 'vs/base/common/resources'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { startsWith } from 'vs/base/common/strings'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -37,7 +37,6 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { private _onDidChangStatus: Emitter = this._register(new Emitter()); readonly onDidChangeStatus: Event = this._onDidChangStatus.event; - private readonly throttledDelayer: ThrottledDelayer; private _onDidChangeLocal: Emitter = this._register(new Emitter()); readonly onDidChangeLocal: Event = this._onDidChangeLocal.event; @@ -53,23 +52,8 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { ) { super(); this.lastSyncSettingsResource = joinPath(this.environmentService.userRoamingDataHome, '.lastSyncSettings.json'); - this.throttledDelayer = this._register(new ThrottledDelayer(500)); - this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.environmentService.settingsResource))(() => this.throttledDelayer.trigger(() => this.onDidChangeSettings()))); - } - - private async onDidChangeSettings(): Promise { - const localFileContent = await this.getLocalFileContent(); - const lastSyncData = await this.getLastSyncUserData(); - if (localFileContent && lastSyncData) { - if (localFileContent.value.toString() !== lastSyncData.content) { - this._onDidChangeLocal.fire(); - return; - } - } - if (!localFileContent || !lastSyncData) { - this._onDidChangeLocal.fire(); - return; - } + this._register(this.fileService.watch(dirname(this.environmentService.settingsResource))); + this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.environmentService.settingsResource))(() => this._onDidChangeLocal.fire())); } private setStatus(status: SyncStatus): void { From 7cbfeb67921a1dd954a4b4f9b3e45479a63cb1cb Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 09:37:22 +0100 Subject: [PATCH 144/637] fixes #86341 --- src/vs/workbench/contrib/debug/browser/callStackView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index f62363e4bec..6f0843b73db 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -505,7 +505,7 @@ class StackFramesRenderer implements ITreeRenderer Date: Thu, 5 Dec 2019 09:58:17 +0100 Subject: [PATCH 145/637] Fix #82567 --- src/vs/platform/files/common/files.ts | 15 ++++++++++++++ src/vs/platform/log/common/fileLogService.ts | 7 +++++-- .../contrib/logs/common/logs.contribution.ts | 3 ++- .../configuration/browser/configuration.ts | 20 +++---------------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 658998bd7c2..83ed4656a1b 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -819,3 +819,18 @@ export function etag(stat: { mtime: number | undefined, size: number | undefined return stat.mtime.toString(29) + stat.size.toString(31); } + + +export function whenProviderRegistered(file: URI, fileService: IFileService): Promise { + if (fileService.canHandleResource(URI.from({ scheme: file.scheme }))) { + return Promise.resolve(); + } + return new Promise((c, e) => { + const disposable = fileService.onDidChangeFileSystemProviderRegistrations(e => { + if (e.scheme === file.scheme && e.added) { + disposable.dispose(); + c(); + } + }); + }); +} diff --git a/src/vs/platform/log/common/fileLogService.ts b/src/vs/platform/log/common/fileLogService.ts index e8bc1ae9005..32493332bc1 100644 --- a/src/vs/platform/log/common/fileLogService.ts +++ b/src/vs/platform/log/common/fileLogService.ts @@ -5,12 +5,13 @@ import { ILogService, LogLevel, AbstractLogService, ILoggerService, ILogger } from 'vs/platform/log/common/log'; import { URI } from 'vs/base/common/uri'; -import { IFileService } from 'vs/platform/files/common/files'; +import { IFileService, whenProviderRegistered } from 'vs/platform/files/common/files'; import { Queue } from 'vs/base/common/async'; import { VSBuffer } from 'vs/base/common/buffer'; import { dirname, joinPath, basename } from 'vs/base/common/resources'; import { Disposable } from 'vs/base/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { BufferLogService } from 'vs/platform/log/common/bufferLog'; const MAX_FILE_SIZE = 1024 * 1024 * 5; @@ -163,6 +164,7 @@ export class FileLoggerService extends Disposable implements ILoggerService { constructor( @ILogService private logService: ILogService, @IInstantiationService private instantiationService: IInstantiationService, + @IFileService private fileService: IFileService, ) { super(); this._register(logService.onDidChangeLogLevel(level => this.loggers.forEach(logger => logger.setLevel(level)))); @@ -171,8 +173,9 @@ export class FileLoggerService extends Disposable implements ILoggerService { getLogger(resource: URI): ILogger { let logger = this.loggers.get(resource.toString()); if (!logger) { - logger = this.instantiationService.createInstance(FileLogService, basename(resource), resource, this.logService.getLevel()); + logger = new BufferLogService, this.logService.getLevel(); this.loggers.set(resource.toString(), logger); + whenProviderRegistered(resource, this.fileService).then(() => (logger).logger = this.instantiationService.createInstance(FileLogService, basename(resource), resource, this.logService.getLevel())); } return logger; } diff --git a/src/vs/workbench/contrib/logs/common/logs.contribution.ts b/src/vs/workbench/contrib/logs/common/logs.contribution.ts index 70a088ed9f8..09b25d44c91 100644 --- a/src/vs/workbench/contrib/logs/common/logs.contribution.ts +++ b/src/vs/workbench/contrib/logs/common/logs.contribution.ts @@ -12,7 +12,7 @@ import { SetLogLevelAction, OpenWindowSessionLogFileAction } from 'vs/workbench/ import * as Constants from 'vs/workbench/contrib/logs/common/logConstants'; import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { IFileService, FileChangeType } from 'vs/platform/files/common/files'; +import { IFileService, FileChangeType, whenProviderRegistered } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/contrib/output/common/output'; import { Disposable } from 'vs/base/common/lifecycle'; @@ -71,6 +71,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution { } private async registerLogChannel(id: string, label: string, file: URI): Promise { + await whenProviderRegistered(file, this.fileService); const outputChannelRegistry = Registry.as(OutputExt.OutputChannels); const exists = await this.fileService.exists(file); if (exists) { diff --git a/src/vs/workbench/services/configuration/browser/configuration.ts b/src/vs/workbench/services/configuration/browser/configuration.ts index d3af9e42aee..d2450a267f7 100644 --- a/src/vs/workbench/services/configuration/browser/configuration.ts +++ b/src/vs/workbench/services/configuration/browser/configuration.ts @@ -9,7 +9,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import * as errors from 'vs/base/common/errors'; import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; import { RunOnceScheduler } from 'vs/base/common/async'; -import { FileChangeType, FileChangesEvent, IFileService } from 'vs/platform/files/common/files'; +import { FileChangeType, FileChangesEvent, IFileService, whenProviderRegistered } from 'vs/platform/files/common/files'; import { ConfigurationModel, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels'; import { WorkspaceConfigurationModelParser, StandaloneConfigurationModelParser } from 'vs/workbench/services/configuration/common/configurationModels'; import { FOLDER_SETTINGS_PATH, TASKS_CONFIGURATION_KEY, FOLDER_SETTINGS_NAME, LAUNCH_CONFIGURATION_KEY, IConfigurationCache, ConfigurationKey, REMOTE_MACHINE_SCOPES, FOLDER_SCOPES, WORKSPACE_SCOPES } from 'vs/workbench/services/configuration/common/configuration'; @@ -24,20 +24,6 @@ import { IConfigurationModel } from 'vs/platform/configuration/common/configurat import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { hash } from 'vs/base/common/hash'; -function whenProviderRegistered(scheme: string, fileService: IFileService): Promise { - if (fileService.canHandleResource(URI.from({ scheme }))) { - return Promise.resolve(); - } - return new Promise((c, e) => { - const disposable = fileService.onDidChangeFileSystemProviderRegistrations(e => { - if (e.scheme === scheme && e.added) { - disposable.dispose(); - c(); - } - }); - }); -} - export class UserConfiguration extends Disposable { private readonly parser: ConfigurationModelParser; @@ -353,7 +339,7 @@ export class WorkspaceConfiguration extends Disposable { } private async waitAndSwitch(workspaceIdentifier: IWorkspaceIdentifier): Promise { - await whenProviderRegistered(workspaceIdentifier.configPath.scheme, this._fileService); + await whenProviderRegistered(workspaceIdentifier.configPath, this._fileService); if (!(this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration)) { const fileServiceBasedWorkspaceConfiguration = this._register(new FileServiceBasedWorkspaceConfiguration(this._fileService)); await fileServiceBasedWorkspaceConfiguration.load(workspaceIdentifier); @@ -750,7 +736,7 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat if (workspaceFolder.uri.scheme === Schemas.file) { this.folderConfiguration = new FileServiceBasedFolderConfiguration(this.configurationFolder, this.workbenchState, fileService); } else { - whenProviderRegistered(workspaceFolder.uri.scheme, fileService) + whenProviderRegistered(workspaceFolder.uri, fileService) .then(() => { this.folderConfiguration.dispose(); this.folderConfigurationDisposable.dispose(); From 8878e56034113032198fac1ba008808f5af2a897 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 5 Dec 2019 10:22:27 +0100 Subject: [PATCH 146/637] Garbled characters when importing multiple folders into the workspace (fix #85870) --- .../textfile/electron-browser/nativeTextFileService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts index 9b748aef08b..7cd4ad05439 100644 --- a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts +++ b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts @@ -350,8 +350,9 @@ export class EncodingOracle extends Disposable implements IResourceEncodings { // Global settings defaultEncodingOverrides.push({ parent: this.environmentService.userRoamingDataHome, encoding: UTF8 }); - // Workspace files + // Workspace files (via extension and via untitled workspaces location) defaultEncodingOverrides.push({ extension: WORKSPACE_EXTENSION, encoding: UTF8 }); + defaultEncodingOverrides.push({ parent: this.environmentService.untitledWorkspacesHome, encoding: UTF8 }); // Folder Settings this.contextService.getWorkspace().folders.forEach(folder => { From 98ccdc7ba4affee8d6382ab3442bc39f9dd0a27b Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 5 Dec 2019 10:35:27 +0100 Subject: [PATCH 147/637] encoding - only allow to detect UTF8 automatically --- src/vs/base/node/encoding.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/vs/base/node/encoding.ts b/src/vs/base/node/encoding.ts index 3fbae109f00..8da85d8ce39 100644 --- a/src/vs/base/node/encoding.ts +++ b/src/vs/base/node/encoding.ts @@ -199,6 +199,13 @@ export function detectEncodingByBOMFromBuffer(buffer: Buffer | VSBuffer | null, return null; } +// we explicitly ignore a specific set of encodings from auto guessing +// - ASCII: we never want this encoding (most UTF-8 files would happily detect as +// ASCII files and then you could not type non-ASCII characters anymore) +// - UTF-16: we have our own detection logic for UTF-16 +// - UTF-32: we do not support this encoding in VSCode +const IGNORE_ENCODINGS = ['ascii', 'utf-16', 'utf-32']; + /** * Guesses the encoding from buffer. */ @@ -210,15 +217,9 @@ async function guessEncodingByBuffer(buffer: Buffer): Promise { return null; } - // Ignore 'ascii' as guessed encoding because that - // is almost never what we want, rather fallback - // to the configured encoding then. Otherwise, - // opening a ascii-only file with auto guessing - // enabled will put the file into 'ascii' mode - // and thus typing any special characters is - // not possible anymore. - if (guessed.encoding.toLowerCase() === 'ascii') { - return null; + const enc = guessed.encoding.toLowerCase(); + if (0 <= IGNORE_ENCODINGS.indexOf(enc)) { + return null; // see comment above why we ignore some encodings } return toIconvLiteEncoding(guessed.encoding); From 7f257cd4fe9ec8e9757491ac0b051912c141bbe9 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 10:12:27 +0100 Subject: [PATCH 148/637] update references view extension, #86305 --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index e2f11ebf0b3..630aa51788e 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -31,7 +31,7 @@ }, { "name": "ms-vscode.references-view", - "version": "0.0.40", + "version": "0.0.41", "repo": "https://github.com/Microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", From 6b2b68207e264a724a9d5db472d8520da0db33b4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 10:43:33 +0100 Subject: [PATCH 149/637] also update peek icons, #86305 --- .../callHierarchy/browser/callHierarchyPeek.ts | 4 ++-- .../browser/media/action-call-from-dark.svg | 3 +++ .../callHierarchy/browser/media/action-call-from.svg | 3 +++ .../browser/media/action-call-to-dark.svg | 3 +++ .../callHierarchy/browser/media/action-call-to.svg | 3 +++ .../callHierarchy/browser/media/callHierarchy.css | 12 ++++++++++-- .../browser/media/files_CallFrom_CallFrom_16x.svg | 1 - .../browser/media/files_CallTo_CallTo_16x.svg | 1 - 8 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from-dark.svg create mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from.svg create mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to-dark.svg create mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to.svg delete mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/files_CallFrom_CallFrom_16x.svg delete mode 100644 src/vs/workbench/contrib/callHierarchy/browser/media/files_CallTo_CallTo_16x.svg diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index 25fe8bade28..bce21ec2671 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -49,10 +49,10 @@ class ChangeHierarchyDirectionAction extends Action { }); const update = () => { if (getDirection() === CallHierarchyDirection.CallsFrom) { - this.label = localize('toggle.from', "Showing Calls"); + this.label = localize('toggle.from', "Show Incoming Calls"); this.class = 'calls-from'; } else { - this.label = localize('toggle.to', "Showing Callers"); + this.label = localize('toggle.to', "Showing Outgoing Calls"); this.class = 'calls-to'; } }; diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from-dark.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from-dark.svg new file mode 100644 index 00000000000..66406bfc5dd --- /dev/null +++ b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from.svg new file mode 100644 index 00000000000..b65e2d14a4d --- /dev/null +++ b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-from.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to-dark.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to-dark.svg new file mode 100644 index 00000000000..ff488f1ed4c --- /dev/null +++ b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to.svg new file mode 100644 index 00000000000..159e5b92eaa --- /dev/null +++ b/src/vs/workbench/contrib/callHierarchy/browser/media/action-call-to.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css b/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css index 19c2e871295..c4e553dbd9f 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css +++ b/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css @@ -21,19 +21,27 @@ } .monaco-workbench .action-label.calls-to { - background-image: url(files_CallTo_CallTo_16x.svg); + background-image: url(action-call-to.svg); background-size: 14px 14px; background-repeat: no-repeat; background-position: left center; } +.vs-dark .monaco-workbench .action-label.calls-to { + background-image: url(action-call-to-dark.svg); +} + .monaco-workbench .action-label.calls-from { - background-image: url(files_CallFrom_CallFrom_16x.svg); + background-image: url(action-call-from.svg); background-size: 14px 14px; background-repeat: no-repeat; background-position: left center; } +.vs-dark .monaco-workbench .action-label.calls-from{ + background-image: url(action-call-from-dark.svg); +} + .monaco-workbench .call-hierarchy .editor, .monaco-workbench .call-hierarchy .tree { height: 100%; diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallFrom_CallFrom_16x.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallFrom_CallFrom_16x.svg deleted file mode 100644 index 667f3e7655b..00000000000 --- a/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallFrom_CallFrom_16x.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallTo_CallTo_16x.svg b/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallTo_CallTo_16x.svg deleted file mode 100644 index 26c436e77c9..00000000000 --- a/src/vs/workbench/contrib/callHierarchy/browser/media/files_CallTo_CallTo_16x.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From ebd9a08e240b2147acf6c6b312fe21a25a0d957b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 10:47:26 +0100 Subject: [PATCH 150/637] update ref view extension, https://github.com/microsoft/vscode/issues/86125 --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 630aa51788e..3303d285507 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -31,7 +31,7 @@ }, { "name": "ms-vscode.references-view", - "version": "0.0.41", + "version": "0.0.42", "repo": "https://github.com/Microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", From b1ed55a74acc5296e3f1efd6068a400173ec0c73 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 10:56:32 +0100 Subject: [PATCH 151/637] fix #86319 --- .../contrib/callHierarchy/browser/callHierarchyPeek.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index bce21ec2671..c85cd79025d 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -428,7 +428,7 @@ export class CallHierarchyTreePeekWidget extends peekView.PeekViewWidget { } protected _doLayoutBody(height: number, width: number): void { - if (this._dim.height !== height || this._dim.width === width) { + if (this._dim.height !== height || this._dim.width !== width) { super._doLayoutBody(height, width); this._dim = { height, width }; this._layoutInfo.height = this._viewZone ? this._viewZone.heightInLines : this._layoutInfo.height; From d7953d0324acb2a2cfdeaead2494658fa218de0a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 11:04:46 +0100 Subject: [PATCH 152/637] fix #86321 --- .../callHierarchy/browser/callHierarchy.contribution.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts index 4f5199b62ed..55b2be2978c 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts @@ -24,7 +24,7 @@ import { Range } from 'vs/editor/common/core/range'; import { IPosition } from 'vs/editor/common/core/position'; import { MenuId } from 'vs/platform/actions/common/actions'; -const _ctxHasCompletionItemProvider = new RawContextKey('editorHasCallHierarchyProvider', false); +const _ctxHasCallHierarchyProvider = new RawContextKey('editorHasCallHierarchyProvider', false); const _ctxCallHierarchyVisible = new RawContextKey('callHierarchyVisible', false); class CallHierarchyController implements IEditorContribution { @@ -52,7 +52,7 @@ class CallHierarchyController implements IEditorContribution { @IInstantiationService private readonly _instantiationService: IInstantiationService, ) { this._ctxIsVisible = _ctxCallHierarchyVisible.bindTo(this._contextKeyService); - this._ctxHasProvider = _ctxHasCompletionItemProvider.bindTo(this._contextKeyService); + this._ctxHasProvider = _ctxHasCallHierarchyProvider.bindTo(this._contextKeyService); this._dispoables.add(Event.any(_editor.onDidChangeModel, _editor.onDidChangeModelLanguage, CallHierarchyProviderRegistry.onDidChange)(() => { this._ctxHasProvider.set(_editor.hasModel() && CallHierarchyProviderRegistry.has(_editor.getModel())); })); @@ -172,8 +172,7 @@ registerEditorAction(class extends EditorAction { primary: KeyMod.Shift + KeyMod.Alt + KeyCode.KEY_H }, precondition: ContextKeyExpr.and( - _ctxCallHierarchyVisible.negate(), - _ctxHasCompletionItemProvider, + _ctxHasCallHierarchyProvider, PeekContext.notInPeekEditor ) }); From eeee6244d9b2277126b8c758df9f9fe4eb30e1bc Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 5 Dec 2019 11:15:33 +0100 Subject: [PATCH 153/637] [josn] fix wrong schema-schema reference, use draft-07 everywhere --- .../configuration-editing/schemas/attachContainer.schema.json | 2 +- .../configuration-editing/schemas/devContainer.schema.json | 2 +- extensions/css-language-features/schemas/package.schema.json | 2 +- extensions/html-language-features/schemas/package.schema.json | 2 +- .../markdown-language-features/schemas/package.schema.json | 4 ++-- .../typescript-language-features/schemas/package.schema.json | 4 ++-- .../workbench/contrib/tasks/common/taskDefinitionRegistry.ts | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/extensions/configuration-editing/schemas/attachContainer.schema.json b/extensions/configuration-editing/schemas/attachContainer.schema.json index 65f79624518..cebd0f2bc3e 100644 --- a/extensions/configuration-editing/schemas/attachContainer.schema.json +++ b/extensions/configuration-editing/schemas/attachContainer.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "description": "Configures an attached to container", "allowComments": true, "type": "object", diff --git a/extensions/configuration-editing/schemas/devContainer.schema.json b/extensions/configuration-editing/schemas/devContainer.schema.json index 710c2a26c60..aed58455d01 100644 --- a/extensions/configuration-editing/schemas/devContainer.schema.json +++ b/extensions/configuration-editing/schemas/devContainer.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "description": "Defines a dev container", "allowComments": true, "type": "object", diff --git a/extensions/css-language-features/schemas/package.schema.json b/extensions/css-language-features/schemas/package.schema.json index 3aeca1e040a..cf4193008ec 100644 --- a/extensions/css-language-features/schemas/package.schema.json +++ b/extensions/css-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "CSS contributions to package.json", "type": "object", "properties": { diff --git a/extensions/html-language-features/schemas/package.schema.json b/extensions/html-language-features/schemas/package.schema.json index aaf9588221e..a11810ef090 100644 --- a/extensions/html-language-features/schemas/package.schema.json +++ b/extensions/html-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "HTML contributions to package.json", "type": "object", "properties": { diff --git a/extensions/markdown-language-features/schemas/package.schema.json b/extensions/markdown-language-features/schemas/package.schema.json index e76ce046c27..5591d0b0032 100644 --- a/extensions/markdown-language-features/schemas/package.schema.json +++ b/extensions/markdown-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "Markdown contributions to package.json", "type": "object", "properties": { @@ -29,4 +29,4 @@ } } } -} \ No newline at end of file +} diff --git a/extensions/typescript-language-features/schemas/package.schema.json b/extensions/typescript-language-features/schemas/package.schema.json index c26af63c93b..c135ea39ec1 100644 --- a/extensions/typescript-language-features/schemas/package.schema.json +++ b/extensions/typescript-language-features/schemas/package.schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "title": "TypeScript contributions to package.json", "type": "object", "properties": { @@ -28,4 +28,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts b/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts index 6a696c1666a..1526a62d12b 100644 --- a/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts +++ b/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.ts @@ -33,7 +33,7 @@ const taskDefinitionSchema: IJSONSchema = { type: 'object', description: nls.localize('TaskDefinition.properties', 'Additional properties of the task type'), additionalProperties: { - $ref: 'http://json-schema.org/draft-04/schema#' + $ref: 'http://json-schema.org/draft-07/schema#' } } } From 64b177b2e0bc2360db1aa2c1eb8b87a511c844f1 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 5 Dec 2019 11:22:40 +0100 Subject: [PATCH 154/637] fix #86300 --- src/vs/workbench/api/common/extHostLanguageFeatures.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 3aa55dc26da..76a9b14643b 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -1209,11 +1209,10 @@ class CallHierarchyAdapter { } releaseSession(sessionId: string): void { - this._cache.delete(sessionId.charAt(0)); + this._cache.delete(sessionId); } - private _cacheAndConvertItem(itemOrSessionId: string, item: vscode.CallHierarchyItem): extHostProtocol.ICallHierarchyItemDto { - const sessionId = itemOrSessionId.charAt(0); + private _cacheAndConvertItem(sessionId: string, item: vscode.CallHierarchyItem): extHostProtocol.ICallHierarchyItemDto { const map = this._cache.get(sessionId)!; const dto: extHostProtocol.ICallHierarchyItemDto = { _sessionId: sessionId, @@ -1231,7 +1230,7 @@ class CallHierarchyAdapter { private _itemFromCache(sessionId: string, itemId: string): vscode.CallHierarchyItem | undefined { const map = this._cache.get(sessionId); - return map && map.get(itemId); + return map?.get(itemId); } } From 29f4c535cbbc952ba69e954b4ccc4dbfb21bbc06 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 5 Dec 2019 11:49:07 +0100 Subject: [PATCH 155/637] Fixes #86303: Fix adjusting of tokens after the deleted range --- src/vs/editor/common/model/tokensStore.ts | 9 +- .../test/common/model/tokensStore.test.ts | 119 ++++++++++++++++++ 2 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 src/vs/editor/test/common/model/tokensStore.test.ts diff --git a/src/vs/editor/common/model/tokensStore.ts b/src/vs/editor/common/model/tokensStore.ts index aa6953853ca..1df7dcdfb06 100644 --- a/src/vs/editor/common/model/tokensStore.ts +++ b/src/vs/editor/common/model/tokensStore.ts @@ -293,8 +293,13 @@ export class SparseEncodedTokens implements IEncodedTokens { } else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) { // 4. (continued) The token starts after the deletion range, on the last line where a deletion occurs tokenDeltaLine -= deletedLineCount; - tokenStartCharacter -= endCharacter; - tokenEndCharacter -= endCharacter; + if (deletedLineCount === 0) { + tokenStartCharacter -= (endCharacter - startCharacter); + tokenEndCharacter -= (endCharacter - startCharacter); + } else { + tokenStartCharacter -= endCharacter; + tokenEndCharacter -= endCharacter; + } } else { throw new Error(`Not possible!`); } diff --git a/src/vs/editor/test/common/model/tokensStore.test.ts b/src/vs/editor/test/common/model/tokensStore.test.ts new file mode 100644 index 00000000000..a7405ea9ab6 --- /dev/null +++ b/src/vs/editor/test/common/model/tokensStore.test.ts @@ -0,0 +1,119 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { MultilineTokens2, SparseEncodedTokens } from 'vs/editor/common/model/tokensStore'; +import { Range } from 'vs/editor/common/core/range'; +import { TextModel } from 'vs/editor/common/model/textModel'; +import { IIdentifiedSingleEditOperation } from 'vs/editor/common/model'; +import { MetadataConsts, TokenMetadata } from 'vs/editor/common/modes'; + +suite('TokensStore', () => { + + const SEMANTIC_COLOR = 5; + + function parseTokensState(state: string[]): { text: string; tokens: number[]; } { + let text: string[] = []; + let tokens: number[] = []; + for (let i = 0; i < state.length; i++) { + const line = state[i]; + + let startOffset = 0; + let lineText = ''; + while (true) { + const firstPipeOffset = line.indexOf('|', startOffset); + if (firstPipeOffset === -1) { + break; + } + const secondPipeOffset = line.indexOf('|', firstPipeOffset + 1); + if (secondPipeOffset === -1) { + break; + } + if (firstPipeOffset + 1 === secondPipeOffset) { + // skip || + lineText += line.substring(startOffset, secondPipeOffset + 1); + startOffset = secondPipeOffset + 1; + continue; + } + + lineText += line.substring(startOffset, firstPipeOffset); + const tokenStartCharacter = lineText.length; + const tokenLength = secondPipeOffset - firstPipeOffset - 1; + const metadata = (SEMANTIC_COLOR << MetadataConsts.FOREGROUND_OFFSET); + + tokens.push(i, tokenStartCharacter, tokenStartCharacter + tokenLength, metadata); + + lineText += line.substr(firstPipeOffset + 1, tokenLength); + startOffset = secondPipeOffset + 1; + } + + lineText += line.substring(startOffset); + + text.push(lineText); + } + + return { + text: text.join('\n'), + tokens: tokens + }; + } + + function extractState(model: TextModel): string[] { + let result: string[] = []; + for (let lineNumber = 1; lineNumber <= model.getLineCount(); lineNumber++) { + const lineTokens = model.getLineTokens(lineNumber); + const lineContent = model.getLineContent(lineNumber); + + let lineText = ''; + for (let i = 0; i < lineTokens.getCount(); i++) { + const tokenStartCharacter = lineTokens.getStartOffset(i); + const tokenEndCharacter = lineTokens.getEndOffset(i); + const metadata = lineTokens.getMetadata(i); + const color = TokenMetadata.getForeground(metadata); + const tokenText = lineContent.substring(tokenStartCharacter, tokenEndCharacter); + if (color === SEMANTIC_COLOR) { + lineText += `|${tokenText}|`; + } else { + lineText += tokenText; + } + } + + result.push(lineText); + } + return result; + } + + // function extractState + + function testTokensAdjustment(rawInitialState: string[], edits: IIdentifiedSingleEditOperation[], rawFinalState: string[]) { + const initialState = parseTokensState(rawInitialState); + const model = TextModel.createFromString(initialState.text); + model.setSemanticTokens([new MultilineTokens2(1, new SparseEncodedTokens(new Uint32Array(initialState.tokens)))]); + + model.applyEdits(edits); + + const actualState = extractState(model); + assert.deepEqual(actualState, rawFinalState); + + model.dispose(); + } + + test('issue #86303 - color shifting between different tokens', () => { + testTokensAdjustment( + [ + `import { |URI| } from 'vs/base/common/uri';`, + `const foo = |URI|.parse('hey');` + ], + [ + { range: new Range(2, 9, 2, 10), text: '' } + ], + [ + `import { |URI| } from 'vs/base/common/uri';`, + `const fo = |URI|.parse('hey');` + ] + ); + }); + +}); From 02d075ece2a5cbf2c0e3c2bfd6483985c19c23f1 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Dec 2019 12:29:29 +0100 Subject: [PATCH 156/637] Fix #85054 --- .../platform/userDataSync/common/extensionsSync.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index 502384a6731..2cbf0acd173 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -18,6 +18,7 @@ import { startsWith } from 'vs/base/common/strings'; import { IFileService } from 'vs/platform/files/common/files'; import { Queue } from 'vs/base/common/async'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { localize } from 'vs/nls'; export interface ISyncPreviewResult { readonly added: ISyncExtension[]; @@ -323,7 +324,12 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser const extension = await this.extensionGalleryService.getCompatibleExtension(e.identifier, e.version); if (extension) { this.logService.info('Extensions: Installing local extension.', e.identifier.id, extension.version); - await this.extensionManagementService.installFromGallery(extension); + try { + await this.extensionManagementService.installFromGallery(extension); + } catch (e) { + this.logService.error(e); + this.logService.info(localize('skip extension', "Skipping synchronising extension {0}", extension.displayName || extension.identifier.id)); + } } })); } @@ -331,7 +337,9 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser private async getLocalExtensions(): Promise { const installedExtensions = await this.extensionManagementService.getInstalled(ExtensionType.User); - return installedExtensions.map(({ identifier }) => ({ identifier, enabled: true })); + return installedExtensions + .filter(({ identifier }) => !!identifier.uuid) + .map(({ identifier }) => ({ identifier, enabled: true })); } private async getLastSyncUserData(): Promise { From e39717bd97d79289e4960d6df35a26111b4defac Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 5 Dec 2019 12:33:50 +0100 Subject: [PATCH 157/637] Target type in remote explorer help when dropdown doesn't match connection Fixes https://github.com/microsoft/vscode/issues/86328 --- .../contrib/remote/browser/remote.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 70ab4f4fc52..f8995407609 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -72,7 +72,8 @@ class HelpModel { })), quickInputService, environmentService, - openerService + openerService, + remoteExplorerService )); } @@ -89,7 +90,8 @@ class HelpModel { })), quickInputService, environmentService, - openerService + openerService, + remoteExplorerService )); } @@ -106,7 +108,8 @@ class HelpModel { })), quickInputService, environmentService, - openerService + openerService, + remoteExplorerService )); } @@ -123,7 +126,8 @@ class HelpModel { })), quickInputService, environmentService, - openerService + openerService, + remoteExplorerService )); } @@ -137,7 +141,8 @@ class HelpModel { })), quickInputService, environmentService, - commandService + commandService, + remoteExplorerService )); } @@ -158,14 +163,15 @@ abstract class HelpItemBase implements IHelpItem { public label: string, public values: { extensionDescription: IExtensionDescription, url?: string, remoteAuthority: string[] | undefined }[], private quickInputService: IQuickInputService, - private environmentService: IWorkbenchEnvironmentService + private environmentService: IWorkbenchEnvironmentService, + private remoteExplorerService: IRemoteExplorerService ) { iconClasses.push('remote-help-tree-node-item-icon'); } async handleClick() { const remoteAuthority = this.environmentService.configuration.remoteAuthority; - if (remoteAuthority) { + if (remoteAuthority && startsWith(remoteAuthority, this.remoteExplorerService.targetType)) { for (let value of this.values) { if (value.remoteAuthority) { for (let authority of value.remoteAuthority) { @@ -207,9 +213,10 @@ class HelpItem extends HelpItemBase { values: { extensionDescription: IExtensionDescription; url: string, remoteAuthority: string[] | undefined }[], quickInputService: IQuickInputService, environmentService: IWorkbenchEnvironmentService, - private openerService: IOpenerService + private openerService: IOpenerService, + remoteExplorerService: IRemoteExplorerService ) { - super(iconClasses, label, values, quickInputService, environmentService); + super(iconClasses, label, values, quickInputService, environmentService, remoteExplorerService); } protected async takeAction(extensionDescription: IExtensionDescription, url: string): Promise { @@ -225,8 +232,9 @@ class IssueReporterItem extends HelpItemBase { quickInputService: IQuickInputService, environmentService: IWorkbenchEnvironmentService, private commandService: ICommandService, + remoteExplorerService: IRemoteExplorerService ) { - super(iconClasses, label, values, quickInputService, environmentService); + super(iconClasses, label, values, quickInputService, environmentService, remoteExplorerService); } protected async takeAction(extensionDescription: IExtensionDescription): Promise { From 150f3b5c935174af0d7da80b13d51bbcdbd610d2 Mon Sep 17 00:00:00 2001 From: gjsjohnmurray Date: Thu, 5 Dec 2019 12:27:10 +0000 Subject: [PATCH 158/637] Change as suggested by @isidorn --- src/vs/workbench/contrib/debug/common/debugModel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 5fe71b870c4..e52542fd125 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -122,7 +122,7 @@ export class ExpressionContainer implements IExpressionContainer { new Variable(this.session, this.threadId, this, v.variablesReference, v.name, v.evaluateName, v.value, v.namedVariables, v.indexedVariables, v.presentationHint, v.type)) : []; } catch (e) { - return [new Variable(this.session, this.threadId, this, 0, e.message, e.message, '', 0, 0, { kind: 'virtual' }, undefined, true)]; + return [new Variable(this.session, this.threadId, this, 0, '', undefined, e.message, 0, 0, { kind: 'virtual' }, undefined, false)]; } } From 2936133e67aded3c483167cfddfb07715fef97cf Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 13:34:58 +0100 Subject: [PATCH 159/637] Ignore stats which are selected but are part of the same compact node as the focused stat fixes #86388 --- src/vs/workbench/contrib/files/browser/views/explorerView.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index f09b093513a..956a7d9fd52 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -297,6 +297,11 @@ export class ExplorerView extends ViewletPane { for (const stat of this.tree.getSelection()) { const controller = this.renderer.getCompressedNavigationController(stat); + if (controller && focusedStat && controller === this.compressedNavigationController && stat !== focusedStat) { + // Ignore stats which are selected but are part of the same compact node as the focused stat + continue; + } + if (controller) { selectedStats.push(...controller.items); } else { From 937c637e04959c80f6f95bef5fb812c6e337041c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Dec 2019 13:41:28 +0100 Subject: [PATCH 160/637] Proper fix for #85054 --- .../userDataSync/common/extensionsSync.ts | 67 +++++++++++++------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index 2cbf0acd173..2a0a9d7d603 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -27,6 +27,10 @@ export interface ISyncPreviewResult { readonly remote: ISyncExtension[] | null; } +interface ILastSyncUserData extends IUserData { + skippedExtensions: ISyncExtension[] | undefined; +} + export class ExtensionsSynchroniser extends Disposable implements ISynchroniser { private static EXTERNAL_USER_DATA_EXTENSIONS_KEY: string = 'extensions'; @@ -123,14 +127,16 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser private async doSync(): Promise { const lastSyncData = await this.getLastSyncUserData(); - let remoteData = await this.userDataSyncStoreService.read(ExtensionsSynchroniser.EXTERNAL_USER_DATA_EXTENSIONS_KEY, lastSyncData); + const lastSyncExtensions: ISyncExtension[] | null = lastSyncData ? JSON.parse(lastSyncData.content!) : null; + let skippedExtensions: ISyncExtension[] = lastSyncData ? lastSyncData.skippedExtensions || [] : []; - const lastSyncExtensions: ISyncExtension[] = lastSyncData ? JSON.parse(lastSyncData.content!) : null; + let remoteData = await this.userDataSyncStoreService.read(ExtensionsSynchroniser.EXTERNAL_USER_DATA_EXTENSIONS_KEY, lastSyncData); const remoteExtensions: ISyncExtension[] = remoteData.content ? JSON.parse(remoteData.content) : null; + const localExtensions = await this.getLocalExtensions(); this.logService.trace('Extensions: Merging remote extensions with local extensions...'); - const { added, removed, updated, remote } = this.merge(localExtensions, remoteExtensions, lastSyncExtensions); + const { added, removed, updated, remote } = this.merge(localExtensions, remoteExtensions, lastSyncExtensions, skippedExtensions); if (!added.length && !removed.length && !updated.length && !remote) { this.logService.trace('Extensions: No changes found during synchronizing extensions.'); @@ -138,7 +144,7 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser if (added.length || removed.length || updated.length) { this.logService.info('Extensions: Updating local extensions...'); - await this.updateLocalExtensions(added, removed, updated); + skippedExtensions = await this.updateLocalExtensions(added, removed, updated, skippedExtensions); } if (remote) { @@ -152,7 +158,7 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser ) { // update last sync this.logService.info('Extensions: Updating last synchronised extensions...'); - await this.updateLastSyncValue(remoteData); + await this.updateLastSyncValue({ ...remoteData, skippedExtensions }); } } @@ -162,7 +168,7 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser * - Overwrite local with remote changes. Removed, Added, Updated. * - Update remote with those local extension which are newly added or updated or removed and untouched in remote. */ - private merge(localExtensions: ISyncExtension[], remoteExtensions: ISyncExtension[] | null, lastSyncExtensions: ISyncExtension[] | null): { added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[], remote: ISyncExtension[] | null } { + private merge(localExtensions: ISyncExtension[], remoteExtensions: ISyncExtension[] | null, lastSyncExtensions: ISyncExtension[] | null, skippedExtensions: ISyncExtension[]): { added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[], remote: ISyncExtension[] | null } { const ignoredExtensions = this.configurationService.getValue('sync.ignoredExtensions') || []; // First time sync if (!remoteExtensions) { @@ -188,6 +194,7 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser const remoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); const newRemoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); const lastSyncExtensionsMap = lastSyncExtensions ? lastSyncExtensions.reduce(addExtensionToMap, new Map()) : null; + const skippedExtensionsMap = skippedExtensions.reduce(addExtensionToMap, new Map()); const ignoredExtensionsSet = ignoredExtensions.reduce((set, id) => { const uuid = uuids.get(id.toLowerCase()); return set.add(uuid ? `uuid:${uuid}` : `id:${id.toLowerCase()}`); @@ -274,8 +281,8 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser // Locally removed extensions for (const key of values(baseToLocal.removed)) { - // If not updated in remote - if (!baseToRemote.updated.has(key)) { + // If not skipped and not updated in remote + if (!skippedExtensionsMap.has(key) && !baseToRemote.updated.has(key)) { newRemoteExtensionsMap.delete(key); } } @@ -309,13 +316,17 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser return { added, removed, updated }; } - private async updateLocalExtensions(added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[]): Promise { + private async updateLocalExtensions(added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[], skippedExtensions: ISyncExtension[]): Promise { + const removeFromSkipped: IExtensionIdentifier[] = []; + const addToSkipped: ISyncExtension[] = []; + if (removed.length) { const installedExtensions = await this.extensionManagementService.getInstalled(ExtensionType.User); const extensionsToRemove = installedExtensions.filter(({ identifier }) => removed.some(r => areSameExtensions(identifier, r))); - await Promise.all(extensionsToRemove.map(e => { - this.logService.info('Extensions: Removing local extension.', e.identifier.id); - return this.extensionManagementService.uninstall(e); + await Promise.all(extensionsToRemove.map(async extensionToRemove => { + this.logService.info('Extensions: Removing local extension.', extensionToRemove.identifier.id); + await this.extensionManagementService.uninstall(extensionToRemove); + removeFromSkipped.push(extensionToRemove.identifier); })); } @@ -326,23 +337,39 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser this.logService.info('Extensions: Installing local extension.', e.identifier.id, extension.version); try { await this.extensionManagementService.installFromGallery(extension); - } catch (e) { - this.logService.error(e); + removeFromSkipped.push(extension.identifier); + } catch (error) { + addToSkipped.push(e); + this.logService.error(error); this.logService.info(localize('skip extension', "Skipping synchronising extension {0}", extension.displayName || extension.identifier.id)); } + } else { + addToSkipped.push(e); } })); } + + const newSkippedExtensions: ISyncExtension[] = []; + for (const skippedExtension of skippedExtensions) { + if (!removeFromSkipped.some(e => areSameExtensions(e, skippedExtension.identifier))) { + newSkippedExtensions.push(skippedExtension); + } + } + for (const skippedExtension of addToSkipped) { + if (!newSkippedExtensions.some(e => areSameExtensions(e.identifier, skippedExtension.identifier))) { + newSkippedExtensions.push(skippedExtension); + } + } + return newSkippedExtensions; } private async getLocalExtensions(): Promise { const installedExtensions = await this.extensionManagementService.getInstalled(ExtensionType.User); return installedExtensions - .filter(({ identifier }) => !!identifier.uuid) .map(({ identifier }) => ({ identifier, enabled: true })); } - private async getLastSyncUserData(): Promise { + private async getLastSyncUserData(): Promise { try { const content = await this.fileService.readFile(this.lastSyncExtensionsResource); return JSON.parse(content.value.toString()); @@ -351,14 +378,14 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser } } + private async updateLastSyncValue(lastSyncUserData: ILastSyncUserData): Promise { + await this.fileService.writeFile(this.lastSyncExtensionsResource, VSBuffer.fromString(JSON.stringify(lastSyncUserData))); + } + private async writeToRemote(extensions: ISyncExtension[], ref: string | null): Promise { const content = JSON.stringify(extensions); ref = await this.userDataSyncStoreService.write(ExtensionsSynchroniser.EXTERNAL_USER_DATA_EXTENSIONS_KEY, content, ref); return { content, ref }; } - private async updateLastSyncValue(remoteUserData: IUserData): Promise { - await this.fileService.writeFile(this.lastSyncExtensionsResource, VSBuffer.fromString(JSON.stringify(remoteUserData))); - } - } From 0fae04b8a263cc5b8e8ec4c6a286bb57ae39d6c0 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 14:21:50 +0100 Subject: [PATCH 161/637] fixes #78384 --- test/automation/src/debug.ts | 2 +- test/smoke/src/areas/debug/debug.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/automation/src/debug.ts b/test/automation/src/debug.ts index 4739d8a9917..b4ea77a8f78 100644 --- a/test/automation/src/debug.ts +++ b/test/automation/src/debug.ts @@ -11,7 +11,7 @@ import { Editor } from './editor'; import { IElement } from '../src/driver'; const VIEWLET = 'div[id="workbench.view.debug"]'; -const DEBUG_VIEW = `${VIEWLET} .debug-view-content`; +const DEBUG_VIEW = `${VIEWLET}`; const CONFIGURE = `div[id="workbench.parts.sidebar"] .actions-container .codicon-gear`; const STOP = `.debug-toolbar .action-label[title*="Stop"]`; const STEP_OVER = `.debug-toolbar .action-label[title*="Step Over"]`; diff --git a/test/smoke/src/areas/debug/debug.test.ts b/test/smoke/src/areas/debug/debug.test.ts index 429fc7852d2..ee19ff9fd16 100644 --- a/test/smoke/src/areas/debug/debug.test.ts +++ b/test/smoke/src/areas/debug/debug.test.ts @@ -17,7 +17,7 @@ export function setup() { await app.workbench.debug.openDebugViewlet(); await app.workbench.quickopen.openFile('app.js'); - await app.workbench.debug.configure(); + await app.workbench.quickopen.runCommand('Debug: Open launch.json'); const launchJsonPath = path.join(app.workspacePathOrFolder, '.vscode', 'launch.json'); const content = fs.readFileSync(launchJsonPath, 'utf8'); From e038d4a6f93e676caca277d1c5a2b6752b59aac4 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 5 Dec 2019 14:50:31 +0100 Subject: [PATCH 162/637] More fixes to tokens adjusting --- src/vs/editor/common/model/tokensStore.ts | 25 ++++---- .../test/common/model/tokensStore.test.ts | 57 +++++++++++++++++-- 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/src/vs/editor/common/model/tokensStore.ts b/src/vs/editor/common/model/tokensStore.ts index 1df7dcdfb06..359c755e057 100644 --- a/src/vs/editor/common/model/tokensStore.ts +++ b/src/vs/editor/common/model/tokensStore.ts @@ -121,7 +121,7 @@ export interface IEncodedTokens { getMetadata(tokenIndex: number): number; clear(): void; - acceptDeleteRange(startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void; + acceptDeleteRange(horizontalShiftForFirstLineTokens: number, startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void; acceptInsertText(deltaLine: number, character: number, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void; } @@ -173,7 +173,7 @@ export class SparseEncodedTokens implements IEncodedTokens { this._tokenCount = 0; } - public acceptDeleteRange(startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void { + public acceptDeleteRange(horizontalShiftForFirstLineTokens: number, startDeltaLine: number, startCharacter: number, endDeltaLine: number, endCharacter: number): void { // This is a bit complex, here are the cases I used to think about this: // // 1. The token starts before the deletion range @@ -292,14 +292,13 @@ export class SparseEncodedTokens implements IEncodedTokens { tokenDeltaLine -= deletedLineCount; } else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) { // 4. (continued) The token starts after the deletion range, on the last line where a deletion occurs - tokenDeltaLine -= deletedLineCount; - if (deletedLineCount === 0) { - tokenStartCharacter -= (endCharacter - startCharacter); - tokenEndCharacter -= (endCharacter - startCharacter); - } else { - tokenStartCharacter -= endCharacter; - tokenEndCharacter -= endCharacter; + if (horizontalShiftForFirstLineTokens && tokenDeltaLine === 0) { + tokenStartCharacter += horizontalShiftForFirstLineTokens; + tokenEndCharacter += horizontalShiftForFirstLineTokens; } + tokenDeltaLine -= deletedLineCount; + tokenStartCharacter -= (endCharacter - startCharacter); + tokenEndCharacter -= (endCharacter - startCharacter); } else { throw new Error(`Not possible!`); } @@ -378,8 +377,8 @@ export class SparseEncodedTokens implements IEncodedTokens { } } // => the token must move and keep its size constant - tokenDeltaLine += eolCount; if (tokenDeltaLine === deltaLine) { + tokenDeltaLine += eolCount; // this token is on the line where the insertion is taking place if (eolCount === 0) { tokenStartCharacter += firstLineLength; @@ -389,6 +388,8 @@ export class SparseEncodedTokens implements IEncodedTokens { tokenStartCharacter = lastLineLength + (tokenStartCharacter - character); tokenEndCharacter = tokenStartCharacter + tokenLength; } + } else { + tokenDeltaLine += eolCount; } } @@ -532,9 +533,9 @@ export class MultilineTokens2 { const deletedBefore = -firstLineIndex; this.startLineNumber -= deletedBefore; - this.tokens.acceptDeleteRange(0, 0, lastLineIndex, range.endColumn - 1); + this.tokens.acceptDeleteRange(range.startColumn - 1, 0, 0, lastLineIndex, range.endColumn - 1); } else { - this.tokens.acceptDeleteRange(firstLineIndex, range.startColumn - 1, lastLineIndex, range.endColumn - 1); + this.tokens.acceptDeleteRange(0, firstLineIndex, range.startColumn - 1, lastLineIndex, range.endColumn - 1); } } diff --git a/src/vs/editor/test/common/model/tokensStore.test.ts b/src/vs/editor/test/common/model/tokensStore.test.ts index a7405ea9ab6..4413caeebc6 100644 --- a/src/vs/editor/test/common/model/tokensStore.test.ts +++ b/src/vs/editor/test/common/model/tokensStore.test.ts @@ -14,9 +14,10 @@ suite('TokensStore', () => { const SEMANTIC_COLOR = 5; - function parseTokensState(state: string[]): { text: string; tokens: number[]; } { + function parseTokensState(state: string[]): { text: string; tokens: MultilineTokens2; } { let text: string[] = []; let tokens: number[] = []; + let baseLine = 1; for (let i = 0; i < state.length; i++) { const line = state[i]; @@ -43,7 +44,10 @@ suite('TokensStore', () => { const tokenLength = secondPipeOffset - firstPipeOffset - 1; const metadata = (SEMANTIC_COLOR << MetadataConsts.FOREGROUND_OFFSET); - tokens.push(i, tokenStartCharacter, tokenStartCharacter + tokenLength, metadata); + if (tokens.length === 0) { + baseLine = i + 1; + } + tokens.push(i + 1 - baseLine, tokenStartCharacter, tokenStartCharacter + tokenLength, metadata); lineText += line.substr(firstPipeOffset + 1, tokenLength); startOffset = secondPipeOffset + 1; @@ -56,7 +60,7 @@ suite('TokensStore', () => { return { text: text.join('\n'), - tokens: tokens + tokens: new MultilineTokens2(baseLine, new SparseEncodedTokens(new Uint32Array(tokens))) }; } @@ -90,7 +94,7 @@ suite('TokensStore', () => { function testTokensAdjustment(rawInitialState: string[], edits: IIdentifiedSingleEditOperation[], rawFinalState: string[]) { const initialState = parseTokensState(rawInitialState); const model = TextModel.createFromString(initialState.text); - model.setSemanticTokens([new MultilineTokens2(1, new SparseEncodedTokens(new Uint32Array(initialState.tokens)))]); + model.setSemanticTokens([initialState.tokens]); model.applyEdits(edits); @@ -116,4 +120,49 @@ suite('TokensStore', () => { ); }); + test('deleting a newline', () => { + testTokensAdjustment( + [ + `import { |URI| } from 'vs/base/common/uri';`, + `const foo = |URI|.parse('hey');` + ], + [ + { range: new Range(1, 42, 2, 1), text: '' } + ], + [ + `import { |URI| } from 'vs/base/common/uri';const foo = |URI|.parse('hey');` + ] + ); + }); + + test('inserting a newline', () => { + testTokensAdjustment( + [ + `import { |URI| } from 'vs/base/common/uri';const foo = |URI|.parse('hey');` + ], + [ + { range: new Range(1, 42, 1, 42), text: '\n' } + ], + [ + `import { |URI| } from 'vs/base/common/uri';`, + `const foo = |URI|.parse('hey');` + ] + ); + }); + + test('deleting a newline 2', () => { + testTokensAdjustment( + [ + `import { `, + ` |URI| } from 'vs/base/common/uri';const foo = |URI|.parse('hey');` + ], + [ + { range: new Range(1, 10, 2, 5), text: '' } + ], + [ + `import { |URI| } from 'vs/base/common/uri';const foo = |URI|.parse('hey');` + ] + ); + }); + }); From 508950311e95263e2c48c0d52ef2bd5c8b74506c Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 5 Dec 2019 15:28:16 +0100 Subject: [PATCH 163/637] Fixes #83150: Handle case where the mouse is hitting the textarea when the textarea is rendered at the cursor --- .../editor/browser/controller/mouseHandler.ts | 13 ++++------ .../editor/browser/controller/mouseTarget.ts | 26 +++++++++++++------ .../browser/controller/textAreaHandler.ts | 23 +++++++++++++--- src/vs/editor/browser/view/viewImpl.ts | 7 +++-- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/vs/editor/browser/controller/mouseHandler.ts b/src/vs/editor/browser/controller/mouseHandler.ts index d235e6ba791..6b5b7d372c7 100644 --- a/src/vs/editor/browser/controller/mouseHandler.ts +++ b/src/vs/editor/browser/controller/mouseHandler.ts @@ -9,11 +9,10 @@ import { StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent import { RunOnceScheduler, TimeoutTimer } from 'vs/base/common/async'; import { Disposable } from 'vs/base/common/lifecycle'; import * as platform from 'vs/base/common/platform'; -import { HitTestContext, IViewZoneData, MouseTarget, MouseTargetFactory } from 'vs/editor/browser/controller/mouseTarget'; +import { HitTestContext, IViewZoneData, MouseTarget, MouseTargetFactory, PointerHandlerLastRenderData } from 'vs/editor/browser/controller/mouseTarget'; import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import { ClientCoordinates, EditorMouseEvent, EditorMouseEventFactory, GlobalEditorMouseMoveMonitor, createEditorPagePosition } from 'vs/editor/browser/editorDom'; import { ViewController } from 'vs/editor/browser/view/viewController'; -import { IViewCursorRenderData } from 'vs/editor/browser/viewParts/viewCursors/viewCursor'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; import { Position } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; @@ -46,9 +45,9 @@ export interface IPointerHandlerHelper { focusTextArea(): void; /** - * Get the last rendered information of the cursors. + * Get the last rendered information for cursors & textarea. */ - getLastViewCursorsRenderData(): IViewCursorRenderData[]; + getLastRenderData(): PointerHandlerLastRenderData; shouldSuppressMouseDownOnViewZone(viewZoneId: string): boolean; shouldSuppressMouseDownOnWidget(widgetId: string): boolean; @@ -158,13 +157,11 @@ export class MouseHandler extends ViewEventHandler { return null; } - const lastViewCursorsRenderData = this.viewHelper.getLastViewCursorsRenderData(); - return this.mouseTargetFactory.createMouseTarget(lastViewCursorsRenderData, editorPos, pos, null); + return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, null); } protected _createMouseTarget(e: EditorMouseEvent, testEventTarget: boolean): editorBrowser.IMouseTarget { - const lastViewCursorsRenderData = this.viewHelper.getLastViewCursorsRenderData(); - return this.mouseTargetFactory.createMouseTarget(lastViewCursorsRenderData, e.editorPos, e.pos, testEventTarget ? e.target : null); + return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, testEventTarget ? e.target : null); } private _getMouseColumn(e: EditorMouseEvent): number { diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index 1f737774248..384224093e6 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -89,6 +89,13 @@ interface IHitTestResult { hitTarget: Element | null; } +export class PointerHandlerLastRenderData { + constructor( + public readonly lastViewCursorsRenderData: IViewCursorRenderData[], + public readonly lastTextareaPosition: Position | null + ) { } +} + export class MouseTarget implements IMouseTarget { public readonly element: Element | null; @@ -232,19 +239,19 @@ export class HitTestContext { public readonly viewDomNode: HTMLElement; public readonly lineHeight: number; public readonly typicalHalfwidthCharacterWidth: number; - public readonly lastViewCursorsRenderData: IViewCursorRenderData[]; + public readonly lastRenderData: PointerHandlerLastRenderData; private readonly _context: ViewContext; private readonly _viewHelper: IPointerHandlerHelper; - constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastViewCursorsRenderData: IViewCursorRenderData[]) { + constructor(context: ViewContext, viewHelper: IPointerHandlerHelper, lastRenderData: PointerHandlerLastRenderData) { this.model = context.model; const options = context.configuration.options; this.layoutInfo = options.get(EditorOption.layoutInfo); this.viewDomNode = viewHelper.viewDomNode; this.lineHeight = options.get(EditorOption.lineHeight); this.typicalHalfwidthCharacterWidth = options.get(EditorOption.fontInfo).typicalHalfwidthCharacterWidth; - this.lastViewCursorsRenderData = lastViewCursorsRenderData; + this.lastRenderData = lastRenderData; this._context = context; this._viewHelper = viewHelper; } @@ -462,8 +469,8 @@ export class MouseTargetFactory { return false; } - public createMouseTarget(lastViewCursorsRenderData: IViewCursorRenderData[], editorPos: EditorPagePosition, pos: PageCoordinates, target: HTMLElement | null): IMouseTarget { - const ctx = new HitTestContext(this._context, this._viewHelper, lastViewCursorsRenderData); + public createMouseTarget(lastRenderData: PointerHandlerLastRenderData, editorPos: EditorPagePosition, pos: PageCoordinates, target: HTMLElement | null): IMouseTarget { + const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData); const request = new HitTestRequest(ctx, editorPos, pos, target); try { const r = MouseTargetFactory._createMouseTarget(ctx, request, false); @@ -544,7 +551,7 @@ export class MouseTargetFactory { if (request.target) { // Check if we've hit a painted cursor - const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData; + const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData; for (const d of lastViewCursorsRenderData) { @@ -560,7 +567,7 @@ export class MouseTargetFactory { // first or last rendered view line dom node, therefore help it out // and first check if we are on top of a cursor - const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData; + const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData; const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset; const mouseVerticalOffset = request.mouseVerticalOffset; @@ -602,7 +609,10 @@ export class MouseTargetFactory { private static _hitTestTextArea(ctx: HitTestContext, request: ResolvedHitTestRequest): MouseTarget | null { // Is it the textarea? if (ElementPath.isTextArea(request.targetPath)) { - return request.fulfill(MouseTargetType.TEXTAREA); + if (ctx.lastRenderData.lastTextareaPosition) { + return request.fulfill(MouseTargetType.CONTENT_TEXT, ctx.lastRenderData.lastTextareaPosition); + } + return request.fulfill(MouseTargetType.TEXTAREA, ctx.lastRenderData.lastTextareaPosition); } return null; } diff --git a/src/vs/editor/browser/controller/textAreaHandler.ts b/src/vs/editor/browser/controller/textAreaHandler.ts index 4886c2e1e72..49ed53c81df 100644 --- a/src/vs/editor/browser/controller/textAreaHandler.ts +++ b/src/vs/editor/browser/controller/textAreaHandler.ts @@ -77,6 +77,12 @@ export class TextAreaHandler extends ViewPart { private _visibleTextArea: VisibleTextAreaData | null; private _selections: Selection[]; + /** + * The position at which the textarea was rendered. + * This is useful for hit-testing and determining the mouse position. + */ + private _lastRenderPosition: Position | null; + public readonly textArea: FastDomNode; public readonly textAreaCover: FastDomNode; private readonly _textAreaInput: TextAreaInput; @@ -104,6 +110,7 @@ export class TextAreaHandler extends ViewPart { this._visibleTextArea = null; this._selections = [new Selection(1, 1, 1, 1)]; + this._lastRenderPosition = null; // Text Area (The focus will always be in the textarea when the cursor is blinking) this.textArea = createFastDomNode(document.createElement('textarea')); @@ -413,13 +420,18 @@ export class TextAreaHandler extends ViewPart { this._textAreaInput.refreshFocusState(); } + public getLastRenderData(): Position | null { + return this._lastRenderPosition; + } + // --- end view API + private _primaryCursorPosition: Position = new Position(1, 1); private _primaryCursorVisibleRange: HorizontalPosition | null = null; public prepareRender(ctx: RenderingContext): void { - const primaryCursorPosition = new Position(this._selections[0].positionLineNumber, this._selections[0].positionColumn); - this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(primaryCursorPosition); + this._primaryCursorPosition = new Position(this._selections[0].positionLineNumber, this._selections[0].positionColumn); + this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(this._primaryCursorPosition); } public render(ctx: RestrictedRenderingContext): void { @@ -431,6 +443,7 @@ export class TextAreaHandler extends ViewPart { if (this._visibleTextArea) { // The text area is visible for composition reasons this._renderInsideEditor( + null, this._visibleTextArea.top - this._scrollTop, this._contentLeft + this._visibleTextArea.left - this._scrollLeft, this._visibleTextArea.width, @@ -465,6 +478,7 @@ export class TextAreaHandler extends ViewPart { // For the popup emoji input, we will make the text area as high as the line height // We will also make the fontSize and lineHeight the correct dimensions to help with the placement of these pickers this._renderInsideEditor( + this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, this._lineHeight ); @@ -472,12 +486,14 @@ export class TextAreaHandler extends ViewPart { } this._renderInsideEditor( + this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, canUseZeroSizeTextarea ? 0 : 1 ); } - private _renderInsideEditor(top: number, left: number, width: number, height: number): void { + private _renderInsideEditor(renderedPosition: Position | null, top: number, left: number, width: number, height: number): void { + this._lastRenderPosition = renderedPosition; const ta = this.textArea; const tac = this.textAreaCover; @@ -495,6 +511,7 @@ export class TextAreaHandler extends ViewPart { } private _renderAtTopLeft(): void { + this._lastRenderPosition = null; const ta = this.textArea; const tac = this.textAreaCover; diff --git a/src/vs/editor/browser/view/viewImpl.ts b/src/vs/editor/browser/view/viewImpl.ts index 02b337315c8..a79acee4e84 100644 --- a/src/vs/editor/browser/view/viewImpl.ts +++ b/src/vs/editor/browser/view/viewImpl.ts @@ -48,6 +48,7 @@ import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; import { IThemeService, getThemeTypeSelector } from 'vs/platform/theme/common/themeService'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { PointerHandlerLastRenderData } from 'vs/editor/browser/controller/mouseTarget'; export interface IContentWidgetData { @@ -244,8 +245,10 @@ export class View extends ViewEventHandler { this.focus(); }, - getLastViewCursorsRenderData: () => { - return this.viewCursors.getLastRenderData() || []; + getLastRenderData: (): PointerHandlerLastRenderData => { + const lastViewCursorsRenderData = this.viewCursors.getLastRenderData() || []; + const lastTextareaPosition = this._textAreaHandler.getLastRenderData(); + return new PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition); }, shouldSuppressMouseDownOnViewZone: (viewZoneId: string) => { return this.viewZones.shouldSuppressMouseDownOnViewZone(viewZoneId); From ac3fab27bdc63be0825faf52f2e27ee359cc8c14 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 16:11:40 +0100 Subject: [PATCH 164/637] fixes #86408 --- src/vs/workbench/contrib/files/browser/views/explorerView.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 956a7d9fd52..6a59c39f7d5 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -297,7 +297,10 @@ export class ExplorerView extends ViewletPane { for (const stat of this.tree.getSelection()) { const controller = this.renderer.getCompressedNavigationController(stat); - if (controller && focusedStat && controller === this.compressedNavigationController && stat !== focusedStat) { + if (controller && focusedStat && controller === this.compressedNavigationController) { + if (stat === focusedStat) { + selectedStats.push(stat); + } // Ignore stats which are selected but are part of the same compact node as the focused stat continue; } From 41e5936b45e07ec74cfe8a05c8a47dcb18a1105a Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 5 Dec 2019 16:12:31 +0100 Subject: [PATCH 165/637] Fixes #84281: Store bracket counts across embedded languages --- src/vs/editor/common/model/textModel.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index adea9b60c7d..ba78e7b90e0 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -2344,13 +2344,18 @@ export class TextModel extends Disposable implements model.ITextModel { public findEnclosingBrackets(_position: IPosition): [Range, Range] | null { const position = this.validatePosition(_position); const lineCount = this.getLineCount(); + const savedCounts = new Map(); let counts: number[] = []; - const resetCounts = (modeBrackets: RichEditBrackets | null) => { - counts = []; - for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) { - counts[i] = 0; + const resetCounts = (languageId: number, modeBrackets: RichEditBrackets | null) => { + if (!savedCounts.has(languageId)) { + let tmp = []; + for (let i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) { + tmp[i] = 0; + } + savedCounts.set(languageId, tmp); } + counts = savedCounts.get(languageId)!; }; const searchInRange = (modeBrackets: RichEditBrackets, lineNumber: number, lineText: string, searchStartOffset: number, searchEndOffset: number): [Range, Range] | null => { while (true) { @@ -2396,7 +2401,7 @@ export class TextModel extends Disposable implements model.ITextModel { if (languageId !== tokenLanguageId) { languageId = tokenLanguageId; modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId); - resetCounts(modeBrackets); + resetCounts(languageId, modeBrackets); } } @@ -2415,7 +2420,7 @@ export class TextModel extends Disposable implements model.ITextModel { } languageId = tokenLanguageId; modeBrackets = LanguageConfigurationRegistry.getBracketsSupport(languageId); - resetCounts(modeBrackets); + resetCounts(languageId, modeBrackets); } const searchInToken = (!!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))); From 67bbaaee9364955c74288760071704ccf9e19f4a Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 5 Dec 2019 17:12:37 +0100 Subject: [PATCH 166/637] Fixes #86133: Reverse resolved keybindings --- .../workbench/services/keybinding/browser/keybindingService.ts | 3 ++- .../keybinding/electron-browser/nativeKeymapService.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/keybinding/browser/keybindingService.ts b/src/vs/workbench/services/keybinding/browser/keybindingService.ts index 2c0becf3008..a952f48a57d 100644 --- a/src/vs/workbench/services/keybinding/browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/browser/keybindingService.ts @@ -338,7 +338,8 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { } const resolvedKeybindings = this.resolveKeybinding(keybinding); - for (const resolvedKeybinding of resolvedKeybindings) { + for (let i = resolvedKeybindings.length - 1; i >= 0; i--) { + const resolvedKeybinding = resolvedKeybindings[i]; result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault); } } diff --git a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts index 757f632c3a7..6ef2edda43d 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymapService.ts @@ -61,7 +61,7 @@ export class KeyboardMapperFactory { private static _isUSStandard(_kbInfo: nativeKeymap.IKeyboardLayoutInfo): boolean { if (OS === OperatingSystem.Linux) { const kbInfo = _kbInfo; - return (kbInfo && kbInfo.layout === 'us'); + return (kbInfo && (kbInfo.layout === 'us' || /^us,/.test(kbInfo.layout))); } if (OS === OperatingSystem.Macintosh) { From 440916469ce83f6d1f8cf8307b733abba049adae Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 5 Dec 2019 17:19:35 +0100 Subject: [PATCH 167/637] Fixes #86124 --- src/vs/vscode.proposed.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 251d6830ea3..9d69c83b1cb 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -68,7 +68,7 @@ declare module 'vscode' { //#endregion - //#region Alex - semantic tokens + //#region Semantic tokens: https://github.com/microsoft/vscode/issues/86415 export class SemanticTokensLegend { public readonly tokenTypes: string[]; From 57bb2ca49a494a8f1d5f7cf7c23d1b96f4fa1c7d Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 17:27:41 +0100 Subject: [PATCH 168/637] fixes #84241 --- src/vs/workbench/contrib/files/common/explorerModel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/files/common/explorerModel.ts b/src/vs/workbench/contrib/files/common/explorerModel.ts index cd74eea7b4e..dd17f19dfb6 100644 --- a/src/vs/workbench/contrib/files/common/explorerModel.ts +++ b/src/vs/workbench/contrib/files/common/explorerModel.ts @@ -197,7 +197,9 @@ export class ExplorerItem { // Properties local.resource = disk.resource; - local.updateName(disk.name); + if (!local.isRoot) { + local.updateName(disk.name); + } local._isDirectory = disk.isDirectory; local._mtime = disk.mtime; local._isDirectoryResolved = disk._isDirectoryResolved; From 4b394b938ec5f43fa3060746728df6ea460f49c2 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 5 Dec 2019 17:28:23 +0100 Subject: [PATCH 169/637] Fixes #86166 --- src/vs/vscode.proposed.d.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 9d69c83b1cb..19a434638c0 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -84,6 +84,12 @@ declare module 'vscode' { } export class SemanticTokens { + /** + * The result id of the tokens. + * + * On a next call to `provideSemanticTokens`, if VS Code still holds in memory this result, + * the result id will be passed in as `SemanticTokensRequestOptions.previousResultId`. + */ readonly resultId?: string; readonly data: Uint32Array; @@ -91,6 +97,12 @@ declare module 'vscode' { } export class SemanticTokensEdits { + /** + * The result id of the tokens. + * + * On a next call to `provideSemanticTokens`, if VS Code still holds in memory this result, + * the result id will be passed in as `SemanticTokensRequestOptions.previousResultId`. + */ readonly resultId?: string; readonly edits: SemanticTokensEdit[]; @@ -107,6 +119,11 @@ declare module 'vscode' { export interface SemanticTokensRequestOptions { readonly ranges?: readonly Range[]; + /** + * The previous result id that the editor still holds in memory. + * + * Only when this is set it is safe for a `SemanticTokensProvider` to return `SemanticTokensEdits`. + */ readonly previousResultId?: string; } @@ -191,7 +208,13 @@ declare module 'vscode' { * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] * ``` * - * A smart tokens provider can compute a diff from the previous result to the new result + * A smart tokens provider can return a `resultId` to `SemanticTokens`. Then, if the editor still has in memory the previous + * result, the editor will pass in options the previous result id at `SemanticTokensRequestOptions.previousResultId`. Only when + * the editor passes in the previous result id, it is safe and smart for a smart tokens provider can compute a diff from the + * previous result to the new result. + * + * *NOTE*: It is illegal to return `SemanticTokensEdits` if `options.previousResultId` is not set! + * * ``` * [ 2,5,3,1,6, 0,5,4,2,0, 3,2,7,3,0 ] * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] From c8eb6fd4aa8ff767922f89a372235dae13ecb766 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 5 Dec 2019 20:40:11 +0100 Subject: [PATCH 170/637] polish debug console arrows fixes #86016 --- src/vs/workbench/contrib/debug/browser/media/repl.css | 7 +++++-- src/vs/workbench/contrib/debug/browser/repl.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/media/repl.css b/src/vs/workbench/contrib/debug/browser/media/repl.css index 96b7e52d65d..2b38626d95d 100644 --- a/src/vs/workbench/contrib/debug/browser/media/repl.css +++ b/src/vs/workbench/contrib/debug/browser/media/repl.css @@ -30,6 +30,9 @@ cursor: pointer; } +.monaco-workbench.mac .repl .repl-tree .monaco-tl-twistie { + padding-right: 0px; +} .repl .repl-tree .output.expression.value-and-source { display: flex; @@ -42,11 +45,11 @@ .repl .repl-tree .monaco-tl-contents .arrow { position:absolute; left: 2px; - opacity: 0.3; + opacity: 0.25; } .vs-dark .repl .repl-tree .monaco-tl-contents .arrow { - opacity: 0.45; + opacity: 0.4; } .repl .repl-tree .output.expression.value-and-source .source { diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index df3ba1ceef0..935a160bfa0 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -610,7 +610,7 @@ class ReplEvaluationInputsRenderer implements ITreeRenderer Date: Thu, 5 Dec 2019 11:42:37 -0800 Subject: [PATCH 171/637] Fix #86058 --- .../html-language-features/client/src/htmlMain.ts | 4 ++-- .../client/src/{matchingTag.ts => mirrorCursor.ts} | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) rename extensions/html-language-features/client/src/{matchingTag.ts => mirrorCursor.ts} (95%) diff --git a/extensions/html-language-features/client/src/htmlMain.ts b/extensions/html-language-features/client/src/htmlMain.ts index 9a4d392ff28..e8a9a2fa22b 100644 --- a/extensions/html-language-features/client/src/htmlMain.ts +++ b/extensions/html-language-features/client/src/htmlMain.ts @@ -14,7 +14,7 @@ import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared'; import { activateTagClosing } from './tagClosing'; import TelemetryReporter from 'vscode-extension-telemetry'; import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData'; -import { activateMatchingTagPosition as activateMatchingTagSelection } from './matchingTag'; +import { activateMirrorCursor } from './mirrorCursor'; namespace TagCloseRequest { export const type: RequestType = new RequestType('html/tag'); @@ -118,7 +118,7 @@ export function activate(context: ExtensionContext) { return client.sendRequest(MatchingTagPositionRequest.type, param); }; - disposable = activateMatchingTagSelection(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag'); + disposable = activateMirrorCursor(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag'); toDispose.push(disposable); disposable = client.onTelemetry(e => { diff --git a/extensions/html-language-features/client/src/matchingTag.ts b/extensions/html-language-features/client/src/mirrorCursor.ts similarity index 95% rename from extensions/html-language-features/client/src/matchingTag.ts rename to extensions/html-language-features/client/src/mirrorCursor.ts index d12726d35da..041c357032b 100644 --- a/extensions/html-language-features/client/src/matchingTag.ts +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -15,7 +15,7 @@ import { WorkspaceEdit } from 'vscode'; -export function activateMatchingTagPosition( +export function activateMirrorCursor( matchingTagPositionProvider: (document: TextDocument, position: Position) => Thenable, supportedLanguages: { [id: string]: boolean }, configName: string @@ -173,10 +173,19 @@ function shouldDoCleanupForHtmlAttributeInput(document: TextDocument, firstPos: const primaryBeforeSecondary = document.offsetAt(firstPos) < document.offsetAt(secondPos); + /** + * Check two cases + *
+ *
+ * Before 1st cursor: ` ` + * After 1st cursor: `>` or ` ` + * Before 2nd cursor: ` ` + * After 2nd cursor: `>` + */ return ( primaryBeforeSecondary && charBeforePrimarySelection === ' ' && - charAfterPrimarySelection === '>' && + (charAfterPrimarySelection === '>' || charAfterPrimarySelection === ' ') && charBeforeSecondarySelection === ' ' && charAfterSecondarySelection === '>' ); From fea4d4697cdbb85bc0b0a5b1b11111d50d048d51 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Thu, 5 Dec 2019 11:46:56 -0800 Subject: [PATCH 172/637] Bump node2 for #86411 --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 3303d285507..68d891d09d4 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -16,7 +16,7 @@ }, { "name": "ms-vscode.node-debug2", - "version": "1.41.2", + "version": "1.41.3", "repo": "https://github.com/Microsoft/vscode-node-debug2", "metadata": { "id": "36d19e17-7569-4841-a001-947eb18602b2", From a258aa5e22eec32473a53446e8a368a968f2458f Mon Sep 17 00:00:00 2001 From: Robert Jin Date: Thu, 5 Dec 2019 21:46:07 +0000 Subject: [PATCH 173/637] #85858 breadcrumbs.symbolSortOrder per language --- .../browser/parts/editor/breadcrumbs.ts | 1 + .../browser/parts/editor/breadcrumbsPicker.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts index a62a5f543b0..31c872e54a3 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts @@ -155,6 +155,7 @@ Registry.as(Extensions.Configuration).registerConfigurat description: localize('symbolSortOrder', "Controls how symbols are sorted in the breadcrumbs outline view."), type: 'string', default: 'position', + overridable: true, enum: ['position', 'name', 'type'], enumDescriptions: [ localize('symbolSortOrder.position', "Show symbol outline in file position order."), diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 4112f90a567..1e3e4f00d81 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -102,7 +102,7 @@ export abstract class BreadcrumbsPicker { this._domNode.appendChild(this._treeContainer); this._layoutInfo = { maxHeight, width, arrowSize, arrowOffset, inputHeight: 0 }; - this._tree = this._createTree(this._treeContainer); + this._tree = this._createTree(this._treeContainer, input); this._disposables.add(this._tree.onDidChangeSelection(e => { if (e.browserEvent !== this._fakeEvent) { @@ -153,7 +153,7 @@ export abstract class BreadcrumbsPicker { } protected abstract _setInput(element: BreadcrumbElement): Promise; - protected abstract _createTree(container: HTMLElement): Tree; + protected abstract _createTree(container: HTMLElement, element: BreadcrumbElement): Tree; protected abstract _getTargetFromEvent(element: any): any | undefined; } @@ -359,7 +359,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { super(parent, instantiationService, themeService, configService); } - _createTree(container: HTMLElement) { + _createTree(container: HTMLElement, _: BreadcrumbElement) { // tree icon theme specials dom.addClass(this._treeContainer, 'file-icon-themable-tree'); @@ -440,7 +440,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { this._symbolSortOrder = BreadcrumbsConfig.SymbolSortOrder.bindTo(this._configurationService); } - protected _createTree(container: HTMLElement) { + protected _createTree(container: HTMLElement, element: BreadcrumbElement) { return this._instantiationService.createInstance>( WorkbenchDataTree, 'BreadcrumbsOutlinePicker', @@ -452,7 +452,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { collapseByDefault: true, expandOnlyOnTwistieClick: true, multipleSelectionSupport: false, - sorter: new OutlineItemComparator(this._getOutlineItemCompareType()), + sorter: new OutlineItemComparator(this._getOutlineItemCompareType(element)), identityProvider: new OutlineIdentityProvider(), keyboardNavigationLabelProvider: new OutlineNavigationLabelProvider(), filter: this._instantiationService.createInstance(OutlineFilter, 'breadcrumbs') @@ -486,8 +486,12 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { } } - private _getOutlineItemCompareType(): OutlineSortOrder { - switch (this._symbolSortOrder.getValue()) { + private _getOutlineItemCompareType(input: BreadcrumbElement): OutlineSortOrder { + const element = input as TreeElement; + const textModel = OutlineModel.get(element)!.textModel; + const resource = textModel.uri; + const overrideIdentifier = textModel.getLanguageIdentifier().language; + switch (this._symbolSortOrder.getValue({ resource, overrideIdentifier })) { case 'name': return OutlineSortOrder.ByName; case 'type': From 4c20f308e37e6079253bab065ede7911e0f164a8 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Thu, 5 Dec 2019 14:02:07 -0800 Subject: [PATCH 174/637] Allow root of grid to contain single node group fixes #85863 --- src/vs/base/browser/ui/grid/grid.ts | 8 ++++---- src/vs/base/browser/ui/grid/gridview.ts | 2 ++ src/vs/base/test/browser/ui/grid/grid.test.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vs/base/browser/ui/grid/grid.ts b/src/vs/base/browser/ui/grid/grid.ts index 14bda5075db..336f2ff4a21 100644 --- a/src/vs/base/browser/ui/grid/grid.ts +++ b/src/vs/base/browser/ui/grid/grid.ts @@ -604,8 +604,8 @@ export class SerializableGrid extends Grid { export type GridNodeDescriptor = { size?: number, groups?: GridNodeDescriptor[] }; export type GridDescriptor = { orientation: Orientation, groups?: GridNodeDescriptor[] }; -export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor): void { - if (nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) { +export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor, rootNode: boolean): void { + if (!rootNode && nodeDescriptor.groups && nodeDescriptor.groups.length <= 1) { nodeDescriptor.groups = undefined; } @@ -617,7 +617,7 @@ export function sanitizeGridNodeDescriptor(nodeDescriptor: GridNodeDescriptor): let totalDefinedSizeCount = 0; for (const child of nodeDescriptor.groups) { - sanitizeGridNodeDescriptor(child); + sanitizeGridNodeDescriptor(child, false); if (child.size) { totalDefinedSize += child.size; @@ -665,7 +665,7 @@ function getDimensions(node: ISerializedNode, orientation: Orientation): { width } export function createSerializedGrid(gridDescriptor: GridDescriptor): ISerializedGrid { - sanitizeGridNodeDescriptor(gridDescriptor); + sanitizeGridNodeDescriptor(gridDescriptor, true); const root = createSerializedNode(gridDescriptor); const { width, height } = getDimensions(root, gridDescriptor.orientation); diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index 873979ce4b4..88716fd28d3 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -1086,6 +1086,8 @@ export class GridView implements IDisposable { throw new Error('Invalid JSON: \'width\' property must be a number.'); } else if (typeof json.height !== 'number') { throw new Error('Invalid JSON: \'height\' property must be a number.'); + } else if (json.root?.type !== 'branch') { + throw new Error('Invalid JSON: \'root\' property must have \'type\' value of branch.'); } const orientation = json.orientation; diff --git a/src/vs/base/test/browser/ui/grid/grid.test.ts b/src/vs/base/test/browser/ui/grid/grid.test.ts index ae7093bcadc..7956239d44d 100644 --- a/src/vs/base/test/browser/ui/grid/grid.test.ts +++ b/src/vs/base/test/browser/ui/grid/grid.test.ts @@ -787,7 +787,7 @@ suite('SerializableGrid', function () { test('sanitizeGridNodeDescriptor', () => { const nodeDescriptor = { groups: [{ size: 0.2 }, { size: 0.2 }, { size: 0.6, groups: [{}, {}] }] }; const nodeDescriptorCopy = deepClone(nodeDescriptor); - sanitizeGridNodeDescriptor(nodeDescriptorCopy); + sanitizeGridNodeDescriptor(nodeDescriptorCopy, true); assert.deepEqual(nodeDescriptorCopy, { groups: [{ size: 0.2 }, { size: 0.2 }, { size: 0.6, groups: [{ size: 0.5 }, { size: 0.5 }] }] }); }); From 1beea2f864c1f403ab225dbadfdc398d76faef94 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Thu, 5 Dec 2019 14:04:06 -0800 Subject: [PATCH 175/637] Fix #86118 for Windows --- src/vs/workbench/contrib/search/browser/searchEditor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/searchEditor.ts b/src/vs/workbench/contrib/search/browser/searchEditor.ts index 9b54955af67..4eee6a2d7fb 100644 --- a/src/vs/workbench/contrib/search/browser/searchEditor.ts +++ b/src/vs/workbench/contrib/search/browser/searchEditor.ts @@ -47,7 +47,7 @@ const matchToSearchResultFormat = (match: Match): { line: string, ranges: Range[ const prefix = ` ${lineNumber}: ${paddingStr}`; const prefixOffset = prefix.length; - const line = (prefix + sourceLine); + const line = (prefix + sourceLine).replace(/\r?\n?$/, ''); const rangeOnThisLine = ({ start, end }: { start?: number; end?: number; }) => new Range(1, (start ?? 1) + prefixOffset, 1, (end ?? sourceLine.length + 1) + prefixOffset); From e7c13723938e42ee5ac402289d7b59be9a727536 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 5 Dec 2019 14:44:59 -0800 Subject: [PATCH 176/637] lcd - revert layer promotion for now (#86396) * lcd - revert layer promotion for now * Revert "Fix #86347. Fixed overflow widget only for extension viewlet" This reverts commit beb8a0c7b7a1a383181c7bab6f99f007e0629d43. * Revert "Re #85313. Fix suggest widget position for extension editor." This reverts commit 9d47191895b0705f689a234c1a4e1e790303cb70. * repatch titlebar for AA fix --- src/vs/workbench/browser/media/part.css | 5 --- .../activitybar/media/activitybarpart.css | 16 ---------- .../parts/editor/media/editorgroupview.css | 14 --------- .../browser/parts/panel/media/panelpart.css | 16 +--------- .../parts/sidebar/media/sidebarpart.css | 16 ++-------- .../parts/statusbar/media/statusbarpart.css | 14 --------- .../parts/titlebar/media/titlebarpart.css | 31 +++++-------------- .../codeEditor/browser/simpleEditorOptions.ts | 4 +-- .../suggestEnabledInput.ts | 3 +- .../extensions/browser/extensionsViewlet.ts | 2 +- .../preferences/browser/settingsEditor2.ts | 1 - 11 files changed, 14 insertions(+), 108 deletions(-) diff --git a/src/vs/workbench/browser/media/part.css b/src/vs/workbench/browser/media/part.css index d71cf8f50d1..89dd7fe4c9b 100644 --- a/src/vs/workbench/browser/media/part.css +++ b/src/vs/workbench/browser/media/part.css @@ -8,11 +8,6 @@ overflow: hidden; } -.monaco-workbench.windows.chromium .part:focus-within, -.monaco-workbench.linux.chromium .part:focus-within { - z-index: 500; -} - .monaco-workbench .part > .title { display: none; /* Parts have to opt in to show title area */ } diff --git a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css index 4dc487ae5d0..cbc3d14705b 100644 --- a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css +++ b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css @@ -7,22 +7,6 @@ width: 48px; } -.monaco-workbench.windows.chromium .part.activitybar, -.monaco-workbench.linux.chromium .part.activitybar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - overflow: visible; /* when a new layer is created, we need to set overflow visible to avoid clipping the menubar */ - position: relative; -} - .monaco-workbench .activitybar > .content { height: 100%; display: flex; diff --git a/src/vs/workbench/browser/parts/editor/media/editorgroupview.css b/src/vs/workbench/browser/parts/editor/media/editorgroupview.css index c4c66c12eaa..582eac233e2 100644 --- a/src/vs/workbench/browser/parts/editor/media/editorgroupview.css +++ b/src/vs/workbench/browser/parts/editor/media/editorgroupview.css @@ -48,20 +48,6 @@ overflow: hidden; } -.monaco-workbench.windows.chromium .part.editor > .content .editor-group-container > .title, -.monaco-workbench.linux.chromium .part.editor > .content .editor-group-container > .title { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); -} - .monaco-workbench .part.editor > .content .editor-group-container > .title:not(.tabs) { display: flex; /* when tabs are not shown, use flex layout */ flex-wrap: nowrap; diff --git a/src/vs/workbench/browser/parts/panel/media/panelpart.css b/src/vs/workbench/browser/parts/panel/media/panelpart.css index 5db9c19a1ea..4909d7e9738 100644 --- a/src/vs/workbench/browser/parts/panel/media/panelpart.css +++ b/src/vs/workbench/browser/parts/panel/media/panelpart.css @@ -12,20 +12,6 @@ z-index: initial; } -.monaco-workbench.windows.chromium .part.panel, -.monaco-workbench.linux.chromium .part.panel { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); -} - .monaco-workbench .part.panel .title { height: 35px; display: flex; @@ -114,7 +100,7 @@ text-align: center; display: inline-block; box-sizing: border-box; -} + } /** Actions */ diff --git a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css index ac2845f9c4b..25b9dcd0625 100644 --- a/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css +++ b/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css @@ -3,20 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -.monaco-workbench.windows.chromium .part.sidebar, -.monaco-workbench.linux.chromium .part.sidebar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - overflow: visible; - position: relative; +.monaco-workbench .sidebar > .content { + overflow: hidden; } .monaco-workbench.nosidebar > .part.sidebar { diff --git a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css index 560bb371cbf..3102b114c52 100644 --- a/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css +++ b/src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css @@ -13,20 +13,6 @@ overflow: visible; } -.monaco-workbench.windows.chromium .part.statusbar, -.monaco-workbench.linux.chromium .part.statusbar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); -} - .monaco-workbench .part.statusbar.status-border-top::after { content: ''; position: absolute; diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index e71467abfc9..2725a7d5da5 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -19,22 +19,6 @@ display: flex; } -.monaco-workbench.windows .part.titlebar, -.monaco-workbench.linux .part.titlebar { - /* - * Explicitly put the part onto its own layer to help Chrome to - * render the content with LCD-anti-aliasing. By partioning the - * workbench into multiple layers, we can ensure that a bad - * behaving part is not making another part fallback to greyscale - * rendering. - * - * macOS: does not render LCD-anti-aliased. - */ - transform: translate3d(0px, 0px, 0px); - position: relative; - z-index: 1500 !important; /* move the entire titlebar above the workbench, except modals/dialogs */ -} - .monaco-workbench .part.titlebar > .titlebar-drag-region { top: 0; left: 0; @@ -45,11 +29,6 @@ -webkit-app-region: drag; } -.monaco-workbench .part.titlebar > .menubar { - /* Move above drag region since negative z-index on that element causes AA issues */ - z-index: 1; -} - .monaco-workbench .part.titlebar > .window-title { flex: 0 1 auto; font-size: 12px; @@ -78,6 +57,11 @@ cursor: default; } +.monaco-workbench .part.titlebar > .menubar { + /* move menubar above drag region as negative z-index on drag region cause greyscale AA */ + z-index: 2000; +} + .monaco-workbench.linux .part.titlebar > .window-title { font-size: inherit; } @@ -100,7 +84,7 @@ width: 35px; height: 100%; position: relative; - z-index: 2; /* highest level of titlebar */ + z-index: 3000; background-image: url('code-icon.svg'); background-repeat: no-repeat; background-position: center center; @@ -118,12 +102,11 @@ flex-shrink: 0; text-align: center; position: relative; - z-index: 2; /* highest level of titlebar */ + z-index: 3000; -webkit-app-region: no-drag; height: 100%; width: 138px; margin-left: auto; - transform: translate3d(0px, 0px, 0px); } .monaco-workbench.fullscreen .part.titlebar > .window-controls-container { diff --git a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts index ff80bd1ec20..ac40c376e27 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts @@ -13,7 +13,7 @@ import { SelectionClipboardContributionID } from 'vs/workbench/contrib/codeEdito import { TabCompletionController } from 'vs/workbench/contrib/snippets/browser/tabCompletion'; import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions'; -export function getSimpleEditorOptions(fixedOverflowWidgets: boolean = true): IEditorOptions { +export function getSimpleEditorOptions(): IEditorOptions { return { wordWrap: 'on', overviewRulerLanes: 0, @@ -30,7 +30,7 @@ export function getSimpleEditorOptions(fixedOverflowWidgets: boolean = true): IE overviewRulerBorder: false, scrollBeyondLastLine: false, renderLineHighlight: 'none', - fixedOverflowWidgets: fixedOverflowWidgets, + fixedOverflowWidgets: true, acceptSuggestionOnEnter: 'smart', minimap: { enabled: false diff --git a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts index ee09a61a8e6..b9731888148 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts @@ -72,7 +72,6 @@ interface SuggestEnabledInputOptions { * Context key tracking the focus state of this element */ focusContextKey?: IContextKey; - fixedOverflowWidgets?: boolean; } export interface ISuggestEnabledInputStyleOverrides extends IStyleOverrides { @@ -127,7 +126,7 @@ export class SuggestEnabledInput extends Widget implements IThemable { this.placeholderText = append(this.stylingContainer, $('.suggest-input-placeholder', undefined, options.placeholderText || '')); const editorOptions: IEditorOptions = mixin( - getSimpleEditorOptions(!!options.fixedOverflowWidgets), + getSimpleEditorOptions(), getSuggestEnabledInputOptions(ariaLabel)); this.inputWidget = instantiationService.createInstance(CodeEditorWidget, this.stylingContainer, diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 669297557d5..4ac7d34337e 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -405,7 +405,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio else { return 'd'; } }, provideResults: (query: string) => Query.suggestions(query) - }, placeholder, 'extensions:searchinput', { placeholderText: placeholder, value: searchValue, fixedOverflowWidgets: false })); + }, placeholder, 'extensions:searchinput', { placeholderText: placeholder, value: searchValue })); if (this.searchBox.getValue()) { this.triggerSearch(); diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index e339ce2784e..09467700dd5 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -406,7 +406,6 @@ export class SettingsEditor2 extends BaseEditor { }, searchBoxLabel, 'settingseditor:searchinput' + SettingsEditor2.NUM_INSTANCES++, { placeholderText: searchBoxLabel, focusContextKey: this.searchFocusContextKey, - fixedOverflowWidgets: true // TODO: Aria-live }) ); From 9752af2c5cd393281699c3f2636d087ecd7b7580 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 6 Dec 2019 00:05:43 +0100 Subject: [PATCH 177/637] Fixes #84595: editor.matchBrackets can now be 'never' | 'near' | 'always' --- .../editor/common/config/commonEditorConfig.ts | 7 +++++++ src/vs/editor/common/config/editorOptions.ts | 12 +++++++----- .../contrib/bracketMatching/bracketMatching.ts | 17 +++++++++-------- src/vs/monaco.d.ts | 4 ++-- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 994f3e4f6c9..f9f34b493f8 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -263,6 +263,13 @@ function migrateOptions(options: IEditorOptions): void { } else if (autoIndent === false) { options.autoIndent = 'advanced'; } + + const matchBrackets = options.matchBrackets; + if (matchBrackets === true) { + options.matchBrackets = 'always'; + } else if (matchBrackets === false) { + options.matchBrackets = 'never'; + } } function deepCloneAndMigrateOptions(_options: IEditorOptions): IEditorOptions { diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 7ad5563ff4a..74662b49749 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -481,9 +481,9 @@ export interface IEditorOptions { showFoldingControls?: 'always' | 'mouseover'; /** * Enable highlighting of matching brackets. - * Defaults to true. + * Defaults to 'always'. */ - matchBrackets?: boolean; + matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. * Defaults to none. @@ -3356,9 +3356,11 @@ export const EditorOptions = { EditorOption.links, 'links', true, { description: nls.localize('links', "Controls whether the editor should detect links and make them clickable.") } )), - matchBrackets: register(new EditorBooleanOption( - EditorOption.matchBrackets, 'matchBrackets', true, - { description: nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.") } + matchBrackets: register(new EditorStringEnumOption( + EditorOption.matchBrackets, 'matchBrackets', + 'always' as 'never' | 'near' | 'always', + ['always', 'near', 'never'] as const, + { description: nls.localize('matchBrackets', "Highlight matching brackets.") } )), minimap: register(new EditorMinimap()), mouseStyle: register(new EditorStringEnumOption( diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index ac8db2f7325..2bb287315ee 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -116,7 +116,7 @@ export class BracketMatchingController extends Disposable implements editorCommo private _lastVersionId: number; private _decorations: string[]; private readonly _updateBracketsSoon: RunOnceScheduler; - private _matchBrackets: boolean; + private _matchBrackets: 'never' | 'near' | 'always'; constructor( editor: ICodeEditor @@ -132,7 +132,7 @@ export class BracketMatchingController extends Disposable implements editorCommo this._updateBracketsSoon.schedule(); this._register(editor.onDidChangeCursorPosition((e) => { - if (!this._matchBrackets) { + if (this._matchBrackets === 'never') { // Early exit if nothing needs to be done! // Leave some form of early exit check here if you wish to continue being a cursor position change listener ;) return; @@ -153,12 +153,13 @@ export class BracketMatchingController extends Disposable implements editorCommo this._updateBracketsSoon.schedule(); })); this._register(editor.onDidChangeConfiguration((e) => { - this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets); - if (!this._matchBrackets && this._decorations.length > 0) { - // Remove existing decorations if bracket matching is off + if (e.hasChanged(EditorOption.matchBrackets)) { + this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets); this._decorations = this._editor.deltaDecorations(this._decorations, []); + this._lastBracketsData = []; + this._lastVersionId = 0; + this._updateBracketsSoon.schedule(); } - this._updateBracketsSoon.schedule(); })); } @@ -262,7 +263,7 @@ export class BracketMatchingController extends Disposable implements editorCommo }); private _updateBrackets(): void { - if (!this._matchBrackets) { + if (this._matchBrackets === 'never') { return; } this._recomputeBrackets(); @@ -332,7 +333,7 @@ export class BracketMatchingController extends Disposable implements editorCommo } else { let brackets = model.matchBracket(position); let options = BracketMatchingController._DECORATION_OPTIONS_WITH_OVERVIEW_RULER; - if (!brackets) { + if (!brackets && this._matchBrackets === 'always') { brackets = model.findEnclosingBrackets(position); options = BracketMatchingController._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER; } diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 6f20419c1f3..100626ba2f1 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2880,9 +2880,9 @@ declare namespace monaco.editor { showFoldingControls?: 'always' | 'mouseover'; /** * Enable highlighting of matching brackets. - * Defaults to true. + * Defaults to 'always'. */ - matchBrackets?: boolean; + matchBrackets?: 'never' | 'near' | 'always'; /** * Enable rendering of whitespace. * Defaults to none. From 9bdb4a2f700bc8d9846315acbf25db150c9f4d82 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 5 Dec 2019 15:05:35 -0800 Subject: [PATCH 178/637] Handle normalized windows paths in resource map Fixes #86433 During path normalization, we convert `\` in windows paths to `/`. This causes the isWindowsPath check to fail I think it is generally safe to assume that file paths that start with a drive letter and then any type of slash should be treated as windows paths --- .../typescript-language-features/src/utils/resourceMap.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/utils/resourceMap.ts b/extensions/typescript-language-features/src/utils/resourceMap.ts index a10fbd91636..e942fae4583 100644 --- a/extensions/typescript-language-features/src/utils/resourceMap.ts +++ b/extensions/typescript-language-features/src/utils/resourceMap.ts @@ -101,5 +101,5 @@ export class ResourceMap { } export function isWindowsPath(path: string): boolean { - return /^[a-zA-Z]:\\/.test(path); + return /^[a-zA-Z]:[\/\\]/.test(path); } From 1df49860fbb9a05090292cbc508d69b594fab5d8 Mon Sep 17 00:00:00 2001 From: Gustavo Cassel Date: Thu, 5 Dec 2019 20:09:58 -0300 Subject: [PATCH 179/637] Renamed command to 'changePeekFocus' and changed KeyBinding to 'CTRL+K F2' --- .../gotoSymbol/peek/referencesController.ts | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts index 414c03f877c..23c344ee873 100644 --- a/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts +++ b/src/vs/editor/contrib/gotoSymbol/peek/referencesController.ts @@ -23,7 +23,7 @@ import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async import { getOuterEditor, PeekContext } from 'vs/editor/contrib/peekView/peekView'; import { IListService, WorkbenchListFocusContextKey } from 'vs/platform/list/browser/listService'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; +import { KeyCode, KeyMod, KeyChord } from 'vs/base/common/keyCodes'; export const ctxReferenceSearchVisible = new RawContextKey('referenceSearchVisible', false); @@ -173,7 +173,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri }); } - async changeFocusBetweenPreviewAndReferences() { + changeFocusBetweenPreviewAndReferences() { if (!this._widget) { // can be called while still resolving... return; @@ -291,22 +291,10 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC } KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'changeFocus', + id: 'changePeekFocus', weight: KeybindingWeight.WorkbenchContrib + 50, - primary: KeyCode.F2, - when: ctxReferenceSearchVisible, - handler(accessor) { - withController(accessor, controller => { - controller.changeFocusBetweenPreviewAndReferences(); - }); - } -}); - -KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: 'changeFocusFromEmbeddedEditor', - weight: KeybindingWeight.EditorContrib + 50, - primary: KeyCode.F2, - when: PeekContext.inPeekEditor, + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.F2), + when: ContextKeyExpr.or(ctxReferenceSearchVisible, PeekContext.inPeekEditor), handler(accessor) { withController(accessor, controller => { controller.changeFocusBetweenPreviewAndReferences(); From bc2fbe2893daf00b0b3ef9bd6ff326a5ddfd933f Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Thu, 5 Dec 2019 15:15:39 -0800 Subject: [PATCH 180/637] only suppress mouse down for inline diff view. --- src/vs/editor/browser/widget/diffEditorWidget.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 9dbc302244e..91b91732033 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -128,12 +128,13 @@ class VisualEditorState { this.inlineDiffMargins = []; for (let i = 0, length = newDecorations.zones.length; i < length; i++) { const viewZone = newDecorations.zones[i]; - viewZone.suppressMouseDown = false; + viewZone.suppressMouseDown = true; let zoneId = viewChangeAccessor.addZone(viewZone); this._zones.push(zoneId); this._zonesMap[String(zoneId)] = true; if (newDecorations.zones[i].diff && viewZone.marginDomNode && this._clipboardService) { + viewZone.suppressMouseDown = false; this.inlineDiffMargins.push(new InlineDiffMargin(zoneId, viewZone.marginDomNode, editor, newDecorations.zones[i].diff!, this._contextMenuService, this._clipboardService)); } } From 40b5b5dde1dc38a2fadc372f405fe8f4fd122a87 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 6 Dec 2019 00:29:42 +0100 Subject: [PATCH 181/637] Fixes #84312: Add a time limit to bracket matching --- src/vs/editor/common/model.ts | 2 +- src/vs/editor/common/model/textModel.ts | 8 +++++++- src/vs/editor/contrib/bracketMatching/bracketMatching.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index 0c6a851ec53..e26df375fa9 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -898,7 +898,7 @@ export interface ITextModel { * @param position The position at which to start the search. * @internal */ - findEnclosingBrackets(position: IPosition): [Range, Range] | null; + findEnclosingBrackets(position: IPosition, maxDuration?: number): [Range, Range] | null; /** * Given a `position`, if the position is on top or near a bracket, diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index ba78e7b90e0..9bc6dc21a62 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -34,6 +34,7 @@ import { withUndefinedAsNull } from 'vs/base/common/types'; import { VSBufferReadableStream, VSBuffer } from 'vs/base/common/buffer'; import { TokensStore, MultilineTokens, countEOL, MultilineTokens2, TokensStore2 } from 'vs/editor/common/model/tokensStore'; import { Color } from 'vs/base/common/color'; +import { Constants } from 'vs/base/common/uint'; function createTextBufferBuilder() { return new PieceTreeTextBufferBuilder(); @@ -2341,7 +2342,7 @@ export class TextModel extends Disposable implements model.ITextModel { return null; } - public findEnclosingBrackets(_position: IPosition): [Range, Range] | null { + public findEnclosingBrackets(_position: IPosition, maxDuration = Constants.MAX_SAFE_SMALL_INTEGER): [Range, Range] | null { const position = this.validatePosition(_position); const lineCount = this.getLineCount(); const savedCounts = new Map(); @@ -2385,7 +2386,12 @@ export class TextModel extends Disposable implements model.ITextModel { let languageId: LanguageId = -1; let modeBrackets: RichEditBrackets | null = null; + const startTime = Date.now(); for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) { + const elapsedTime = Date.now() - startTime; + if (elapsedTime > maxDuration) { + return null; + } const lineTokens = this._getLineTokens(lineNumber); const tokenCount = lineTokens.getCount(); const lineText = this._buffer.getLineContent(lineNumber); diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index 2bb287315ee..a669b572023 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -334,7 +334,7 @@ export class BracketMatchingController extends Disposable implements editorCommo let brackets = model.matchBracket(position); let options = BracketMatchingController._DECORATION_OPTIONS_WITH_OVERVIEW_RULER; if (!brackets && this._matchBrackets === 'always') { - brackets = model.findEnclosingBrackets(position); + brackets = model.findEnclosingBrackets(position, 20 /* give at most 20ms to compute */); options = BracketMatchingController._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER; } newData[newDataLen++] = new BracketsData(position, brackets, options); From 58bf19619b45c328e77b2eeb698abf9a110638ff Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 6 Dec 2019 00:28:30 +0100 Subject: [PATCH 182/637] update telemetry --- .../contrib/markers/browser/markersPanel.ts | 21 +++++++++++++++++++ .../markers/browser/markersPanelActions.ts | 20 ------------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/contrib/markers/browser/markersPanel.ts b/src/vs/workbench/contrib/markers/browser/markersPanel.ts index f2159a61fea..0041bade2ba 100644 --- a/src/vs/workbench/contrib/markers/browser/markersPanel.ts +++ b/src/vs/workbench/contrib/markers/browser/markersPanel.ts @@ -440,6 +440,7 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { })); this._register(this.tree.onDidChangeSelection(() => this.onSelected())); this._register(this.filterAction.onDidChange((event: IMarkersFilterActionChangeEvent) => { + this.reportFilteringUsed(); if (event.activeFile) { this.refreshPanel(); } else if (event.filterText || event.excludedFiles || event.showWarnings || event.showErrors || event.showInfos) { @@ -753,6 +754,26 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { return { source, code }; } + private reportFilteringUsed(): void { + const data = { + errors: this.filterAction.showErrors, + warnings: this.filterAction.showWarnings, + infos: this.filterAction.showInfos, + activeFile: this.filterAction.activeFile, + excludedFiles: this.filterAction.excludedFiles, + }; + /* __GDPR__ + "problems.filter" : { + "errors" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "warnings": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "infos": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "activeFile": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, + "excludedFiles": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } + } + */ + this.telemetryService.publicLog('problems.filter', data); + } + protected saveState(): void { this.panelState['filter'] = this.filterAction.filterText; this.panelState['filterHistory'] = this.filterAction.filterHistory; diff --git a/src/vs/workbench/contrib/markers/browser/markersPanelActions.ts b/src/vs/workbench/contrib/markers/browser/markersPanelActions.ts index 47dca87ec67..39719499d5d 100644 --- a/src/vs/workbench/contrib/markers/browser/markersPanelActions.ts +++ b/src/vs/workbench/contrib/markers/browser/markersPanelActions.ts @@ -27,7 +27,6 @@ import { Marker } from 'vs/workbench/contrib/markers/browser/markersModel'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { Event, Emitter } from 'vs/base/common/event'; import { FilterOptions } from 'vs/workbench/contrib/markers/browser/markersFilterOptions'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdown'; import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview'; @@ -285,7 +284,6 @@ export class MarkersFilterActionViewItem extends BaseActionViewItem { @IInstantiationService private readonly instantiationService: IInstantiationService, @IContextViewService private readonly contextViewService: IContextViewService, @IThemeService private readonly themeService: IThemeService, - @ITelemetryService private readonly telemetryService: ITelemetryService, @IContextKeyService contextKeyService: IContextKeyService ) { super(null, action); @@ -385,7 +383,6 @@ export class MarkersFilterActionViewItem extends BaseActionViewItem { inputbox.addToHistory(); this.action.filterText = inputbox.value; this.action.filterHistory = inputbox.getHistory(); - this.reportFilteringUsed(); } private updateBadge(): void { @@ -426,23 +423,6 @@ export class MarkersFilterActionViewItem extends BaseActionViewItem { } } - private reportFilteringUsed(): void { - const filterOptions = this.filterController.getFilterOptions(); - const data = { - errors: filterOptions.showErrors, - warnings: filterOptions.showWarnings, - infos: filterOptions.showInfos, - }; - /* __GDPR__ - "problems.filter" : { - "errors" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "warnings": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, - "infos": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } - } - */ - this.telemetryService.publicLog('problems.filter', data); - } - protected updateClass(): void { if (this.element && this.container) { this.element.className = this.action.class || ''; From 196aeda027bd5fd10367d5bbd6d8faf8d45f0f40 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 6 Dec 2019 00:53:57 +0100 Subject: [PATCH 183/637] Fixes #86165: Do not always cancel the timeout, reduce the delay --- src/vs/editor/common/services/modelServiceImpl.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 6d309ab6aa5..4ba21e84bf6 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -652,11 +652,15 @@ class ModelSemanticColoring extends Disposable { this._isDisposed = false; this._model = model; this._semanticStyling = stylingProvider; - this._fetchSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchSemanticTokensNow(), 500)); + this._fetchSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchSemanticTokensNow(), 300)); this._currentResponse = null; this._currentRequestCancellationTokenSource = null; - this._register(this._model.onDidChangeContent(e => this._fetchSemanticTokens.schedule())); + this._register(this._model.onDidChangeContent(e => { + if (!this._fetchSemanticTokens.isScheduled()) { + this._fetchSemanticTokens.schedule(); + } + })); this._register(SemanticTokensProviderRegistry.onDidChange(e => this._fetchSemanticTokens.schedule())); if (themeService) { // workaround for tests which use undefined... :/ @@ -887,7 +891,9 @@ class ModelSemanticColoring extends Disposable { } } - this._fetchSemanticTokens.schedule(); + if (!this._fetchSemanticTokens.isScheduled()) { + this._fetchSemanticTokens.schedule(); + } } this._model.setSemanticTokens(result); From c197f24c69157b56dec008d307801f003dd74aec Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 6 Dec 2019 01:11:56 +0100 Subject: [PATCH 184/637] Fixes #84523: Pass in comparator when using Array.sort() --- .../viewParts/currentLineHighlight/currentLineHighlight.ts | 2 +- src/vs/editor/common/config/editorOptions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts index cb3e355d8c6..59fdaf045a9 100644 --- a/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts +++ b/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts @@ -57,7 +57,7 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay { const renderSelections = isRenderedUsingBorder ? this._selections.slice(0, 1) : this._selections; const cursorsLineNumbers = renderSelections.map(s => s.positionLineNumber); - cursorsLineNumbers.sort(); + cursorsLineNumbers.sort((a, b) => a - b); if (!arrays.equals(this._cursorLineNumbers, cursorsLineNumbers)) { this._cursorLineNumbers = cursorsLineNumbers; hasChanged = true; diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 74662b49749..a5c35ef4b60 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -2271,7 +2271,7 @@ class EditorRulers extends SimpleEditorOption { for (let value of input) { rulers.push(EditorIntOption.clampedInt(value, 0, 0, 10000)); } - rulers.sort(); + rulers.sort((a, b) => a - b); return rulers; } return this.defaultValue; From ca424255035441c4ea439b82df3eec334572f267 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Thu, 5 Dec 2019 16:16:52 -0800 Subject: [PATCH 185/637] Fix #83599. Refresh code widget focus state when hide --- src/vs/base/browser/dom.ts | 18 ++++++++++++++++++ .../editor/browser/widget/codeEditorWidget.ts | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 7a582b4e018..a377409075c 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -972,6 +972,7 @@ export const EventHelper = { export interface IFocusTracker extends Disposable { onDidFocus: Event; onDidBlur: Event; + refreshState?(): void; } export function saveParentsScrollTop(node: Element): number[] { @@ -1000,6 +1001,8 @@ class FocusTracker extends Disposable implements IFocusTracker { private readonly _onDidBlur = this._register(new Emitter()); public readonly onDidBlur: Event = this._onDidBlur.event; + private _refreshStateHandler: () => void; + constructor(element: HTMLElement | Window) { super(); let hasFocus = isAncestor(document.activeElement, element); @@ -1026,9 +1029,24 @@ class FocusTracker extends Disposable implements IFocusTracker { } }; + this._refreshStateHandler = () => { + let currentNodeHasFocus = isAncestor(document.activeElement, element); + if (currentNodeHasFocus !== hasFocus) { + if (hasFocus) { + onBlur(); + } else { + onFocus(); + } + } + }; + this._register(domEvent(element, EventType.FOCUS, true)(onFocus)); this._register(domEvent(element, EventType.BLUR, true)(onBlur)); } + + refreshState() { + this._refreshStateHandler(); + } } export function trackFocus(element: HTMLElement | Window): IFocusTracker { diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 357eeab2a9f..4bfde519d76 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -874,6 +874,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE public onHide(): void { this._modelData?.view.refreshFocusState(); + this._focusTracker.refreshState(); } public getContribution(id: string): T { @@ -1806,6 +1807,12 @@ class CodeEditorWidgetFocusTracker extends Disposable { public hasFocus(): boolean { return this._hasFocus; } + + public refreshState(): void { + if (this._domFocusTracker.refreshState) { + this._domFocusTracker.refreshState(); + } + } } const squigglyStart = encodeURIComponent(` + * | + */ + if (charBeforePrimarySelection === '\n' && charBeforeSecondarySelection === '\n') { + return false; + } + /** + * Special case for exiting + *
| + *
| + */ + if (charAfterPrimarySelection === '\n' && charAfterSecondarySelection === '\n') { + return false; + } + // Exit mirror mode when cursor position no longer mirror // Unless it's in the case of `<|>` const charBeforeBothPositionRoughlyEqual = From 06f97fe829c3bcfa148082702e313e939e4287e1 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:24:58 -0800 Subject: [PATCH 187/637] Fix #86441 --- .../client/src/mirrorCursor.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/extensions/html-language-features/client/src/mirrorCursor.ts b/extensions/html-language-features/client/src/mirrorCursor.ts index 2fc409e8ab0..43ea3169c97 100644 --- a/extensions/html-language-features/client/src/mirrorCursor.ts +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -87,9 +87,22 @@ export function activateMirrorCursor( } } + const exitMirrorMode = () => { + inMirrorMode = false; + window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; + }; + if (cursors.length === 2 && inMirrorMode) { - // Check two cases if (event.selections[0].isEmpty && event.selections[1].isEmpty) { + if ( + prevCursors.length === 2 && + event.selections[0].anchor.line !== prevCursors[0].anchor.line && + event.selections[1].anchor.line !== prevCursors[0].anchor.line + ) { + exitMirrorMode(); + return; + } + const charBeforeAndAfterPositionsRoughtlyEqual = isCharBeforeAndAfterPositionsRoughtlyEqual( event.textEditor.document, event.selections[0].anchor, @@ -97,8 +110,7 @@ export function activateMirrorCursor( ); if (!charBeforeAndAfterPositionsRoughtlyEqual) { - inMirrorMode = false; - window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; + exitMirrorMode(); return; } else { // Need to cleanup in the case of
@@ -109,11 +121,10 @@ export function activateMirrorCursor( event.selections[1].anchor ) ) { - inMirrorMode = false; const cleanupEdit = new WorkspaceEdit(); const cleanupRange = new Range(event.selections[1].anchor.translate(0, -1), event.selections[1].anchor); cleanupEdit.replace(event.textEditor.document.uri, cleanupRange, ''); - window.activeTextEditor!.selections = [window.activeTextEditor!.selections[0]]; + exitMirrorMode(); workspace.applyEdit(cleanupEdit); } } From 29474d526eb5d9855d68db00cb129b4682416730 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:26:18 -0800 Subject: [PATCH 188/637] Revert "Fix #85151" This reverts commit 398696040b3a5eee0319cc740b38eb3edb311f41. --- .../client/src/mirrorCursor.ts | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/extensions/html-language-features/client/src/mirrorCursor.ts b/extensions/html-language-features/client/src/mirrorCursor.ts index 43ea3169c97..8f6f3ca6db5 100644 --- a/extensions/html-language-features/client/src/mirrorCursor.ts +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -161,36 +161,6 @@ function isCharBeforeAndAfterPositionsRoughtlyEqual(document: TextDocument, firs const charBeforeSecondarySelection = getCharBefore(document, secondPos); const charAfterSecondarySelection = getCharAfter(document, secondPos); - /** - * Special case for exiting - * |
- * |
- */ - if ( - charBeforePrimarySelection === ' ' && - charBeforeSecondarySelection === ' ' && - charAfterPrimarySelection === '<' && - charAfterSecondarySelection === '<' - ) { - return false; - } - /** - * Special case for exiting - * |
- * |
- */ - if (charBeforePrimarySelection === '\n' && charBeforeSecondarySelection === '\n') { - return false; - } - /** - * Special case for exiting - *
| - *
| - */ - if (charAfterPrimarySelection === '\n' && charAfterSecondarySelection === '\n') { - return false; - } - // Exit mirror mode when cursor position no longer mirror // Unless it's in the case of `<|>` const charBeforeBothPositionRoughlyEqual = From 7fada393922b5e025afce58d441b2d904808630e Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:27:35 -0800 Subject: [PATCH 189/637] Fix #86151 --- .../client/src/mirrorCursor.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/extensions/html-language-features/client/src/mirrorCursor.ts b/extensions/html-language-features/client/src/mirrorCursor.ts index 8f6f3ca6db5..43ea3169c97 100644 --- a/extensions/html-language-features/client/src/mirrorCursor.ts +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -161,6 +161,36 @@ function isCharBeforeAndAfterPositionsRoughtlyEqual(document: TextDocument, firs const charBeforeSecondarySelection = getCharBefore(document, secondPos); const charAfterSecondarySelection = getCharAfter(document, secondPos); + /** + * Special case for exiting + * |
+ * |
+ */ + if ( + charBeforePrimarySelection === ' ' && + charBeforeSecondarySelection === ' ' && + charAfterPrimarySelection === '<' && + charAfterSecondarySelection === '<' + ) { + return false; + } + /** + * Special case for exiting + * |
+ * |
+ */ + if (charBeforePrimarySelection === '\n' && charBeforeSecondarySelection === '\n') { + return false; + } + /** + * Special case for exiting + *
| + *
| + */ + if (charAfterPrimarySelection === '\n' && charAfterSecondarySelection === '\n') { + return false; + } + // Exit mirror mode when cursor position no longer mirror // Unless it's in the case of `<|>` const charBeforeBothPositionRoughlyEqual = From 33941fef36e945d368135482a8d12e2cfb16b2a9 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:37:23 -0800 Subject: [PATCH 190/637] Fix #85841 --- .../services/preferences/common/preferencesModels.ts | 4 ++-- .../preferences/test/common/preferencesModel.test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/preferences/common/preferencesModels.ts b/src/vs/workbench/services/preferences/common/preferencesModels.ts index 1406adf1750..91c30d0ef26 100644 --- a/src/vs/workbench/services/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/services/preferences/common/preferencesModels.ts @@ -1051,12 +1051,12 @@ export function createValidator(prop: IConfigurationPropertySchema): (value: any } if (prop.minItems && stringArrayValue.length < prop.minItems) { - message += nls.localize('validations.stringArrayMinItem', 'Array must have at least {0} items', prop.minItems); + message += nls.localize('validations.stringArrayMinItem', 'Array should have at least {0} items', prop.minItems); message += '\n'; } if (prop.maxItems && stringArrayValue.length > prop.maxItems) { - message += nls.localize('validations.stringArrayMaxItem', 'Array must have less than {0} items', prop.maxItems); + message += nls.localize('validations.stringArrayMaxItem', 'Array should have at most {0} items', prop.maxItems); message += '\n'; } diff --git a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts index 9fbfb467a2b..fc0f4db07c4 100644 --- a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts +++ b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts @@ -288,10 +288,10 @@ suite('Preferences Model test', () => { test('min-max items array', () => { { const arr = new ArrayTester({ type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 2 }); - arr.rejects([]).withMessage('Array must have at least 1 items'); + arr.rejects([]).withMessage('Array should have at least 1 items'); arr.accepts(['a']); arr.accepts(['a', 'a']); - arr.rejects(['a', 'a', 'a']).withMessage('Array must have less than 2 items'); + arr.rejects(['a', 'a', 'a']).withMessage('Array should have at most 2 items'); } }); @@ -312,7 +312,7 @@ suite('Preferences Model test', () => { test('min-max and enum', () => { const arr = new ArrayTester({ type: 'array', items: { type: 'string', enum: ['a', 'b'] }, minItems: 1, maxItems: 2 }); - arr.rejects(['a', 'b', 'c']).withMessage('Array must have less than 2 items'); + arr.rejects(['a', 'b', 'c']).withMessage('Array should have at most 2 items'); arr.rejects(['a', 'b', 'c']).withMessage(`Value 'c' is not one of`); }); From 35a8880109f28bbfc1dcc9f5305d32c195b60897 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:57:11 -0800 Subject: [PATCH 191/637] should -> must for #85841 --- .../services/preferences/common/preferencesModels.ts | 4 ++-- .../preferences/test/common/preferencesModel.test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/services/preferences/common/preferencesModels.ts b/src/vs/workbench/services/preferences/common/preferencesModels.ts index 91c30d0ef26..4fc5403acf3 100644 --- a/src/vs/workbench/services/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/services/preferences/common/preferencesModels.ts @@ -1051,12 +1051,12 @@ export function createValidator(prop: IConfigurationPropertySchema): (value: any } if (prop.minItems && stringArrayValue.length < prop.minItems) { - message += nls.localize('validations.stringArrayMinItem', 'Array should have at least {0} items', prop.minItems); + message += nls.localize('validations.stringArrayMinItem', 'Array must have at least {0} items', prop.minItems); message += '\n'; } if (prop.maxItems && stringArrayValue.length > prop.maxItems) { - message += nls.localize('validations.stringArrayMaxItem', 'Array should have at most {0} items', prop.maxItems); + message += nls.localize('validations.stringArrayMaxItem', 'Array must have at most {0} items', prop.maxItems); message += '\n'; } diff --git a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts index fc0f4db07c4..65673979df4 100644 --- a/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts +++ b/src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts @@ -288,10 +288,10 @@ suite('Preferences Model test', () => { test('min-max items array', () => { { const arr = new ArrayTester({ type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 2 }); - arr.rejects([]).withMessage('Array should have at least 1 items'); + arr.rejects([]).withMessage('Array must have at least 1 items'); arr.accepts(['a']); arr.accepts(['a', 'a']); - arr.rejects(['a', 'a', 'a']).withMessage('Array should have at most 2 items'); + arr.rejects(['a', 'a', 'a']).withMessage('Array must have at most 2 items'); } }); @@ -312,7 +312,7 @@ suite('Preferences Model test', () => { test('min-max and enum', () => { const arr = new ArrayTester({ type: 'array', items: { type: 'string', enum: ['a', 'b'] }, minItems: 1, maxItems: 2 }); - arr.rejects(['a', 'b', 'c']).withMessage('Array should have at most 2 items'); + arr.rejects(['a', 'b', 'c']).withMessage('Array must have at most 2 items'); arr.rejects(['a', 'b', 'c']).withMessage(`Value 'c' is not one of`); }); From bf78b9b6c02cce9121026a9fe0641057d71a86c4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 6 Dec 2019 09:10:44 +0100 Subject: [PATCH 192/637] use findMatchHighlight as default color for symbolHighlight, #84553 --- src/vs/editor/common/view/editorColorRegistry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/common/view/editorColorRegistry.ts b/src/vs/editor/common/view/editorColorRegistry.ts index 2901c23cc75..fbdb785c49b 100644 --- a/src/vs/editor/common/view/editorColorRegistry.ts +++ b/src/vs/editor/common/view/editorColorRegistry.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { Color, RGBA } from 'vs/base/common/color'; -import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry'; +import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder, editorFindMatchHighlight } from 'vs/platform/theme/common/colorRegistry'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; /** @@ -15,7 +15,7 @@ export const editorLineHighlight = registerColor('editor.lineHighlightBackground export const editorLineHighlightBorder = registerColor('editor.lineHighlightBorder', { dark: '#282828', light: '#eeeeee', hc: '#f38518' }, nls.localize('lineHighlightBorderBox', 'Background color for the border around the line at the cursor position.')); export const editorRangeHighlight = registerColor('editor.rangeHighlightBackground', { dark: '#ffffff0b', light: '#fdff0033', hc: null }, nls.localize('rangeHighlight', 'Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations.'), true); export const editorRangeHighlightBorder = registerColor('editor.rangeHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'), true); -export const editorSymbolHighlight = registerColor('editor.symbolHighlightBackground', { dark: editorRangeHighlight, light: editorRangeHighlight, hc: null }, nls.localize('symbolHighlight', 'Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations.'), true); +export const editorSymbolHighlight = registerColor('editor.symbolHighlightBackground', { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hc: null }, nls.localize('symbolHighlight', 'Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations.'), true); export const editorSymbolHighlightBorder = registerColor('editor.symbolHighlightBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'), true); export const editorCursorForeground = registerColor('editorCursor.foreground', { dark: '#AEAFAD', light: Color.black, hc: Color.white }, nls.localize('caret', 'Color of the editor cursor.')); From 116e9564d2a225979d0545d0339be7285af9697b Mon Sep 17 00:00:00 2001 From: Robert Jin Date: Fri, 6 Dec 2019 09:00:24 +0000 Subject: [PATCH 193/637] breadcrumbs set override config --- .../browser/parts/editor/breadcrumbsPicker.ts | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts index 1e3e4f00d81..76100e3f422 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.ts @@ -15,7 +15,7 @@ import { basename, dirname, isEqual } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import 'vs/css!./media/breadcrumbscontrol'; import { OutlineElement, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; import { FileKind, IFileService, IFileStat } from 'vs/platform/files/common/files'; import { IConstructorSignature1, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { WorkbenchDataTree, WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService'; @@ -102,7 +102,7 @@ export abstract class BreadcrumbsPicker { this._domNode.appendChild(this._treeContainer); this._layoutInfo = { maxHeight, width, arrowSize, arrowOffset, inputHeight: 0 }; - this._tree = this._createTree(this._treeContainer, input); + this._tree = this._createTree(this._treeContainer); this._disposables.add(this._tree.onDidChangeSelection(e => { if (e.browserEvent !== this._fakeEvent) { @@ -153,7 +153,7 @@ export abstract class BreadcrumbsPicker { } protected abstract _setInput(element: BreadcrumbElement): Promise; - protected abstract _createTree(container: HTMLElement, element: BreadcrumbElement): Tree; + protected abstract _createTree(container: HTMLElement): Tree; protected abstract _getTargetFromEvent(element: any): any | undefined; } @@ -359,7 +359,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { super(parent, instantiationService, themeService, configService); } - _createTree(container: HTMLElement, _: BreadcrumbElement) { + _createTree(container: HTMLElement) { // tree icon theme specials dom.addClass(this._treeContainer, 'file-icon-themable-tree'); @@ -429,6 +429,7 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker { export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { protected readonly _symbolSortOrder: BreadcrumbsConfig<'position' | 'name' | 'type'>; + protected _outlineComparator: OutlineItemComparator; constructor( parent: HTMLElement, @@ -438,9 +439,10 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { ) { super(parent, instantiationService, themeService, configurationService); this._symbolSortOrder = BreadcrumbsConfig.SymbolSortOrder.bindTo(this._configurationService); + this._outlineComparator = new OutlineItemComparator(); } - protected _createTree(container: HTMLElement, element: BreadcrumbElement) { + protected _createTree(container: HTMLElement) { return this._instantiationService.createInstance>( WorkbenchDataTree, 'BreadcrumbsOutlinePicker', @@ -452,7 +454,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { collapseByDefault: true, expandOnlyOnTwistieClick: true, multipleSelectionSupport: false, - sorter: new OutlineItemComparator(this._getOutlineItemCompareType(element)), + sorter: this._outlineComparator, identityProvider: new OutlineIdentityProvider(), keyboardNavigationLabelProvider: new OutlineNavigationLabelProvider(), filter: this._instantiationService.createInstance(OutlineFilter, 'breadcrumbs') @@ -471,6 +473,13 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { const tree = this._tree as WorkbenchDataTree; tree.setInput(model); + const textModel = model.textModel; + const overrideConfiguration = { + resource: textModel.uri, + overrideIdentifier: textModel.getLanguageIdentifier().language + }; + this._outlineComparator.type = this._getOutlineItemCompareType(overrideConfiguration); + if (element !== model) { tree.reveal(element, 0.5); tree.setFocus([element], this._fakeEvent); @@ -486,12 +495,8 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { } } - private _getOutlineItemCompareType(input: BreadcrumbElement): OutlineSortOrder { - const element = input as TreeElement; - const textModel = OutlineModel.get(element)!.textModel; - const resource = textModel.uri; - const overrideIdentifier = textModel.getLanguageIdentifier().language; - switch (this._symbolSortOrder.getValue({ resource, overrideIdentifier })) { + private _getOutlineItemCompareType(overrideConfiguration?: IConfigurationOverrides): OutlineSortOrder { + switch (this._symbolSortOrder.getValue(overrideConfiguration)) { case 'name': return OutlineSortOrder.ByName; case 'type': From a3d4c6d37f6099d0d35ca4c8e9389ce1a335ad19 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 6 Dec 2019 10:35:35 +0100 Subject: [PATCH 194/637] Ensure that the remote explorer isn't losing views Fixes https://github.com/microsoft/vscode-remote-release/issues/1902 --- src/vs/workbench/browser/parts/views/viewsViewlet.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index b178ef2f317..13968eb74c9 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -379,6 +379,9 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet { protected abstract getFilterOn(viewDescriptor: IViewDescriptor): string | undefined; private onFilterChanged(newFilterValue: string) { + if (this.allViews.size === 0) { + this.updateAllViews(this.viewsModel.viewDescriptors); + } this.getViewsNotForTarget(newFilterValue).forEach(item => this.viewsModel.setVisible(item.id, false)); this.getViewsForTarget(newFilterValue).forEach(item => this.viewsModel.setVisible(item.id, true)); } From 08b0a9bc59793f85e0ad5d84242c902f26706d2d Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 6 Dec 2019 10:40:38 +0100 Subject: [PATCH 195/637] Persisted data breakpoints are not registered when starting a new debug session fixes #83743 --- .../api/browser/mainThreadDebugService.ts | 4 ++-- src/vs/workbench/api/common/extHost.protocol.ts | 1 + .../contrib/debug/browser/breakpointsView.ts | 2 +- .../contrib/debug/browser/debugService.ts | 6 +++--- .../contrib/debug/browser/variablesView.ts | 2 +- src/vs/workbench/contrib/debug/common/debug.ts | 6 +++--- .../workbench/contrib/debug/common/debugModel.ts | 14 ++++++++------ 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 41005c20e4e..673177f0f01 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -141,7 +141,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb } else if (dto.type === 'function') { this.debugService.addFunctionBreakpoint(dto.functionName, dto.id); } else if (dto.type === 'data') { - this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist); + this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes); } } return Promise.resolve(); @@ -336,7 +336,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb condition: dbp.condition, hitCondition: dbp.hitCondition, logMessage: dbp.logMessage, - label: dbp.label, + label: dbp.description, canPersist: dbp.canPersist }; } else { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index b7d4837a61e..3dab81c9c55 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1287,6 +1287,7 @@ export interface IDataBreakpointDto extends IBreakpointDto { dataId: string; canPersist: boolean; label: string; + accessTypes?: DebugProtocol.DataBreakpointAccessType[]; } export interface ISourceBreakpointDto extends IBreakpointDto { diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index d9711706037..8d19e351841 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -500,7 +500,7 @@ class DataBreakpointsRenderer implements IListRenderer { - this.model.addDataBreakpoint(label, dataId, canPersist); + async addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise { + this.model.addDataBreakpoint(label, dataId, canPersist, accessTypes); await this.sendDataBreakpoints(); this.storeBreakpoints(); @@ -1100,7 +1100,7 @@ export class DebugService implements IDebugService { let result: DataBreakpoint[] | undefined; try { result = JSON.parse(this.storageService.get(DEBUG_DATA_BREAKPOINTS_KEY, StorageScope.WORKSPACE, '[]')).map((dbp: any) => { - return new DataBreakpoint(dbp.label, dbp.dataId, true, dbp.enabled, dbp.hitCondition, dbp.condition, dbp.logMessage); + return new DataBreakpoint(dbp.description, dbp.dataId, true, dbp.enabled, dbp.hitCondition, dbp.condition, dbp.logMessage, dbp.accessTypes); }); } catch (e) { } diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index 81012b401ae..fb82b157b50 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -185,7 +185,7 @@ export class VariablesView extends ViewletPane { if (dataid) { actions.push(new Separator()); actions.push(new Action('debug.breakWhenValueChanges', nls.localize('breakWhenValueChanges', "Break When Value Changes"), undefined, true, () => { - return this.debugService.addDataBreakpoint(response.description, dataid, !!response.canPersist); + return this.debugService.addDataBreakpoint(response.description, dataid, !!response.canPersist, response.accessTypes); })); } } diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 9b87af8cbe4..88ac5aa6786 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -215,7 +215,7 @@ export interface IDebugSession extends ITreeElement { sendBreakpoints(modelUri: uri, bpts: IBreakpoint[], sourceModified: boolean): Promise; sendFunctionBreakpoints(fbps: IFunctionBreakpoint[]): Promise; - dataBreakpointInfo(name: string, variablesReference?: number): Promise<{ dataId: string | null, description: string, canPersist?: boolean }>; + dataBreakpointInfo(name: string, variablesReference?: number): Promise<{ dataId: string | null, description: string, canPersist?: boolean, accessTypes?: DebugProtocol.DataBreakpointAccessType[] }>; sendDataBreakpoints(dbps: IDataBreakpoint[]): Promise; sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise; breakpointsLocations(uri: uri, lineNumber: number): Promise; @@ -377,7 +377,7 @@ export interface IExceptionBreakpoint extends IEnablement { } export interface IDataBreakpoint extends IBaseBreakpoint { - readonly label: string; + readonly description: string; readonly dataId: string; readonly canPersist: boolean; } @@ -795,7 +795,7 @@ export interface IDebugService { /** * Adds a new data breakpoint. */ - addDataBreakpoint(label: string, dataId: string, canPersist: boolean): Promise; + addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise; /** * Removes all data breakpoints. If id is passed only removes the data breakpoint with the passed id. diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 311ac19dcf7..5ad9aa7d55d 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -748,13 +748,14 @@ export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreak export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { constructor( - public label: string, + public description: string, public dataId: string, public canPersist: boolean, enabled: boolean, hitCondition: string | undefined, condition: string | undefined, logMessage: string | undefined, + private accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined, id = generateUuid() ) { super(enabled, hitCondition, condition, logMessage, id); @@ -762,8 +763,9 @@ export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { toJSON(): any { const result = super.toJSON(); - result.label = this.label; - result.dataid = this.dataId; + result.description = this.description; + result.dataId = this.dataId; + result.accessTypes = this.accessTypes; return result; } @@ -777,7 +779,7 @@ export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { } toString(): string { - return this.label; + return this.description; } } @@ -1159,8 +1161,8 @@ export class DebugModel implements IDebugModel { this._onDidChangeBreakpoints.fire({ removed }); } - addDataBreakpoint(label: string, dataId: string, canPersist: boolean): void { - const newDataBreakpoint = new DataBreakpoint(label, dataId, canPersist, true, undefined, undefined, undefined); + addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): void { + const newDataBreakpoint = new DataBreakpoint(label, dataId, canPersist, true, undefined, undefined, undefined, accessTypes); this.dataBreakopints.push(newDataBreakpoint); this._onDidChangeBreakpoints.fire({ added: [newDataBreakpoint] }); } From 3f36811cf252fcded080998b18e759628b07c13b Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Fri, 6 Dec 2019 05:12:08 -0500 Subject: [PATCH 196/637] Fixes #86431 --- src/vs/base/browser/ui/selectBox/selectBox.ts | 2 ++ .../browser/ui/selectBox/selectBoxCustom.ts | 18 ++++++++++++------ .../preferences/browser/settingsTree.ts | 9 +++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/vs/base/browser/ui/selectBox/selectBox.ts b/src/vs/base/browser/ui/selectBox/selectBox.ts index c92601b96ba..cff14f50206 100644 --- a/src/vs/base/browser/ui/selectBox/selectBox.ts +++ b/src/vs/base/browser/ui/selectBox/selectBox.ts @@ -9,6 +9,7 @@ import { Event } from 'vs/base/common/event'; import { Widget } from 'vs/base/browser/ui/widget'; import { Color } from 'vs/base/common/color'; import { deepClone } from 'vs/base/common/objects'; +import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { IListStyles } from 'vs/base/browser/ui/list/listWidget'; import { SelectBoxNative } from 'vs/base/browser/ui/selectBox/selectBoxNative'; @@ -47,6 +48,7 @@ export interface ISelectOptionItem { decoratorRight?: string; description?: string; descriptionIsMarkdown?: boolean; + descriptionMarkdownActionHandler?: IContentActionHandler; isDisabled?: boolean; } diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index 7e6ee0f7f6a..07258ce3bef 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -19,6 +19,7 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { ISelectBoxDelegate, ISelectOptionItem, ISelectBoxOptions, ISelectBoxStyles, ISelectData } from 'vs/base/browser/ui/selectBox/selectBox'; import { isMacintosh } from 'vs/base/common/platform'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; +import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer'; const $ = dom.$; @@ -748,11 +749,16 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi .filter(() => this.selectList.length > 0) .on(e => this.onMouseUp(e), this)); - - this._register(this.selectList.onDidBlur(_ => this.onListBlur())); this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index]))); this._register(this.selectList.onFocusChange(e => this.onListFocus(e))); + this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => { + if (!this._isVisible || dom.isAncestor(e.relatedTarget as HTMLElement, this.selectDropDownContainer)) { + return; + } + this.onListBlur(); + })); + this.selectList.getHTMLElement().setAttribute('aria-label', this.selectBoxOptions.ariaLabel || ''); this.selectList.getHTMLElement().setAttribute('aria-expanded', 'true'); @@ -823,7 +829,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi } - private renderDescriptionMarkdown(text: string): HTMLElement { + private renderDescriptionMarkdown(text: string, actionHandler?: IContentActionHandler): HTMLElement { const cleanRenderedMarkdown = (element: Node) => { for (let i = 0; i < element.childNodes.length; i++) { const child = element.childNodes.item(i); @@ -837,7 +843,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi } }; - const renderedMarkdown = renderMarkdown({ value: text }); + const renderedMarkdown = renderMarkdown({ value: text }, { actionHandler }); renderedMarkdown.classList.add('select-box-description-markdown'); cleanRenderedMarkdown(renderedMarkdown); @@ -859,7 +865,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi if (description) { if (descriptionIsMarkdown) { - this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description)); + const actionHandler = this.options[selectedIndex].descriptionMarkdownActionHandler; + this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description, actionHandler)); } else { this.selectionDetailsPane.innerText = description; } @@ -872,7 +879,6 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi this._skipLayout = true; this.contextViewProvider.layout(); this._skipLayout = false; - } // List keyboard controller diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index f953fb205e6..226f584ad2d 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -959,6 +959,9 @@ export class SettingEnumRenderer extends AbstractSettingRenderer implements ITre const enumDescriptions = dataElement.setting.enumDescriptions; const enumDescriptionsAreMarkdown = dataElement.setting.enumDescriptionsAreMarkdown; + const disposables = new DisposableStore(); + template.toDispose.push(disposables); + const displayOptions = dataElement.setting.enum! .map(String) .map(escapeInvisibleChars) @@ -966,6 +969,12 @@ export class SettingEnumRenderer extends AbstractSettingRenderer implements ITre text: data, description: (enumDescriptions && enumDescriptions[index] && (enumDescriptionsAreMarkdown ? fixSettingLinks(enumDescriptions[index], false) : enumDescriptions[index])), descriptionIsMarkdown: enumDescriptionsAreMarkdown, + descriptionMarkdownActionHandler: { + callback: (content) => { + this._openerService.open(content).catch(onUnexpectedError); + }, + disposeables: disposables + }, decoratorRight: (data === dataElement.defaultValue ? localize('settings.Default', "{0}", 'default') : '') }); From 54151bb664bd866c960866cf3c4926ad42a862dd Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Fri, 6 Dec 2019 12:23:17 +0100 Subject: [PATCH 197/637] [semantic tokens] Use singular for token type names Fixes #86281 --- .../src/colorizerTestMain.ts | 2 +- .../common/tokenClassificationRegistry.ts | 61 +++++----- .../tokenStyleResolving.test.ts | 106 +++++++++--------- 3 files changed, 87 insertions(+), 82 deletions(-) diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index e9536994cf7..7f30a330ffb 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -8,7 +8,7 @@ import * as jsoncParser from 'jsonc-parser'; export function activate(context: vscode.ExtensionContext): any { - const tokenTypes = ['types', 'structs', 'classes', 'interfaces', 'enums', 'parameterTypes', 'functions', 'variables']; + const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable']; const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); diff --git a/src/vs/platform/theme/common/tokenClassificationRegistry.ts b/src/vs/platform/theme/common/tokenClassificationRegistry.ts index 3fa3e0c9c46..fa4303f57a9 100644 --- a/src/vs/platform/theme/common/tokenClassificationRegistry.ts +++ b/src/vs/platform/theme/common/tokenClassificationRegistry.ts @@ -320,40 +320,45 @@ export function getTokenClassificationRegistry(): ITokenClassificationRegistry { return tokenClassificationRegistry; } -export const comments = registerTokenType('comments', nls.localize('comments', "Style for comments."), [['comment']]); -export const strings = registerTokenType('strings', nls.localize('strings', "Style for strings."), [['string']]); -export const keywords = registerTokenType('keywords', nls.localize('keywords', "Style for keywords."), [['keyword.control']]); -export const numbers = registerTokenType('numbers', nls.localize('numbers', "Style for numbers."), [['constant.numeric']]); -export const regexp = registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); -export const operators = registerTokenType('operators', nls.localize('operator', "Style for operators."), [['keyword.operator']]); +// default token types -export const namespaces = registerTokenType('namespaces', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); +registerTokenType('comment', nls.localize('comment', "Style for comments."), [['comment']]); +registerTokenType('string', nls.localize('string', "Style for strings."), [['string']]); +registerTokenType('keyword', nls.localize('keyword', "Style for keywords."), [['keyword.control']]); +registerTokenType('number', nls.localize('number', "Style for numbers."), [['constant.numeric']]); +registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); +registerTokenType('operator', nls.localize('operator', "Style for operators."), [['keyword.operator']]); -export const types = registerTokenType('types', nls.localize('types', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); -export const structs = registerTokenType('structs', nls.localize('struct', "Style for structs."), [['storage.type.struct']], types); -export const classes = registerTokenType('classes', nls.localize('class', "Style for classes."), [['entity.name.class']], types); -export const interfaces = registerTokenType('interfaces', nls.localize('interface', "Style for interfaces."), undefined, types); -export const enums = registerTokenType('enums', nls.localize('enum', "Style for enums."), undefined, types); -export const parameterTypes = registerTokenType('parameterTypes', nls.localize('parameterType', "Style for parameter types."), undefined, types); +registerTokenType('namespace', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); -export const functions = registerTokenType('functions', nls.localize('functions', "Style for functions"), [['entity.name.function'], ['support.function']]); -export const macros = registerTokenType('macros', nls.localize('macro', "Style for macros."), undefined, functions); +registerTokenType('type', nls.localize('type', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); +registerTokenType('struct', nls.localize('struct', "Style for structs."), [['storage.type.struct']], 'type'); +registerTokenType('class', nls.localize('class', "Style for classes."), [['entity.name.class']], 'type'); +registerTokenType('interface', nls.localize('interface', "Style for interfaces."), undefined, 'type'); +registerTokenType('enum', nls.localize('enum', "Style for enums."), undefined, 'type'); +registerTokenType('parameterType', nls.localize('parameterType', "Style for parameter types."), undefined, 'type'); -export const variables = registerTokenType('variables', nls.localize('variables', "Style for variables."), [['variable'], ['entity.name.variable']]); -export const constants = registerTokenType('constants', nls.localize('constants', "Style for constants."), undefined, variables); -export const parameters = registerTokenType('parameters', nls.localize('parameters', "Style for parameters."), undefined, variables); -export const property = registerTokenType('properties', nls.localize('properties', "Style for properties."), undefined, variables); +registerTokenType('function', nls.localize('function', "Style for functions"), [['entity.name.function'], ['support.function']]); +registerTokenType('macro', nls.localize('macro', "Style for macros."), undefined, 'function'); -export const labels = registerTokenType('labels', nls.localize('labels', "Style for labels. "), undefined); +registerTokenType('variable', nls.localize('variable', "Style for variables."), [['variable'], ['entity.name.variable']]); +registerTokenType('constant', nls.localize('constant', "Style for constants."), undefined, 'variable'); +registerTokenType('parameter', nls.localize('parameter', "Style for parameters."), undefined, 'variable'); +registerTokenType('property', nls.localize('propertie', "Style for properties."), undefined, 'variable'); + +registerTokenType('label', nls.localize('labels', "Style for labels. "), undefined); + +// default token modifiers + +registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); +registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); +registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); +registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); +registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); +registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); +registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); +registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); -export const m_declaration = registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); -export const m_documentation = registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); -export const m_member = registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); -export const m_static = registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); -export const m_abstract = registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); -export const m_deprecated = registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); -export const m_modification = registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); -export const m_async = registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); function bitCount(u: number) { // https://blogs.msdn.microsoft.com/jeuge/2005/06/08/bit-fiddling-3/ diff --git a/src/vs/workbench/services/themes/test/electron-browser/tokenStyleResolving.test.ts b/src/vs/workbench/services/themes/test/electron-browser/tokenStyleResolving.test.ts index b256164b7b4..0e84f4e22c4 100644 --- a/src/vs/workbench/services/themes/test/electron-browser/tokenStyleResolving.test.ts +++ b/src/vs/workbench/services/themes/test/electron-browser/tokenStyleResolving.test.ts @@ -6,7 +6,7 @@ import { ColorThemeData } from 'vs/workbench/services/themes/common/colorThemeData'; import * as assert from 'assert'; import { ITokenColorCustomizations } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { TokenStyle, comments, variables, types, functions, keywords, numbers, strings, getTokenClassificationRegistry } from 'vs/platform/theme/common/tokenClassificationRegistry'; +import { TokenStyle, getTokenClassificationRegistry } from 'vs/platform/theme/common/tokenClassificationRegistry'; import { Color } from 'vs/base/common/color'; import { isString } from 'vs/base/common/types'; import { FileService } from 'vs/platform/files/common/fileService'; @@ -107,13 +107,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#88846f', undefinedStyle), - [variables]: ts('#F8F8F2', unsetStyle), - [types]: ts('#A6E22E', { underline: true }), - [functions]: ts('#A6E22E', unsetStyle), - [strings]: ts('#E6DB74', undefinedStyle), - [numbers]: ts('#AE81FF', undefinedStyle), - [keywords]: ts('#F92672', undefinedStyle) + 'comment': ts('#88846f', undefinedStyle), + 'variable': ts('#F8F8F2', unsetStyle), + 'type': ts('#A6E22E', { underline: true }), + 'function': ts('#A6E22E', unsetStyle), + 'string': ts('#E6DB74', undefinedStyle), + 'number': ts('#AE81FF', undefinedStyle), + 'keyword': ts('#F92672', undefinedStyle) }); }); @@ -127,13 +127,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#6A9955', undefinedStyle), - [variables]: ts('#9CDCFE', undefinedStyle), - [types]: ts('#4EC9B0', undefinedStyle), - [functions]: ts('#DCDCAA', undefinedStyle), - [strings]: ts('#CE9178', undefinedStyle), - [numbers]: ts('#B5CEA8', undefinedStyle), - [keywords]: ts('#C586C0', undefinedStyle) + 'comment': ts('#6A9955', undefinedStyle), + 'variable': ts('#9CDCFE', undefinedStyle), + 'type': ts('#4EC9B0', undefinedStyle), + 'function': ts('#DCDCAA', undefinedStyle), + 'string': ts('#CE9178', undefinedStyle), + 'number': ts('#B5CEA8', undefinedStyle), + 'keyword': ts('#C586C0', undefinedStyle) }); }); @@ -147,13 +147,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#008000', undefinedStyle), - [variables]: ts(undefined, undefinedStyle), - [types]: ts(undefined, undefinedStyle), - [functions]: ts(undefined, undefinedStyle), - [strings]: ts('#a31515', undefinedStyle), - [numbers]: ts('#09885a', undefinedStyle), - [keywords]: ts('#0000ff', undefinedStyle) + 'comment': ts('#008000', undefinedStyle), + 'variable': ts(undefined, undefinedStyle), + 'type': ts(undefined, undefinedStyle), + 'function': ts(undefined, undefinedStyle), + 'string': ts('#a31515', undefinedStyle), + 'number': ts('#09885a', undefinedStyle), + 'keyword': ts('#0000ff', undefinedStyle) }); }); @@ -167,13 +167,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#7ca668', undefinedStyle), - [variables]: ts('#9CDCFE', undefinedStyle), - [types]: ts('#4EC9B0', undefinedStyle), - [functions]: ts('#DCDCAA', undefinedStyle), - [strings]: ts('#ce9178', undefinedStyle), - [numbers]: ts('#b5cea8', undefinedStyle), - [keywords]: ts('#C586C0', undefinedStyle) + 'comment': ts('#7ca668', undefinedStyle), + 'variable': ts('#9CDCFE', undefinedStyle), + 'type': ts('#4EC9B0', undefinedStyle), + 'function': ts('#DCDCAA', undefinedStyle), + 'string': ts('#ce9178', undefinedStyle), + 'number': ts('#b5cea8', undefinedStyle), + 'keyword': ts('#C586C0', undefinedStyle) }); }); @@ -187,13 +187,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#a57a4c', undefinedStyle), - [variables]: ts('#dc3958', undefinedStyle), - [types]: ts('#f06431', undefinedStyle), - [functions]: ts('#8ab1b0', undefinedStyle), - [strings]: ts('#889b4a', undefinedStyle), - [numbers]: ts('#f79a32', undefinedStyle), - [keywords]: ts('#98676a', undefinedStyle) + 'comment': ts('#a57a4c', undefinedStyle), + 'variable': ts('#dc3958', undefinedStyle), + 'type': ts('#f06431', undefinedStyle), + 'function': ts('#8ab1b0', undefinedStyle), + 'string': ts('#889b4a', undefinedStyle), + 'number': ts('#f79a32', undefinedStyle), + 'keyword': ts('#98676a', undefinedStyle) }); }); @@ -207,13 +207,13 @@ suite('Themes - TokenStyleResolving', () => { assert.equal(themeData.isLoaded, true); assertTokenStyles(themeData, { - [comments]: ts('#384887', undefinedStyle), - [variables]: ts(undefined, unsetStyle), - [types]: ts('#ffeebb', { underline: true }), - [functions]: ts('#ddbb88', unsetStyle), - [strings]: ts('#22aa44', undefinedStyle), - [numbers]: ts('#f280d0', undefinedStyle), - [keywords]: ts('#225588', undefinedStyle) + 'comment': ts('#384887', undefinedStyle), + 'variable': ts(undefined, unsetStyle), + 'type': ts('#ffeebb', { underline: true }), + 'function': ts('#ddbb88', unsetStyle), + 'string': ts('#22aa44', undefinedStyle), + 'number': ts('#f280d0', undefinedStyle), + 'keyword': ts('#225588', undefinedStyle) }); }); @@ -301,8 +301,8 @@ suite('Themes - TokenStyleResolving', () => { const themeData = ColorThemeData.createLoadedEmptyTheme('test', 'test'); themeData.setCustomColors({ 'editor.foreground': '#000000' }); themeData.setCustomTokenStyleRules({ - 'types': '#ff0000', - 'classes': { foreground: '#0000ff', fontStyle: 'italic' }, + 'type': '#ff0000', + 'class': { foreground: '#0000ff', fontStyle: 'italic' }, '*.static': { fontStyle: 'bold' }, '*.declaration': { fontStyle: 'italic' }, '*.async.static': { fontStyle: 'italic underline' }, @@ -310,14 +310,14 @@ suite('Themes - TokenStyleResolving', () => { }); assertTokenStyles(themeData, { - 'types': ts('#ff0000', undefinedStyle), - 'types.static': ts('#ff0000', { bold: true }), - 'types.static.declaration': ts('#ff0000', { bold: true, italic: true }), - 'classes': ts('#0000ff', { italic: true }), - 'classes.static.declaration': ts('#0000ff', { bold: true, italic: true }), - 'classes.declaration': ts('#0000ff', { italic: true }), - 'classes.declaration.async': ts('#000fff', { underline: true, italic: false }), - 'classes.declaration.async.static': ts('#000fff', { italic: true, underline: true, bold: true }), + 'type': ts('#ff0000', undefinedStyle), + 'type.static': ts('#ff0000', { bold: true }), + 'type.static.declaration': ts('#ff0000', { bold: true, italic: true }), + 'class': ts('#0000ff', { italic: true }), + 'class.static.declaration': ts('#0000ff', { bold: true, italic: true }), + 'class.declaration': ts('#0000ff', { italic: true }), + 'class.declaration.async': ts('#000fff', { underline: true, italic: false }), + 'class.declaration.async.static': ts('#000fff', { italic: true, underline: true, bold: true }), }); }); From d386b49dee6267238389c0a616af2be89726a4e3 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 6 Dec 2019 12:26:31 +0100 Subject: [PATCH 198/637] fixes #85148 --- .../ui/codiconLabel/codicon/codicon.css | 1 - .../contrib/debug/browser/breakpointsView.ts | 19 ---------------- .../browser/debugCallStackContribution.ts | 7 +++--- .../browser/media/debug.contribution.css | 22 +++---------------- .../debug/browser/media/debugViewlet.css | 4 ---- 5 files changed, 6 insertions(+), 47 deletions(-) diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css index 2e259eda4f2..162038bd8e5 100644 --- a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css +++ b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css @@ -396,7 +396,6 @@ .codicon-debug-breakpoint-function:before { content: "\eb88" } .codicon-debug-breakpoint-function-disabled:before { content: "\eb88" } .codicon-debug-breakpoint-stackframe-active:before { content: "\eb89" } -.codicon-debug-breakpoint-stackframe-dot:before { content: "\eb8a" } .codicon-debug-breakpoint-stackframe:before { content: "\eb8b" } .codicon-debug-breakpoint-stackframe-focused:before { content: "\eb8b" } .codicon-debug-breakpoint-unsupported:before { content: "\eb8c" } diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index 8d19e351841..7f277994bb7 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -713,25 +713,6 @@ export function getBreakpointMessageAndClassName(debugService: IDebugService, br }; } - const focusedThread = debugService.getViewModel().focusedThread; - if (focusedThread) { - const callStack = focusedThread ? focusedThread.getCallStack() : undefined; - const topStackFrame = callStack ? callStack[0] : undefined; - if (topStackFrame && topStackFrame.source.uri.toString() === breakpoint.uri.toString() && topStackFrame.range.startLineNumber === breakpoint.lineNumber) { - if (topStackFrame.range.startColumn === breakpoint.column) { - return { - className: 'codicon-debug-breakpoint-stackframe-dot', - message: breakpoint.message || nls.localize('breakpoint', "Breakpoint") - }; - } else if (breakpoint.column === undefined) { - return { - className: 'codicon-debug-breakpoint', - message: breakpoint.message || nls.localize('breakpoint', "Breakpoint") - }; - } - } - } - return { className: 'codicon-debug-breakpoint', message: breakpoint.message || nls.localize('breakpoint', "Breakpoint") diff --git a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts index ee22aee0239..dc262b161e6 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts @@ -187,8 +187,8 @@ registerThemingParticipant((theme, collector) => { .monaco-workbench .codicon-debug-breakpoint-data, .monaco-workbench .codicon-debug-breakpoint-unsupported, .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), - .monaco-workbench .codicon-debug-breakpoint-stackframe-dot, - .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after { + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after, + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after { color: ${debugIconBreakpointColor} !important; } `); @@ -215,8 +215,7 @@ registerThemingParticipant((theme, collector) => { const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); if (debugIconBreakpointCurrentStackframeForegroundColor) { collector.addRule(` - .monaco-workbench .codicon-debug-breakpoint-stackframe, - .monaco-workbench .codicon-debug-breakpoint-stackframe-dot::after { + .monaco-workbench .codicon-debug-breakpoint-stackframe { color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; } `); diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index 215fb619865..858d8cbacd7 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -16,26 +16,10 @@ align-items: center; } -/* overlapped icons */ -.inline-breakpoint-widget.codicon-debug-breakpoint-stackframe-dot::after { - position: absolute; - top: 0; - left: 0; - bottom: 0; - margin: auto; - display: table; -} - -.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after { - position: absolute; -} - -.inline-breakpoint-widget.codicon-debug-breakpoint-stackframe-dot::after { - content: "\eb8b"; -} - -.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after { +.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after, +.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after { content: "\eb8a"; + position: absolute; } .monaco-editor .inline-breakpoint-widget.line-start { diff --git a/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css b/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css index e40b50a0900..4ccff4262eb 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css +++ b/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css @@ -374,10 +374,6 @@ justify-content: center; } -.debug-viewlet .debug-breakpoints .breakpoint > .codicon-debug-breakpoint-stackframe-dot::before { - content: "\ea71"; -} - .debug-viewlet .debug-breakpoints .breakpoint > .file-path { opacity: 0.7; font-size: 0.9em; From c61f36effb85c2d5dded7e178d1698e164efb726 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 15:16:36 +0100 Subject: [PATCH 199/637] feedback - position flyout properly --- src/vs/workbench/contrib/feedback/browser/feedback.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/feedback/browser/feedback.ts b/src/vs/workbench/contrib/feedback/browser/feedback.ts index ae6f9bcbbd7..8e1c9cf3615 100644 --- a/src/vs/workbench/contrib/feedback/browser/feedback.ts +++ b/src/vs/workbench/contrib/feedback/browser/feedback.ts @@ -94,7 +94,7 @@ export class FeedbackDropdown extends Dropdown { return { x: position.left + position.width, // center above the container - y: position.top - 9, // above status bar + y: position.top - 26, // above status bar and beak width: position.width, height: position.height }; From e7aa84d8abef0e44457911175fb4f9af34c45f72 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 15:55:40 +0100 Subject: [PATCH 200/637] web - no errors when deleting files that do not exist (inMemory) --- .../common/inMemoryUserDataProvider.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/services/userData/common/inMemoryUserDataProvider.ts b/src/vs/workbench/services/userData/common/inMemoryUserDataProvider.ts index 8bd82779eb6..e16556e463b 100644 --- a/src/vs/workbench/services/userData/common/inMemoryUserDataProvider.ts +++ b/src/vs/workbench/services/userData/common/inMemoryUserDataProvider.ts @@ -131,16 +131,19 @@ export class InMemoryFileSystemProvider extends Disposable implements IFileSyste } async delete(resource: URI, opts: FileDeleteOptions): Promise { - let dirname = resources.dirname(resource); - let basename = resources.basename(resource); - let parent = this._lookupAsDirectory(dirname, false); - if (!parent.entries.has(basename)) { - throw new FileSystemProviderError('file not found', FileSystemProviderErrorCode.FileNotFound); + try { + let dirname = resources.dirname(resource); + let basename = resources.basename(resource); + let parent = this._lookupAsDirectory(dirname, false); + if (parent.entries.has(basename)) { + parent.entries.delete(basename); + parent.mtime = Date.now(); + parent.size -= 1; + this._fireSoon({ type: FileChangeType.UPDATED, resource: dirname }, { resource, type: FileChangeType.DELETED }); + } + } catch (error) { + // ignore if resource does not exist to keep parity with other file system providers } - parent.entries.delete(basename); - parent.mtime = Date.now(); - parent.size -= 1; - this._fireSoon({ type: FileChangeType.UPDATED, resource: dirname }, { resource, type: FileChangeType.DELETED }); } async mkdir(resource: URI): Promise { From 88cba08d9dd8f99baeda74bb2202773e09ed881e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 16:00:17 +0100 Subject: [PATCH 201/637] update proposed API with my items and remove deprecations --- src/vs/vscode.proposed.d.ts | 22 +------------------ .../workbench/api/browser/mainThreadUrls.ts | 10 --------- .../workbench/api/common/extHost.api.impl.ts | 4 ---- .../workbench/api/common/extHost.protocol.ts | 1 - src/vs/workbench/api/common/extHostUrls.ts | 4 ---- 5 files changed, 1 insertion(+), 40 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 19a434638c0..3e9061a0917 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1056,7 +1056,7 @@ declare module 'vscode' { } //#endregion - //#region Ben - status bar item with ID and Name + //#region Status bar item with ID and Name: https://github.com/microsoft/vscode/issues/74972 export namespace window { @@ -1104,26 +1104,6 @@ declare module 'vscode' { //#endregion - //#region Ben - extension auth flow (desktop+web) - - export interface AppUriOptions { - payload?: { - path?: string; - query?: string; - fragment?: string; - }; - } - - export namespace env { - - /** - * @deprecated use `vscode.env.asExternalUri` instead. - */ - export function createAppUri(options?: AppUriOptions): Thenable; - } - - //#endregion - //#region Custom editors: https://github.com/microsoft/vscode/issues/77131 /** diff --git a/src/vs/workbench/api/browser/mainThreadUrls.ts b/src/vs/workbench/api/browser/mainThreadUrls.ts index beda98076af..ecbbecba852 100644 --- a/src/vs/workbench/api/browser/mainThreadUrls.ts +++ b/src/vs/workbench/api/browser/mainThreadUrls.ts @@ -72,16 +72,6 @@ export class MainThreadUrls implements MainThreadUrlsShape { return this.urlService.create(uri); } - async $proposedCreateAppUri(extensionId: ExtensionIdentifier, options?: { payload?: Partial }): Promise { - const payload: Partial = options && options.payload ? options.payload : Object.create(null); - - // we define the authority to be the extension ID to ensure - // that the Uri gets routed back to the extension properly. - payload.authority = extensionId.value; - - return this.urlService.create(payload); - } - dispose(): void { this.handlers.forEach(({ disposable }) => disposable.dispose()); this.handlers.clear(); diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index ea5ad7991fa..a57e6cdfd26 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -225,10 +225,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I get appName() { return initData.environment.appName; }, get appRoot() { return initData.environment.appRoot!.fsPath; }, get uriScheme() { return initData.environment.appUriScheme; }, - createAppUri(options?) { - checkProposedApiEnabled(extension); - return extHostUrls.proposedCreateAppUri(extension.identifier, options); - }, get logLevel() { checkProposedApiEnabled(extension); return typeConverters.LogLevel.to(extHostLogService.getLevel()); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 3dab81c9c55..597271afd93 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -610,7 +610,6 @@ export interface MainThreadUrlsShape extends IDisposable { $registerUriHandler(handle: number, extensionId: ExtensionIdentifier): Promise; $unregisterUriHandler(handle: number): Promise; $createAppUri(uri: UriComponents): Promise; - $proposedCreateAppUri(extensionId: ExtensionIdentifier, options?: { payload?: Partial; }): Promise; } export interface ExtHostUrlsShape { diff --git a/src/vs/workbench/api/common/extHostUrls.ts b/src/vs/workbench/api/common/extHostUrls.ts index 0a4480a63e8..6b484fe0dec 100644 --- a/src/vs/workbench/api/common/extHostUrls.ts +++ b/src/vs/workbench/api/common/extHostUrls.ts @@ -59,8 +59,4 @@ export class ExtHostUrls implements ExtHostUrlsShape { async createAppUri(uri: URI): Promise { return URI.revive(await this._proxy.$createAppUri(uri)); } - - async proposedCreateAppUri(extensionId: ExtensionIdentifier, options?: vscode.AppUriOptions): Promise { - return URI.revive(await this._proxy.$proposedCreateAppUri(extensionId, options)); - } } From f8af750771f6c204e8ab7aeafeb70121941ee9af Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 16:27:28 +0100 Subject: [PATCH 202/637] wrong order of next/prev buttons at touchbar (fixes #85453) --- .../workbench/browser/parts/editor/editor.contribution.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 1ef06d08acd..0b6c52389d7 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -422,12 +422,14 @@ editorCommands.setup(); if (isMacintosh) { MenuRegistry.appendMenuItem(MenuId.TouchBarContext, { command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: { dark: URI.parse(require.toUrl('vs/workbench/browser/parts/editor/media/back-tb.png')) } }, - group: 'navigation' + group: 'navigation', + order: 0 }); MenuRegistry.appendMenuItem(MenuId.TouchBarContext, { command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: { dark: URI.parse(require.toUrl('vs/workbench/browser/parts/editor/media/forward-tb.png')) } }, - group: 'navigation' + group: 'navigation', + order: 1 }); } From 6e18f025a46955c5a909e28b347489804891f58a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 17:34:28 +0100 Subject: [PATCH 203/637] Preserve language and encoding when dragging file (normal or untitled) to other window (fixes #85770) --- src/vs/workbench/browser/dnd.ts | 49 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index 0ae62d5354f..d4884d5c2a7 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -39,6 +39,7 @@ export interface IDraggedResource { } export class DraggedEditorIdentifier { + constructor(private _identifier: IEditorIdentifier) { } get identifier(): IEditorIdentifier { @@ -47,6 +48,7 @@ export class DraggedEditorIdentifier { } export class DraggedEditorGroupIdentifier { + constructor(private _identifier: GroupIdentifier) { } get identifier(): GroupIdentifier { @@ -56,13 +58,17 @@ export class DraggedEditorGroupIdentifier { export interface IDraggedEditor extends IDraggedResource { backupResource?: URI; + encoding?: string; + mode?: string; viewState?: IEditorViewState; } export interface ISerializedDraggedEditor { resource: string; backupResource?: string; - viewState: IEditorViewState | null; + encoding?: string; + mode?: string; + viewState?: IEditorViewState; } export const CodeDataTransfers = { @@ -86,7 +92,9 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array ({ resource: untitledOrFileResource.resource, + encoding: (untitledOrFileResource as IDraggedEditor).encoding, + mode: (untitledOrFileResource as IDraggedEditor).mode, options: { pinned: true, index: targetIndex, @@ -234,7 +244,7 @@ export class ResourcesDropHandler { // Untitled: always ensure that we open a new untitled for each file we drop if (droppedDirtyEditor.resource.scheme === Schemas.untitled) { - droppedDirtyEditor.resource = this.untitledTextEditorService.createOrGet().getResource(); + droppedDirtyEditor.resource = this.untitledTextEditorService.createOrGet(undefined, droppedDirtyEditor.mode, undefined, droppedDirtyEditor.encoding).getResource(); } // Return early if the resource is already dirty in target or opened already @@ -342,6 +352,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources: // Editors: enables cross window DND of tabs into the editor area const textFileService = accessor.get(ITextFileService); + const untitledTextEditorService = accessor.get(IUntitledTextEditorService); const backupFileService = accessor.get(IBackupFileService); const editorService = accessor.get(IEditorService); @@ -349,24 +360,42 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources: files.forEach(file => { // Try to find editor view state from the visible editors that match given resource - let viewState: IEditorViewState | null = null; + let viewState: IEditorViewState | undefined = undefined; const textEditorWidgets = editorService.visibleTextEditorWidgets; for (const textEditorWidget of textEditorWidgets) { if (isCodeEditor(textEditorWidget)) { const model = textEditorWidget.getModel(); if (model?.uri?.toString() === file.resource.toString()) { - viewState = textEditorWidget.saveViewState(); + viewState = withNullAsUndefined(textEditorWidget.saveViewState()); break; } } } + // Try to find encoding and mode from text model + let encoding: string | undefined = undefined; + let mode: string | undefined = undefined; + if (untitledTextEditorService.exists(file.resource)) { + const model = untitledTextEditorService.createOrGet(file.resource); + encoding = model.getEncoding(); + mode = model.getMode(); + } else { + const model = textFileService.models.get(file.resource); + if (model) { + encoding = model.getEncoding(); + mode = model.textEditorModel?.getModeId(); + } + } + + // If the resource is dirty, send over its backup + // resource to restore dirty state + let backupResource: string | undefined = undefined; + if (textFileService.isDirty(file.resource)) { + backupResource = backupFileService.toBackupResource(file.resource).toString(); + } + // Add as dragged editor - draggedEditors.push({ - resource: file.resource.toString(), - backupResource: textFileService.isDirty(file.resource) ? backupFileService.toBackupResource(file.resource).toString() : undefined, - viewState - }); + draggedEditors.push({ resource: file.resource.toString(), backupResource, viewState, encoding, mode }); }); if (draggedEditors.length) { From c21ca53c18e867118d537ef31553d9303335bb55 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Dec 2019 17:53:05 +0100 Subject: [PATCH 204/637] web - remove legacy environment support --- .../browser/extensionHostDebugService.ts | 65 ------------------- .../environment/browser/environmentService.ts | 30 --------- 2 files changed, 95 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts b/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts index d9b5232c0eb..79c3eb05810 100644 --- a/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts +++ b/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts @@ -65,11 +65,6 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient i openExtensionDevelopmentHostWindow(args: string[], env: IProcessEnvironment): Promise { - if (!this.workspaceProvider.payload) { - // TODO@Ben remove me once environment is adopted - return this.openExtensionDevelopmentHostWindowLegacy(args); - } - // Find out which workspace to open debug window on let debugWorkspace: IWorkspace = undefined; const folderUriArg = this.findArgument('folder-uri', args); @@ -117,66 +112,6 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient i }); } - private openExtensionDevelopmentHostWindowLegacy(args: string[]): Promise { - // we pass the "args" as query parameters of the URL - - let newAddress = `${document.location.origin}${document.location.pathname}?`; - let gotFolder = false; - - const addQueryParameter = (key: string, value: string) => { - const lastChar = newAddress.charAt(newAddress.length - 1); - if (lastChar !== '?' && lastChar !== '&') { - newAddress += '&'; - } - newAddress += `${key}=${encodeURIComponent(value)}`; - }; - - const findArgument = (key: string) => { - for (let a of args) { - const k = `--${key}=`; - if (a.indexOf(k) === 0) { - return a.substr(k.length); - } - } - return undefined; - }; - - const f = findArgument('folder-uri'); - if (f) { - const u = URI.parse(f); - gotFolder = true; - addQueryParameter('folder', u.path); - } - if (!gotFolder) { - // request empty window - addQueryParameter('ew', 'true'); - } - - const ep = findArgument('extensionDevelopmentPath'); - if (ep) { - addQueryParameter('extensionDevelopmentPath', ep); - } - - const etp = findArgument('extensionTestsPath'); - if (etp) { - addQueryParameter('extensionTestsPath', etp); - } - - const di = findArgument('debugId'); - if (di) { - addQueryParameter('debugId', di); - } - - const ibe = findArgument('inspect-brk-extensions'); - if (ibe) { - addQueryParameter('inspect-brk-extensions', ibe); - } - - window.open(newAddress); - - return Promise.resolve(); - } - private findArgument(key: string, args: string[]): string | undefined { for (const a of args) { const k = `--${key}=`; diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index d54e68fa70f..6629ec756e1 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -308,36 +308,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment break; } } - } else { - // TODO@Ben remove me once environment is adopted - if (document && document.location && document.location.search) { - const map = new Map(); - const query = document.location.search.substring(1); - const vars = query.split('&'); - for (let p of vars) { - const pair = p.split('='); - if (pair.length >= 2) { - map.set(pair[0], decodeURIComponent(pair[1])); - } - } - - const edp = map.get('extensionDevelopmentPath'); - if (edp) { - extensionHostDebugEnvironment.extensionDevelopmentLocationURI = [URI.parse(edp)]; - extensionHostDebugEnvironment.isExtensionDevelopment = true; - } - - const di = map.get('debugId'); - if (di) { - extensionHostDebugEnvironment.params.debugId = di; - } - - const ibe = map.get('inspect-brk-extensions'); - if (ibe) { - extensionHostDebugEnvironment.params.port = parseInt(ibe); - extensionHostDebugEnvironment.params.break = false; - } - } } return extensionHostDebugEnvironment; From b2868cc01cba92ed342400e23bd47e06622ee223 Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Fri, 6 Dec 2019 11:24:11 -0800 Subject: [PATCH 205/637] Fix #85981 --- extensions/css-language-features/server/package.json | 2 +- extensions/css-language-features/server/yarn.lock | 8 ++++---- extensions/html-language-features/server/package.json | 2 +- extensions/html-language-features/server/yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/css-language-features/server/package.json b/extensions/css-language-features/server/package.json index 5ff5b49c5f3..66c7e087dcc 100644 --- a/extensions/css-language-features/server/package.json +++ b/extensions/css-language-features/server/package.json @@ -9,7 +9,7 @@ }, "main": "./out/cssServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.23", + "vscode-css-languageservice": "^4.0.3-next.24", "vscode-languageserver": "^6.0.0-next.3" }, "devDependencies": { diff --git a/extensions/css-language-features/server/yarn.lock b/extensions/css-language-features/server/yarn.lock index 6191a8ffcd5..9196af4c058 100644 --- a/extensions/css-language-features/server/yarn.lock +++ b/extensions/css-language-features/server/yarn.lock @@ -781,10 +781,10 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.23: - version "4.0.3-next.23" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff" - integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg== +vscode-css-languageservice@^4.0.3-next.24: + version "4.0.3-next.24" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.24.tgz#6190fb5af4621b7efc1a0772c1a178d996ffb42d" + integrity sha512-7CPBmaQnvkgL7MXZK9vt5R5CwFaQ9TCqWt9aCi9dGm1g0uAgFOwk8+K5+fV2pasI+aoOvb/kLcFjxSSRD03KdA== dependencies: vscode-languageserver-textdocument "^1.0.0-next.4" vscode-languageserver-types "^3.15.0-next.6" diff --git a/extensions/html-language-features/server/package.json b/extensions/html-language-features/server/package.json index 27661b072bd..7060461f908 100644 --- a/extensions/html-language-features/server/package.json +++ b/extensions/html-language-features/server/package.json @@ -9,7 +9,7 @@ }, "main": "./out/htmlServerMain", "dependencies": { - "vscode-css-languageservice": "^4.0.3-next.23", + "vscode-css-languageservice": "^4.0.3-next.24", "vscode-html-languageservice": "^3.0.4-next.11", "vscode-languageserver": "^6.0.0-next.3", "vscode-nls": "^4.1.1", diff --git a/extensions/html-language-features/server/yarn.lock b/extensions/html-language-features/server/yarn.lock index 395953969f4..c42d15d833e 100644 --- a/extensions/html-language-features/server/yarn.lock +++ b/extensions/html-language-features/server/yarn.lock @@ -611,10 +611,10 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -vscode-css-languageservice@^4.0.3-next.23: - version "4.0.3-next.23" - resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.23.tgz#b7a835c317a6f0b96ec104e3ce168770f5f0d4ff" - integrity sha512-DmMXBzTd3uYnVMffNlcp+Sy4qdzeE+UG5yivo/5Y1f/Qr//4FyssH0eCZ7K9Vf/9DMKYf9J3HeCNZSTq4EzMrg== +vscode-css-languageservice@^4.0.3-next.24: + version "4.0.3-next.24" + resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-4.0.3-next.24.tgz#6190fb5af4621b7efc1a0772c1a178d996ffb42d" + integrity sha512-7CPBmaQnvkgL7MXZK9vt5R5CwFaQ9TCqWt9aCi9dGm1g0uAgFOwk8+K5+fV2pasI+aoOvb/kLcFjxSSRD03KdA== dependencies: vscode-languageserver-textdocument "^1.0.0-next.4" vscode-languageserver-types "^3.15.0-next.6" From 87c2e0be5d7359ce110c4c9ec9f6df71be996f8a Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 6 Dec 2019 11:45:17 -0800 Subject: [PATCH 206/637] Make sure we set the group of the newly created webview during webview move operations Fixes #86407 --- .../contrib/customEditor/browser/customEditorInput.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index c9394ba4e92..ab6ddeb66df 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -156,15 +156,17 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { }); } - public handleMove(_groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined { + public handleMove(groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined { const editorInfo = this.customEditorService.getCustomEditor(this.viewType); if (editorInfo?.matches(uri)) { const webview = assertIsDefined(this.takeOwnershipOfWebview()); - return this.instantiationService.createInstance(CustomFileEditorInput, + const newInput = this.instantiationService.createInstance(CustomFileEditorInput, uri, this.viewType, generateUuid(), new Lazy(() => webview)); + newInput.updateGroup(groupId); + return newInput; } return undefined; } From 30b85234acf6783186c48df64d8e9a8190acaf4c Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Fri, 6 Dec 2019 13:39:35 -0800 Subject: [PATCH 207/637] bump version to 1.42.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 751de76f58a..0fcecaa745a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "code-oss-dev", - "version": "1.41.0", + "version": "1.42.0", "distro": "17f1b806c349d58f96b4aef97ae59d836e2c5605", "author": { "name": "Microsoft Corporation" From 0403a10885f2ce11c17c7222a70f8c73df7c3ba6 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 24 Nov 2019 13:22:04 -0800 Subject: [PATCH 208/637] Don't restart the EH when the first workspace folder changes For #69335 --- .../browser/relauncher.contribution.ts | 99 ++----------------- 1 file changed, 8 insertions(+), 91 deletions(-) diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index a152b50423d..4ef39c8a040 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -3,23 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle'; -import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { isMacintosh, isNative } from 'vs/base/common/platform'; +import { localize } from 'vs/nls'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { IProductService } from 'vs/platform/product/common/productService'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWindowsConfiguration } from 'vs/platform/windows/common/windows'; +import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { localize } from 'vs/nls'; -import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; -import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { RunOnceScheduler } from 'vs/base/common/async'; -import { URI } from 'vs/base/common/uri'; -import { isEqual } from 'vs/base/common/resources'; -import { isMacintosh, isNative } from 'vs/base/common/platform'; -import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { IProductService } from 'vs/platform/product/common/productService'; interface IConfiguration extends IWindowsConfiguration { update: { mode: string; }; @@ -132,82 +126,5 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo } } -export class WorkspaceChangeExtHostRelauncher extends Disposable implements IWorkbenchContribution { - - private firstFolderResource?: URI; - private extensionHostRestarter: RunOnceScheduler; - - private onDidChangeWorkspaceFoldersUnbind: IDisposable | undefined; - - constructor( - @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, - @IExtensionService extensionService: IExtensionService, - @IHostService hostService: IHostService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService - ) { - super(); - - this.extensionHostRestarter = this._register(new RunOnceScheduler(() => { - if (!!environmentService.extensionTestsLocationURI) { - return; // no restart when in tests: see https://github.com/Microsoft/vscode/issues/66936 - } - - if (environmentService.configuration.remoteAuthority) { - hostService.reload(); // TODO@aeschli, workaround - } else if (isNative) { - extensionService.restartExtensionHost(); - } - }, 10)); - - this.contextService.getCompleteWorkspace() - .then(workspace => { - this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; - this.handleWorkbenchState(); - this._register(this.contextService.onDidChangeWorkbenchState(() => setTimeout(() => this.handleWorkbenchState()))); - }); - - this._register(toDisposable(() => { - if (this.onDidChangeWorkspaceFoldersUnbind) { - this.onDidChangeWorkspaceFoldersUnbind.dispose(); - } - })); - } - - private handleWorkbenchState(): void { - - // React to folder changes when we are in workspace state - if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) { - - // Update our known first folder path if we entered workspace - const workspace = this.contextService.getWorkspace(); - this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; - - // Install workspace folder listener - if (!this.onDidChangeWorkspaceFoldersUnbind) { - this.onDidChangeWorkspaceFoldersUnbind = this.contextService.onDidChangeWorkspaceFolders(() => this.onDidChangeWorkspaceFolders()); - } - } - - // Ignore the workspace folder changes in EMPTY or FOLDER state - else { - dispose(this.onDidChangeWorkspaceFoldersUnbind); - this.onDidChangeWorkspaceFoldersUnbind = undefined; - } - } - - private onDidChangeWorkspaceFolders(): void { - const workspace = this.contextService.getWorkspace(); - - // Restart extension host if first root folder changed (impact on deprecated workspace.rootPath API) - const newFirstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; - if (!isEqual(this.firstFolderResource, newFirstFolderResource)) { - this.firstFolderResource = newFirstFolderResource; - - this.extensionHostRestarter.schedule(); // buffer calls to extension host restart - } - } -} - const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, LifecyclePhase.Restored); -workbenchRegistry.registerWorkbenchContribution(WorkspaceChangeExtHostRelauncher, LifecyclePhase.Restored); From 5bc80f3ea031739c2f8796857221be6825b288da Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 6 Dec 2019 14:07:15 -0800 Subject: [PATCH 209/637] Make rootPath undefined in a multiroot workspace, #69335 --- src/vs/workbench/api/common/extHostWorkspace.ts | 5 +++++ .../test/electron-browser/api/extHostWorkspace.test.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index 4b5c0c1301f..99654eded85 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -339,6 +339,11 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac if (folders.length === 0) { return undefined; } + + if (folders.length > 1) { + return undefined; + } + // #54483 @Joh Why are we still using fsPath? return folders[0].uri.fsPath; } diff --git a/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts b/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts index c05a1d72fd8..d505968d588 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts @@ -120,7 +120,7 @@ suite('ExtHostWorkspace', function () { assert.equal(ws.getPath(), undefined); ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('Folder'), 0), aWorkspaceFolderData(URI.file('Another/Folder'), 1)] }, new NullLogService()); - assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder'); + assert.equal(ws.getPath(), undefined); ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('/Folder'), 0)] }, new NullLogService()); assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder'); From a416c77e56ef0314ae00633faa04878151610de8 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 6 Dec 2019 14:32:27 -0800 Subject: [PATCH 210/637] Fix rootPath test --- .../vscode-api-tests/src/workspace-tests/workspace.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts b/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts index f018f581c42..729dd8f14d5 100644 --- a/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts @@ -13,7 +13,7 @@ suite('workspace-namespace', () => { teardown(closeAllEditors); test('rootPath', () => { - assert.ok(pathEquals(vscode.workspace.rootPath!, join(__dirname, '../../testWorkspace'))); + assert.equal(vscode.workspace.rootPath, undefined); }); test('workspaceFile', () => { From c639bece2ed9d6f358fd2164ab4c38aa9c0955f4 Mon Sep 17 00:00:00 2001 From: Matthew Clifford <35276477+smilegodly@users.noreply.github.com> Date: Fri, 6 Dec 2019 17:54:49 -0500 Subject: [PATCH 211/637] got rid of duplicate 'Clear Search' text link --- .../contrib/preferences/browser/settingsEditor2.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 09467700dd5..5d009be83ef 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -532,17 +532,6 @@ export class SettingsEditor2 extends BaseEditor { DOM.append(this.noResultsMessage, this.clearFilterLinkContainer); - const clearSearchContainer = $('span.clear-search'); - clearSearchContainer.textContent = ' - '; - - const clearSearch = DOM.append(clearSearchContainer, $('a.pointer.prominent', { tabindex: 0 }, localize('clearSearch', 'Clear Search'))); - this._register(DOM.addDisposableListener(clearSearch, DOM.EventType.CLICK, (e: MouseEvent) => { - DOM.EventHelper.stop(e, false); - this.clearSearchResults(); - })); - - DOM.append(this.noResultsMessage, clearSearchContainer); - this._register(attachStylerCallback(this.themeService, { editorForeground }, colors => { this.noResultsMessage.style.color = colors.editorForeground ? colors.editorForeground.toString() : null; })); From fe37ea75ea6f28aaaf3a3ffb2c6646b9d54f5ec0 Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Fri, 6 Dec 2019 23:54:35 -0500 Subject: [PATCH 212/637] Fixes #86386 --- .../contrib/snippets/browser/snippetCompletionProvider.ts | 5 +++-- .../contrib/snippets/test/browser/snippetsService.test.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts b/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts index d2d8f54ccb5..96d9f026104 100644 --- a/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts +++ b/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts @@ -126,8 +126,9 @@ export class SnippetCompletionProvider implements CompletionItemProvider { // add remaing snippets when the current prefix ends in whitespace or when no // interesting positions have been found availableSnippets.forEach(snippet => { - const range = Range.fromPositions(position); - suggestions.push(new SnippetCompletion(snippet, { replace: range, insert: range })); + let insert = Range.fromPositions(position); + let replace = startsWith(lineSuffixLow, snippet.prefixLow) ? insert.setEndPosition(position.lineNumber, position.column + snippet.prefixLow.length) : insert; + suggestions.push(new SnippetCompletion(snippet, { replace, insert })); }); } diff --git a/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts b/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts index fd90cd10897..a8a9b46573d 100644 --- a/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts +++ b/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts @@ -438,5 +438,13 @@ suite('SnippetsService', function () { [first] = result.suggestions; assert.equal((first.range as any).insert.endColumn, 3); assert.equal((first.range as any).replace.endColumn, 3); + + model = TextModel.createFromString('not word', undefined, modeService.getLanguageIdentifier('fooLang')); + result = await provider.provideCompletionItems(model, new Position(1, 1), context)!; + + assert.equal(result.suggestions.length, 1); + [first] = result.suggestions; + assert.equal((first.range as any).insert.endColumn, 1); + assert.equal((first.range as any).replace.endColumn, 9); }); }); From c4a0949f2c66d5179126c9211319ba5df6a95f38 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 7 Dec 2019 08:06:58 +0100 Subject: [PATCH 213/637] code --wait --diff doesn't exit after closing diff if the file is also opened in a non-diff view (fixes #75861) --- src/vs/workbench/electron-browser/window.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index 46a3496a065..389d3a6c14d 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -609,11 +609,18 @@ export class ElectronWindow extends Disposable { } private trackClosedWaitFiles(waitMarkerFile: URI, resourcesToWaitFor: URI[]): IDisposable { - const listener = this.editorService.onDidCloseEditor(async () => { + const listener = this.editorService.onDidCloseEditor(async event => { + const closedResource = toResource(event.editor, { supportSideBySide: SideBySideEditor.MASTER }); + // In wait mode, listen to changes to the editors and wait until the files // are closed that the user wants to wait for. When this happens we delete // the wait marker file to signal to the outside that editing is done. - if (resourcesToWaitFor.every(resource => !this.editorService.isOpen({ resource }))) { + if ( + // for https://github.com/microsoft/vscode/issues/75861 + (resourcesToWaitFor.length === 1 && isEqual(closedResource, resourcesToWaitFor[0])) || + // any other case we simply check for all resources to wait for + resourcesToWaitFor.every(resource => !this.editorService.isOpen({ resource })) + ) { // If auto save is configured with the default delay (1s) it is possible // to close the editor while the save still continues in the background. As such // we have to also check if the files to wait for are dirty and if so wait From a162ad20a4eb342d2d7dfdb510f81d73b84b3da6 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sun, 8 Dec 2019 09:16:19 +0100 Subject: [PATCH 214/637] `"files.autoSave": "onFocusChange"` breaks preview editors (fixes #86500) --- src/vs/workbench/services/editor/browser/editorService.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 9e01064847f..d64e64a3564 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -5,7 +5,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IResourceInput, ITextEditorOptions, IEditorOptions, EditorActivation } from 'vs/platform/editor/common/editor'; -import { IEditorInput, IEditor, GroupIdentifier, IFileEditorInput, IUntitledTextResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, IFileInputFactory, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditor, ITextDiffEditor, ITextSideBySideEditor, toResource, SideBySideEditor, IRevertOptions } from 'vs/workbench/common/editor'; +import { IEditorInput, IEditor, GroupIdentifier, IFileEditorInput, IUntitledTextResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, IFileInputFactory, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditor, ITextDiffEditor, ITextSideBySideEditor, toResource, SideBySideEditor, IRevertOptions, SaveReason } from 'vs/workbench/common/editor'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { Registry } from 'vs/platform/registry/common/platform'; import { ResourceMap } from 'vs/base/common/map'; @@ -687,8 +687,10 @@ export class EditorService extends Disposable implements EditorServiceImpl { // Editors to save in parallel await Promise.all(editorsToSaveParallel.map(({ groupId, editor }) => { - // Use save as a hint to pin the editor - this.editorGroupService.getGroup(groupId)?.pinEditor(editor); + // Use save as a hint to pin the editor if used explicitly + if (options?.reason === SaveReason.EXPLICIT) { + this.editorGroupService.getGroup(groupId)?.pinEditor(editor); + } // Save return editor.save(groupId, options); From 95ce364adc0867e82a018b31ab3879f3bc837a81 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sun, 8 Dec 2019 09:33:08 +0100 Subject: [PATCH 215/637] Open editors: briefly shows "1 unsaved" even though auto save is on (fixes #86553) --- .../files/browser/views/openEditorsView.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index de1f8bf059b..246ab00ec39 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -41,8 +41,9 @@ import { ElementsDragAndDropData, DesktopDragAndDropData } from 'vs/base/browser import { URI } from 'vs/base/common/uri'; import { withUndefinedAsNull } from 'vs/base/common/types'; import { isWeb } from 'vs/base/common/platform'; -import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; +import { IWorkingCopyService, IWorkingCopy, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; const $ = dom.$; @@ -76,7 +77,8 @@ export class OpenEditorsView extends ViewletPane { @IThemeService private readonly themeService: IThemeService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IMenuService private readonly menuService: IMenuService, - @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService + @IWorkingCopyService private readonly workingCopyService: IWorkingCopyService, + @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService ) { super({ ...(options as IViewletPaneOptions), @@ -100,7 +102,7 @@ export class OpenEditorsView extends ViewletPane { this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(e))); // Handle dirty counter - this._register(this.workingCopyService.onDidChangeDirty(() => this.updateDirtyIndicator())); + this._register(this.workingCopyService.onDidChangeDirty(c => this.updateDirtyIndicator(c))); } private registerUpdateEvents(): void { @@ -414,7 +416,14 @@ export class OpenEditorsView extends ViewletPane { this.maximumBodySize = this.getMaxExpandedBodySize(); } - private updateDirtyIndicator(): void { + private updateDirtyIndicator(workingCopy?: IWorkingCopy): void { + if (workingCopy) { + const gotDirty = workingCopy.isDirty(); + if (gotDirty && !!(workingCopy.capabilities & WorkingCopyCapabilities.AutoSave) && this.filesConfigurationService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) { + return; // do not indicate dirty of working copies that are auto saved after short delay + } + } + let dirty = this.workingCopyService.dirtyCount; if (dirty === 0) { dom.addClass(this.dirtyCountElement, 'hidden'); From 8bcf1bc04ba66288c27135d3844d573d916e5efa Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Sun, 8 Dec 2019 17:01:26 +0100 Subject: [PATCH 216/637] fix namings --- .../userDataSync/browser/userDataSync.ts | 62 +++++++++++-------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 9e702a131d6..8fd8c739cf4 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -161,9 +161,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo let priority: number | undefined = undefined; if (this.userDataSyncService.status !== SyncStatus.Uninitialized && this.configurationService.getValue(UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING) && this.authTokenService.status === AuthTokenStatus.SignedOut) { - badge = new NumberBadge(1, () => localize('sign in', "Sync: Sign in...")); + badge = new NumberBadge(1, () => localize('sign in to sync', "Sign in to Sync")); } else if (this.authTokenService.status === AuthTokenStatus.SigningIn) { - badge = new ProgressBadge(() => localize('signing in', "Signin in...")); + badge = new ProgressBadge(() => localize('signing in', "Signing in...")); clazz = 'progress-badge'; priority = 1; } else if (this.userDataSyncService.status === SyncStatus.HasConflicts) { @@ -315,17 +315,24 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo private registerActions(): void { - const startSyncMenuItem: IMenuItem = { + const turnOnSyncCommandId = 'workbench.userData.actions.syncStart'; + const turnOnSyncWhenContext = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), ContextKeyExpr.not(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`), CONTEXT_AUTH_TOKEN_STATE.notEqualsTo(AuthTokenStatus.SigningIn)); + CommandsRegistry.registerCommand(turnOnSyncCommandId, () => this.turnOn()); + MenuRegistry.appendMenuItem(MenuId.GlobalActivity, { group: '5_sync', command: { - id: 'workbench.userData.actions.syncStart', - title: localize('start sync', "Sync: Turn On") + id: turnOnSyncCommandId, + title: localize('global activity turn on sync', "Turn on sync...") }, - when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), ContextKeyExpr.not(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`), CONTEXT_AUTH_TOKEN_STATE.notEqualsTo(AuthTokenStatus.SigningIn)), - }; - CommandsRegistry.registerCommand(startSyncMenuItem.command.id, () => this.turnOn()); - MenuRegistry.appendMenuItem(MenuId.GlobalActivity, startSyncMenuItem); - MenuRegistry.appendMenuItem(MenuId.CommandPalette, startSyncMenuItem); + when: turnOnSyncWhenContext, + }); + MenuRegistry.appendMenuItem(MenuId.CommandPalette, { + command: { + id: turnOnSyncCommandId, + title: localize('turn on sync', "Sync: Turn on sync...") + }, + when: turnOnSyncWhenContext, + }); const signInCommandId = 'workbench.userData.actions.signin'; const signInWhenContext = ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), ContextKeyExpr.has(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`), CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthTokenStatus.SignedOut)); @@ -334,14 +341,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo group: '5_sync', command: { id: signInCommandId, - title: localize('global activity sign in', "Sync: Sign in... (1)") + title: localize('global activity sign in', "Sign in to sync... (1)") }, when: signInWhenContext, }); MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: signInCommandId, - title: localize('sign in', "Sync: Sign in...") + title: localize('sign in', "Sync: Sign in to sync...") }, when: signInWhenContext, }); @@ -352,24 +359,27 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo group: '5_sync', command: { id: signingInCommandId, - title: localize('signinig in', "Sync: Signing in..."), + title: localize('signinig in', "Signing in..."), precondition: FalseContext }, when: CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthTokenStatus.SigningIn) }); - const stopSyncCommand = { - id: 'workbench.userData.actions.stopSync', - title: localize('stop sync', "Sync: Turn Off") - }; - CommandsRegistry.registerCommand(stopSyncCommand.id, () => this.turnOff()); + const stopSyncCommandId = 'workbench.userData.actions.stopSync'; + CommandsRegistry.registerCommand(stopSyncCommandId, () => this.turnOff()); MenuRegistry.appendMenuItem(MenuId.GlobalActivity, { group: '5_sync', - command: stopSyncCommand, + command: { + id: stopSyncCommandId, + title: localize('global activity stop sync', "Turn off sync") + }, when: ContextKeyExpr.and(ContextKeyExpr.has(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`), CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthTokenStatus.SignedIn), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.HasConflicts)) }); MenuRegistry.appendMenuItem(MenuId.CommandPalette, { - command: stopSyncCommand, + command: { + id: stopSyncCommandId, + title: localize('stop sync', "Sync: Turn off sync") + }, when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized), ContextKeyExpr.has(`config.${UserDataSyncWorkbenchContribution.ENABLEMENT_SETTING}`)), }); @@ -380,14 +390,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo group: '5_sync', command: { id: resolveConflictsCommandId, - title: localize('resolveConflicts_global', "Sync: Resolve Conflicts (1)"), + title: localize('resolveConflicts_global', "Resolve sync conflicts (1)"), }, when: resolveConflictsWhenContext, }); MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: resolveConflictsCommandId, - title: localize('resolveConflicts', "Sync: Resolve Conflicts"), + title: localize('resolveConflicts', "Sync: Resolve sync conflicts"), }, when: resolveConflictsWhenContext, }); @@ -397,14 +407,14 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: continueSyncCommandId, - title: localize('continue sync', "Sync: Continue") + title: localize('continue sync', "Sync: Continue sync") }, when: ContextKeyExpr.and(CONTEXT_SYNC_STATE.isEqualTo(SyncStatus.HasConflicts)), }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: continueSyncCommandId, - title: localize('continue sync', "Sync: Continue"), + title: localize('continue sync', "Sync: Continue sync"), icon: { light: SYNC_PUSH_LIGHT_ICON_URI, dark: SYNC_PUSH_DARK_ICON_URI @@ -417,7 +427,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: continueSyncCommandId, - title: localize('continue sync', "Sync: Continue"), + title: localize('continue sync', "Sync: Continue sync"), icon: { light: SYNC_PUSH_LIGHT_ICON_URI, dark: SYNC_PUSH_DARK_ICON_URI @@ -432,7 +442,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo group: '5_sync', command: { id: 'workbench.userData.actions.signout', - title: localize('sign out', "Sign Out") + title: localize('sign out', "Sync: Sign out") }, when: ContextKeyExpr.and(CONTEXT_AUTH_TOKEN_STATE.isEqualTo(AuthTokenStatus.SignedIn)), }; From 46c696ac6b1727875e820c78797ec7370b93f6d1 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 06:58:06 +0100 Subject: [PATCH 217/637] Option to disable "Failed to save '...': The content on disk is newer." check (fixes #66035) --- src/vs/platform/files/common/files.ts | 1 + .../files/browser/files.contribution.ts | 8 ++- .../files/browser/textFileSaveErrorHandler.ts | 56 ++++++++++++++----- .../common/filesConfigurationService.ts | 7 +++ .../textfile/common/textFileEditorModel.ts | 2 +- .../services/textfile/common/textfiles.ts | 1 + 6 files changed, 59 insertions(+), 16 deletions(-) diff --git a/src/vs/platform/files/common/files.ts b/src/vs/platform/files/common/files.ts index 83ed4656a1b..c00e9b17fef 100644 --- a/src/vs/platform/files/common/files.ts +++ b/src/vs/platform/files/common/files.ts @@ -796,6 +796,7 @@ export interface IFilesConfiguration { eol: string; enableTrash: boolean; hotExit: string; + preventSaveConflicts: boolean; }; } diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index a3ffb18b605..73b686fa6d6 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -333,10 +333,16 @@ configurationRegistry.registerConfiguration({ 'markdownDescription': nls.localize('maxMemoryForLargeFilesMB', "Controls the memory available to VS Code after restart when trying to open large files. Same effect as specifying `--max-memory=NEWSIZE` on the command line."), included: platform.isNative }, + 'files.preventSaveConflicts': { + 'type': 'boolean', + 'description': nls.localize('files.preventSaveConflicts', "When enabled, will prevent to save a file that has been changed since it was last edited. Instead, a diff editor is provided to compare the changes and accept or revert them. This setting should only be disabled if you frequently encounter save conflict errors and may result in data loss if used without caution."), + 'default': true, + 'scope': ConfigurationScope.RESOURCE + }, 'files.simpleDialog.enable': { 'type': 'boolean', 'description': nls.localize('files.simpleDialog.enable', "Enables the simple file dialog. The simple file dialog replaces the system file dialog when enabled."), - 'default': false, + 'default': false } } }); diff --git a/src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts index f4fdf7261cf..7de229cf583 100644 --- a/src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts +++ b/src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts @@ -21,9 +21,7 @@ import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorIn import { IContextKeyService, IContextKey, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { TextFileContentProvider } from 'vs/workbench/contrib/files/common/files'; import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; -import { IModelService } from 'vs/editor/common/services/modelService'; import { SAVE_FILE_COMMAND_ID, REVERT_FILE_COMMAND_ID, SAVE_FILE_AS_COMMAND_ID, SAVE_FILE_AS_LABEL } from 'vs/workbench/contrib/files/browser/fileCommands'; -import { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel'; import { INotificationService, INotificationHandle, INotificationActions, Severity } from 'vs/platform/notification/common/notification'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; @@ -33,6 +31,8 @@ import { Event } from 'vs/base/common/event'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { isWindows } from 'vs/base/common/platform'; import { Schemas } from 'vs/base/common/network'; +import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; +import { SaveReason } from 'vs/workbench/common/editor'; export const CONFLICT_RESOLUTION_CONTEXT = 'saveConflictResolutionContext'; export const CONFLICT_RESOLUTION_SCHEME = 'conflictResolution'; @@ -126,9 +126,12 @@ export class TextFileSaveErrorHandler extends Disposable implements ISaveErrorHa // Otherwise show the message that will lead the user into the save conflict editor. else { - message = nls.localize('staleSaveError', "Failed to save '{0}': The content of the file is newer. Please compare your version with the file contents.", basename(resource)); + message = nls.localize('staleSaveError', "Failed to save '{0}': The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes.", basename(resource)); primaryActions.push(this.instantiationService.createInstance(ResolveSaveConflictAction, model)); + primaryActions.push(this.instantiationService.createInstance(SaveIgnoreModifiedSinceAction, model)); + + secondaryActions.push(this.instantiationService.createInstance(ConfigureSaveConflictAction)); } } @@ -278,7 +281,8 @@ class SaveElevatedAction extends Action { if (!this.model.isDisposed()) { this.model.save({ writeElevated: true, - overwriteReadonly: this.triedToMakeWriteable + overwriteReadonly: this.triedToMakeWriteable, + reason: SaveReason.EXPLICIT }); } @@ -296,17 +300,48 @@ class OverwriteReadonlyAction extends Action { run(): Promise { if (!this.model.isDisposed()) { - this.model.save({ overwriteReadonly: true }); + this.model.save({ overwriteReadonly: true, reason: SaveReason.EXPLICIT }); } return Promise.resolve(true); } } +class SaveIgnoreModifiedSinceAction extends Action { + + constructor( + private model: ITextFileEditorModel + ) { + super('workbench.files.action.saveIgnoreModifiedSince', nls.localize('overwrite', "Overwrite")); + } + + run(): Promise { + if (!this.model.isDisposed()) { + this.model.save({ ignoreModifiedSince: true, reason: SaveReason.EXPLICIT }); + } + + return Promise.resolve(true); + } +} + +class ConfigureSaveConflictAction extends Action { + + constructor( + @IPreferencesService private readonly preferencesService: IPreferencesService + ) { + super('workbench.files.action.configureSaveConflict', nls.localize('configure', "Configure")); + } + + run(): Promise { + this.preferencesService.openSettings(undefined, 'files.preventSaveConflicts'); + + return Promise.resolve(true); + } +} + export const acceptLocalChangesCommand = async (accessor: ServicesAccessor, resource: URI) => { const editorService = accessor.get(IEditorService); const resolverService = accessor.get(ITextModelService); - const modelService = accessor.get(IModelService); const control = editorService.activeControl; if (!control) { @@ -318,18 +353,11 @@ export const acceptLocalChangesCommand = async (accessor: ServicesAccessor, reso const reference = await resolverService.createModelReference(resource); const model = reference.object as IResolvedTextFileEditorModel; - const localModelSnapshot = model.createSnapshot(); clearPendingResolveSaveConflictMessages(); // hide any previously shown message about how to use these actions - // Revert to be able to save - await model.revert(); - - // Restore user value (without loosing undo stack) - modelService.updateModel(model.textEditorModel, createTextBufferFactoryFromSnapshot(localModelSnapshot)); - // Trigger save - await model.save(); + await model.save({ ignoreModifiedSince: true, reason: SaveReason.EXPLICIT }); // Reopen file input await editorService.openEditor({ resource: model.resource }, group); diff --git a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts index 6595d5b8ed0..8d4238c59fa 100644 --- a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts +++ b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts @@ -13,6 +13,7 @@ import { IFilesConfiguration, AutoSaveConfiguration, HotExitConfiguration } from import { isUndefinedOrNull } from 'vs/base/common/types'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { equals } from 'vs/base/common/objects'; +import { URI } from 'vs/base/common/uri'; export const AutoSaveAfterShortDelayContext = new RawContextKey('autoSaveAfterShortDelayContext', false); @@ -53,6 +54,8 @@ export interface IFilesConfigurationService { readonly isHotExitEnabled: boolean; readonly hotExitConfiguration: string | undefined; + + preventSaveConflicts(resource: URI): boolean; } export class FilesConfigurationService extends Disposable implements IFilesConfigurationService { @@ -203,6 +206,10 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi get hotExitConfiguration(): string { return this.currentHotExitConfig; } + + preventSaveConflicts(resource: URI): boolean { + return this.configurationService.getValue('files.preventSaveConflicts', { resource }); + } } registerSingleton(IFilesConfigurationService, FilesConfigurationService); diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index 8ab10dc191a..1ab5da03cf5 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -743,7 +743,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil overwriteEncoding: options.overwriteEncoding, mtime: lastResolvedFileStat.mtime, encoding: this.getEncoding(), - etag: lastResolvedFileStat.etag, + etag: (options.ignoreModifiedSince || !this.filesConfigurationService.preventSaveConflicts(lastResolvedFileStat.resource)) ? ETAG_DISABLED : lastResolvedFileStat.etag, writeElevated: options.writeElevated }).then(stat => { this.logService.trace(`doSave(${versionId}) - after write()`, this.resource); diff --git a/src/vs/workbench/services/textfile/common/textfiles.ts b/src/vs/workbench/services/textfile/common/textfiles.ts index 45ba8a4375c..8b6750df496 100644 --- a/src/vs/workbench/services/textfile/common/textfiles.ts +++ b/src/vs/workbench/services/textfile/common/textfiles.ts @@ -412,6 +412,7 @@ export interface ITextFileSaveOptions extends ISaveOptions { overwriteReadonly?: boolean; overwriteEncoding?: boolean; writeElevated?: boolean; + ignoreModifiedSince?: boolean; } export interface ILoadOptions { From e9e9bde0efc974718ab62c017aed3d990431c0b1 Mon Sep 17 00:00:00 2001 From: jeanp413 Date: Mon, 9 Dec 2019 03:03:06 -0500 Subject: [PATCH 218/637] Fixes #86573 --- .../files/browser/views/explorerViewer.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index 0e95974a599..d1487530958 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -138,22 +138,30 @@ export class CompressedNavigationController implements ICompressedNavigationCont static ID = 0; private _index: number; - readonly labels: HTMLElement[]; + private _labels!: HTMLElement[]; + private _updateLabelDisposable: IDisposable; get index(): number { return this._index; } get count(): number { return this.items.length; } get current(): ExplorerItem { return this.items[this._index]!; } get currentId(): string { return `${this.id}_${this.index}`; } + get labels(): HTMLElement[] { return this._labels; } private _onDidChange = new Emitter(); readonly onDidChange = this._onDidChange.event; constructor(private id: string, readonly items: ExplorerItem[], templateData: IFileTemplateData) { this._index = items.length - 1; - this.labels = Array.from(templateData.container.querySelectorAll('.label-name')) as HTMLElement[]; - for (let i = 0; i < items.length; i++) { - this.labels[i].setAttribute('aria-label', items[i].name); + this.updateLabels(templateData); + this._updateLabelDisposable = templateData.label.onDidRender(() => this.updateLabels(templateData)); + } + + private updateLabels(templateData: IFileTemplateData): void { + this._labels = Array.from(templateData.container.querySelectorAll('.label-name')) as HTMLElement[]; + + for (let i = 0; i < this.items.length; i++) { + this.labels[i].setAttribute('aria-label', this.items[i].name); } DOM.addClass(this.labels[this._index], 'active'); @@ -205,6 +213,7 @@ export class CompressedNavigationController implements ICompressedNavigationCont dispose(): void { this._onDidChange.dispose(); + this._updateLabelDisposable.dispose(); } } From 1a8c83751531a4d5484d3e2442d4119da626c770 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 9 Dec 2019 09:22:10 +0100 Subject: [PATCH 219/637] fix #86269 enable keybindings merge tests --- .../userDataSync/test/common/keybindingsMerge.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts index 85ad7a36b13..a1b1a5d696d 100644 --- a/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts +++ b/src/vs/platform/userDataSync/test/common/keybindingsMerge.test.ts @@ -6,7 +6,6 @@ import * as assert from 'assert'; import { merge } from 'vs/platform/userDataSync/common/keybindingsMerge'; import { IStringDictionary } from 'vs/base/common/collections'; -import { OperatingSystem, OS } from 'vs/base/common/platform'; import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; import { FormattingOptions } from 'vs/base/common/jsonFormatter'; import { URI } from 'vs/base/common/uri'; @@ -441,7 +440,7 @@ suite('KeybindingsMerge - No Conflicts', () => { }); -suite.skip('KeybindingsMerge - Conflicts', () => { +suite('KeybindingsMerge - Conflicts', () => { test('merge when local and remote with one entry but different value', async () => { const localContent = stringify([{ key: 'alt+d', command: 'a', when: 'editorTextFocus && !editorReadonly' }]); @@ -730,6 +729,6 @@ class MockUserDataSyncUtilService implements IUserDataSyncUtilService { } async resolveFormattingOptions(file?: URI): Promise { - return { eol: OS === OperatingSystem.Windows ? '\r\n' : '\n', insertSpaces: false, tabSize: 4 }; + return { eol: '\n', insertSpaces: false, tabSize: 4 }; } } From 9387507a6e70f76b4be4de99b07c44c6fb27343b Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 10:41:09 +0100 Subject: [PATCH 220/637] Closing untitled editor and picking "Save" does not close editor (fixes #86561) --- .../browser/parts/editor/editorGroupView.ts | 4 ++-- src/vs/workbench/common/editor.ts | 22 ++++++++++++++++--- .../common/editor/untitledTextEditorInput.ts | 4 ++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index c98f797eefc..ceb4b081d42 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -6,7 +6,7 @@ import 'vs/css!./media/editorgroupview'; import { EditorGroup, IEditorOpenOptions, EditorCloseEvent, ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup'; -import { EditorInput, EditorOptions, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext, IEditor, EditorGroupEditorsCountContext, toResource, SideBySideEditor, SaveReason } from 'vs/workbench/common/editor'; +import { EditorInput, EditorOptions, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext, IEditor, EditorGroupEditorsCountContext, toResource, SideBySideEditor, SaveReason, SaveContext } from 'vs/workbench/common/editor'; import { Event, Emitter, Relay } from 'vs/base/common/event'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { addClass, addClasses, Dimension, trackFocus, toggleClass, removeClass, addDisposableListener, EventType, EventHelper, findParentWithClass, clearNode, isAncestor } from 'vs/base/browser/dom'; @@ -1310,7 +1310,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView { // Otherwise, handle accordingly switch (res) { case ConfirmResult.SAVE: - const result = await editor.save(this._group.id, { reason: SaveReason.EXPLICIT }); + const result = await editor.save(this._group.id, { reason: SaveReason.EXPLICIT, context: SaveContext.EDITOR_CLOSE }); return !result; case ConfirmResult.DONT_SAVE: diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index d3d6a4e6693..3dc49dad765 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -290,6 +290,15 @@ export const enum SaveReason { WINDOW_CHANGE = 4 } +export const enum SaveContext { + + /** + * Indicates that the editor is saved because it + * is being closed by the user. + */ + EDITOR_CLOSE = 1, +} + export interface ISaveOptions { /** @@ -297,6 +306,11 @@ export interface ISaveOptions { */ reason?: SaveReason; + /** + * Additional information about the context of the save. + */ + context?: SaveContext; + /** * Forces to load the contents of the working copy * again even if the working copy is not dirty. @@ -553,10 +567,10 @@ export abstract class TextEditorInput extends EditorInput { } saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise { - return this.doSaveAs(group, () => this.textFileService.saveAs(this.resource, undefined, options)); + return this.doSaveAs(group, options, () => this.textFileService.saveAs(this.resource, undefined, options)); } - protected async doSaveAs(group: GroupIdentifier, saveRunnable: () => Promise, replaceAllEditors?: boolean): Promise { + protected async doSaveAs(group: GroupIdentifier, options: ISaveOptions | undefined, saveRunnable: () => Promise, replaceAllEditors?: boolean): Promise { // Preserve view state by opening the editor first. In addition // this allows the user to review the contents of the editor. @@ -574,7 +588,9 @@ export abstract class TextEditorInput extends EditorInput { // Replace editor preserving viewstate (either across all groups or // only selected group) if the target is different from the current resource - if (!isEqual(target, this.resource)) { + // and if the editor is not being saved because it is being closed + // (because in that case we do not want to open a different editor anyway) + if (options?.context !== SaveContext.EDITOR_CLOSE && !isEqual(target, this.resource)) { const replacement = this.editorService.createInput({ resource: target }); const targetGroups = replaceAllEditors ? this.editorGroupService.groups.map(group => group.id) : [group]; for (const group of targetGroups) { diff --git a/src/vs/workbench/common/editor/untitledTextEditorInput.ts b/src/vs/workbench/common/editor/untitledTextEditorInput.ts index cc44661e542..ff606a7b864 100644 --- a/src/vs/workbench/common/editor/untitledTextEditorInput.ts +++ b/src/vs/workbench/common/editor/untitledTextEditorInput.ts @@ -163,7 +163,7 @@ export class UntitledTextEditorInput extends TextEditorInput implements IEncodin } save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise { - return this.doSaveAs(group, async () => { + return this.doSaveAs(group, options, async () => { // With associated file path, save to the path that is // associated. Make sure to convert the result using @@ -182,7 +182,7 @@ export class UntitledTextEditorInput extends TextEditorInput implements IEncodin } saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise { - return this.doSaveAs(group, () => this.textFileService.saveAs(this.resource, undefined, options), true /* replace editor across all groups */); + return this.doSaveAs(group, options, () => this.textFileService.saveAs(this.resource, undefined, options), true /* replace editor across all groups */); } async revert(options?: IRevertOptions): Promise { From 0693d4e4a5e852407690e1cc30adfc8e24701331 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 11:13:37 +0100 Subject: [PATCH 221/637] windows - set icon when running out of sources --- src/vs/code/electron-main/window.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index f2b49d0e4fc..38c4a8e1140 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -140,8 +140,13 @@ export class CodeWindow extends Disposable implements ICodeWindow { } }; + // Apply icon to window + // Linux: always + // Windows: only when running out of sources, otherwise an icon is set by us on the executable if (isLinux) { - options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s) + options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); + } else if (isWindows && !this.environmentService.isBuilt) { + options.icon = path.join(this.environmentService.appRoot, 'resources/win32/code_150x150.png'); } const windowConfig = this.configurationService.getValue('window'); From 36c1fb72ff92ef5432660721a643db180833e04f Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 11:24:59 +0100 Subject: [PATCH 222/637] remove unused settings definition --- src/vs/workbench/browser/parts/editor/breadcrumbs.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts index 31c872e54a3..99e3e4dcbfa 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbs.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbs.ts @@ -124,11 +124,6 @@ Registry.as(Extensions.Configuration).registerConfigurat type: 'boolean', default: true }, - // 'breadcrumbs.useQuickPick': { - // description: localize('useQuickPick', "Use quick pick instead of breadcrumb-pickers."), - // type: 'boolean', - // default: false - // }, 'breadcrumbs.filePath': { description: localize('filepath', "Controls whether and how file paths are shown in the breadcrumbs view."), type: 'string', From ef6cb80dd4f74ed52438d8b234f970cb2f0a3ab4 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 11:38:28 +0100 Subject: [PATCH 223/637] notifications - severity width is larger now (for #85617) --- .../browser/parts/notifications/notificationsViewer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts index 8a8dd7d5f34..191516711f7 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts @@ -85,7 +85,7 @@ export class NotificationsListDelegate implements IListVirtualDelegate Date: Mon, 9 Dec 2019 11:59:25 +0100 Subject: [PATCH 224/637] web - add mock manifest to prevent error --- scripts/code-web.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/code-web.js b/scripts/code-web.js index a7370520c91..26fb980e3d5 100755 --- a/scripts/code-web.js +++ b/scripts/code-web.js @@ -62,6 +62,17 @@ const server = http.createServer((req, res) => { // favicon return serveFile(req, res, path.join(APP_ROOT, 'resources', 'win32', 'code.ico')); } + if (pathname === '/manifest.json') { + // manifest + res.writeHead(200, { 'Content-Type': 'application/json' }); + return res.end(JSON.stringify({ + "name": "Code Web - OSS", + "short_name": "Code Web - OSS", + "start_url": "/", + "lang": "en-US", + "display": "standalone" + })); + } if (/^\/static\//.test(pathname)) { // static requests return handleStatic(req, res, parsedUrl); From e0639de66595b5e4e41c9b3d0116f865237ff8a5 Mon Sep 17 00:00:00 2001 From: Andy Edwards Date: Mon, 9 Dec 2019 05:11:11 -0600 Subject: [PATCH 225/637] fix(extHostProgress): throttle instead of debounce (#86161) fix #86131 --- src/vs/base/common/decorators.ts | 41 +++++++++++++ src/vs/base/test/common/decorators.test.ts | 60 +++++++++++++++++-- .../workbench/api/common/extHostProgress.ts | 4 +- 3 files changed, 99 insertions(+), 6 deletions(-) diff --git a/src/vs/base/common/decorators.ts b/src/vs/base/common/decorators.ts index 17dfadbf784..be2f0a5a459 100644 --- a/src/vs/base/common/decorators.ts +++ b/src/vs/base/common/decorators.ts @@ -112,3 +112,44 @@ export function debounce(delay: number, reducer?: IDebouceReducer, initial }; }); } + +export function throttle(delay: number, reducer?: IDebouceReducer, initialValueProvider?: () => T): Function { + return createDecorator((fn, key) => { + const timerKey = `$throttle$timer$${key}`; + const resultKey = `$throttle$result$${key}`; + const lastRunKey = `$throttle$lastRun$${key}`; + const pendingKey = `$throttle$pending$${key}`; + + return function (this: any, ...args: any[]) { + if (!this[resultKey]) { + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + } + if (this[lastRunKey] === null || this[lastRunKey] === undefined) { + this[lastRunKey] = -Number.MAX_VALUE; + } + + if (reducer) { + this[resultKey] = reducer(this[resultKey], ...args); + } + + if (this[pendingKey]) { + return; + } + + const nextTime = this[lastRunKey] + delay; + if (nextTime <= Date.now()) { + this[lastRunKey] = Date.now(); + fn.apply(this, [this[resultKey]]); + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + } else { + this[pendingKey] = true; + this[timerKey] = setTimeout(() => { + this[pendingKey] = false; + this[lastRunKey] = Date.now(); + fn.apply(this, [this[resultKey]]); + this[resultKey] = initialValueProvider ? initialValueProvider() : undefined; + }, nextTime - Date.now()); + } + }; + }); +} diff --git a/src/vs/base/test/common/decorators.test.ts b/src/vs/base/test/common/decorators.test.ts index e7882ddb479..9a01f60a3f4 100644 --- a/src/vs/base/test/common/decorators.test.ts +++ b/src/vs/base/test/common/decorators.test.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import * as sinon from 'sinon'; import * as assert from 'assert'; -import { memoize, createMemoizer } from 'vs/base/common/decorators'; +import { memoize, createMemoizer, throttle } from 'vs/base/common/decorators'; suite('Decorators', () => { test('memoize should memoize methods', () => { @@ -100,7 +101,9 @@ suite('Decorators', () => { test('memoized property should not be enumerable', () => { class Foo { @memoize - get answer() { return 42; } + get answer() { + return 42; + } } const foo = new Foo(); @@ -112,7 +115,9 @@ suite('Decorators', () => { test('memoized property should not be writable', () => { class Foo { @memoize - get answer() { return 42; } + get answer() { + return 42; + } } const foo = new Foo(); @@ -131,7 +136,9 @@ suite('Decorators', () => { let counter = 0; class Foo { @memoizer - get answer() { return ++counter; } + get answer() { + return ++counter; + } } const foo = new Foo(); @@ -145,4 +152,49 @@ suite('Decorators', () => { assert.equal(foo.answer, 3); assert.equal(foo.answer, 3); }); + + test('throttle', () => { + const spy = sinon.spy(); + const clock = sinon.useFakeTimers(); + try { + class ThrottleTest { + private _handle: Function; + + constructor(fn: Function) { + this._handle = fn; + } + + @throttle( + 100, + (a: number, b: number) => a + b, + () => 0 + ) + report(p: number): void { + this._handle(p); + } + } + + const t = new ThrottleTest(spy); + + t.report(1); + t.report(2); + t.report(3); + assert.deepEqual(spy.args, [[1]]); + + clock.tick(200); + assert.deepEqual(spy.args, [[1], [5]]); + spy.reset(); + + t.report(4); + t.report(5); + clock.tick(50); + t.report(6); + + assert.deepEqual(spy.args, [[4]]); + clock.tick(60); + assert.deepEqual(spy.args, [[4], [11]]); + } finally { + clock.restore(); + } + }); }); diff --git a/src/vs/workbench/api/common/extHostProgress.ts b/src/vs/workbench/api/common/extHostProgress.ts index afb0fb647f8..27a4e145c42 100644 --- a/src/vs/workbench/api/common/extHostProgress.ts +++ b/src/vs/workbench/api/common/extHostProgress.ts @@ -9,7 +9,7 @@ import { ProgressLocation } from './extHostTypeConverters'; import { Progress, IProgressStep } from 'vs/platform/progress/common/progress'; import { localize } from 'vs/nls'; import { CancellationTokenSource, CancellationToken } from 'vs/base/common/cancellation'; -import { debounce } from 'vs/base/common/decorators'; +import { throttle } from 'vs/base/common/decorators'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; export class ExtHostProgress implements ExtHostProgressShape { @@ -85,7 +85,7 @@ class ProgressCallback extends Progress { super(p => this.throttledReport(p)); } - @debounce(100, (result: IProgressStep, currentValue: IProgressStep) => mergeProgress(result, currentValue), () => Object.create(null)) + @throttle(100, (result: IProgressStep, currentValue: IProgressStep) => mergeProgress(result, currentValue), () => Object.create(null)) throttledReport(p: IProgressStep): void { this._proxy.$progressReport(this._handle, p); } From 6e852b1baead535075ae421f2803916c17a61cf2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 12:12:43 +0100 Subject: [PATCH 226/637] fix spelling error --- src/vs/base/browser/ui/tree/abstractTree.ts | 2 +- src/vs/base/common/decorators.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 5f40e3d8987..732edc52118 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -1298,7 +1298,7 @@ export abstract class AbstractTree implements IDisposable onDidModelSplice(() => null, null, this.disposables); // Active nodes can change when the model changes or when focus or selection change. - // We debouce it with 0 delay since these events may fire in the same stack and we only + // We debounce it with 0 delay since these events may fire in the same stack and we only // want to run this once. It also doesn't matter if it runs on the next tick since it's only // a nice to have UI feature. onDidChangeActiveNodes.input = Event.chain(Event.any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange)) diff --git a/src/vs/base/common/decorators.ts b/src/vs/base/common/decorators.ts index be2f0a5a459..f9e39b6b941 100644 --- a/src/vs/base/common/decorators.ts +++ b/src/vs/base/common/decorators.ts @@ -84,11 +84,11 @@ export function memoize(target: any, key: string, descriptor: any) { return createMemoizer()(target, key, descriptor); } -export interface IDebouceReducer { +export interface IDebounceReducer { (previousValue: T, ...args: any[]): T; } -export function debounce(delay: number, reducer?: IDebouceReducer, initialValueProvider?: () => T): Function { +export function debounce(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function { return createDecorator((fn, key) => { const timerKey = `$debounce$${key}`; const resultKey = `$debounce$result$${key}`; @@ -113,7 +113,7 @@ export function debounce(delay: number, reducer?: IDebouceReducer, initial }); } -export function throttle(delay: number, reducer?: IDebouceReducer, initialValueProvider?: () => T): Function { +export function throttle(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function { return createDecorator((fn, key) => { const timerKey = `$throttle$timer$${key}`; const resultKey = `$throttle$result$${key}`; From 859a0ddbe9a9be404ea78d4cd28a52b374b58c98 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 12:25:09 +0100 Subject: [PATCH 227/637] failed/skipped test for https://github.com/microsoft/vscode/issues/86584 --- src/vs/base/test/common/hash.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/base/test/common/hash.test.ts b/src/vs/base/test/common/hash.test.ts index d197cdf4f1f..58b5904b63d 100644 --- a/src/vs/base/test/common/hash.test.ts +++ b/src/vs/base/test/common/hash.test.ts @@ -43,4 +43,14 @@ suite('Hash', () => { assert.notEqual(hash({ 'foo': 'bar' }), hash({ 'foo': 'bar2' })); assert.notEqual(hash({}), hash([])); }); -}); \ No newline at end of file + + test('array - unexpected collision', function () { + this.skip(); + const a = hash([undefined, undefined, undefined, undefined, undefined]); + const b = hash([undefined, undefined, 'HHHHHH', [{ line: 0, character: 0 }, { line: 0, character: 0 }], undefined]); + // console.log(a); + // console.log(b); + assert.notEqual(a, b); + }); + +}); From ccf9aeadc83bf0f38e96c94c208122cf6bb047a2 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 9 Dec 2019 12:30:52 +0100 Subject: [PATCH 228/637] Fix #85331 #86402 --- .../sharedProcess/sharedProcessMain.ts | 5 +- .../userDataSync/common/keybindingsSync.ts | 11 +- .../userDataSync/common/settingsMerge.ts | 191 ++++++ .../userDataSync/common/settingsSync.ts | 20 +- .../userDataSync/common/settingsSyncIpc.ts | 42 -- .../userDataSync/common/userDataSync.ts | 12 - .../test/common/settingsMerge.test.ts | 547 ++++++++++++++++++ .../userDataSync.contribution.ts | 5 +- .../common/settingsMergeService.ts | 208 ------- src/vs/workbench/workbench.common.main.ts | 1 - 10 files changed, 766 insertions(+), 276 deletions(-) create mode 100644 src/vs/platform/userDataSync/common/settingsMerge.ts delete mode 100644 src/vs/platform/userDataSync/common/settingsSyncIpc.ts create mode 100644 src/vs/platform/userDataSync/test/common/settingsMerge.test.ts delete mode 100644 src/vs/workbench/services/userDataSync/common/settingsMergeService.ts diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 96ce984b782..b750a9b003f 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -50,11 +50,10 @@ import { IFileService } from 'vs/platform/files/common/files'; import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider'; import { Schemas } from 'vs/base/common/network'; import { IProductService } from 'vs/platform/product/common/productService'; -import { IUserDataSyncService, IUserDataSyncStoreService, ISettingsMergeService, registerConfiguration, IUserDataSyncLogService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserDataSyncService, IUserDataSyncStoreService, registerConfiguration, IUserDataSyncLogService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyncService'; import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService'; import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; -import { SettingsMergeChannelClient } from 'vs/platform/userDataSync/common/settingsSyncIpc'; import { IElectronService } from 'vs/platform/electron/node/electron'; import { LoggerService } from 'vs/platform/log/node/loggerService'; import { UserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSyncLog'; @@ -186,8 +185,6 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat services.set(ICredentialsService, new SyncDescriptor(KeytarCredentialsService)); services.set(IAuthTokenService, new SyncDescriptor(AuthTokenService)); services.set(IUserDataSyncLogService, new SyncDescriptor(UserDataSyncLogService)); - const settingsMergeChannel = server.getChannel('settingsMerge', activeWindowRouter); - services.set(ISettingsMergeService, new SettingsMergeChannelClient(settingsMergeChannel)); services.set(IUserDataSyncUtilService, new UserDataSyncUtilServiceClient(server.getChannel('userDataSyncUtil', activeWindowRouter))); services.set(IUserDataSyncStoreService, new SyncDescriptor(UserDataSyncStoreService)); services.set(IUserDataSyncService, new SyncDescriptor(UserDataSyncService)); diff --git a/src/vs/platform/userDataSync/common/keybindingsSync.ts b/src/vs/platform/userDataSync/common/keybindingsSync.ts index 269065cd9a0..4735db86782 100644 --- a/src/vs/platform/userDataSync/common/keybindingsSync.ts +++ b/src/vs/platform/userDataSync/common/keybindingsSync.ts @@ -19,6 +19,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { CancellationToken } from 'vs/base/common/cancellation'; import { OS, OperatingSystem } from 'vs/base/common/platform'; import { isUndefined } from 'vs/base/common/types'; +import { FormattingOptions } from 'vs/base/common/jsonFormatter'; interface ISyncContent { mac?: string; @@ -217,7 +218,7 @@ export class KeybindingsSynchroniser extends Disposable implements ISynchroniser || lastSyncContent !== remoteContent // Remote has forwarded ) { this.logService.trace('Keybindings: Merging remote keybindings with local keybindings...'); - const formattingOptions = await this.userDataSyncUtilService.resolveFormattingOptions(this.environmentService.keybindingsResource); + const formattingOptions = await this.getFormattingOptions(); const result = await merge(localContent, remoteContent, lastSyncContent, formattingOptions, this.userDataSyncUtilService); // Sync only if there are changes if (result.hasChanges) { @@ -243,6 +244,14 @@ export class KeybindingsSynchroniser extends Disposable implements ISynchroniser return { fileContent, remoteUserData, hasLocalChanged, hasRemoteChanged, hasConflicts }; } + private _formattingOptions: Promise | undefined = undefined; + private getFormattingOptions(): Promise { + if (!this._formattingOptions) { + this._formattingOptions = this.userDataSyncUtilService.resolveFormattingOptions(this.environmentService.keybindingsResource); + } + return this._formattingOptions; + } + private async getLocalContent(): Promise { try { return await this.fileService.readFile(this.environmentService.keybindingsResource); diff --git a/src/vs/platform/userDataSync/common/settingsMerge.ts b/src/vs/platform/userDataSync/common/settingsMerge.ts new file mode 100644 index 00000000000..d7224e9f3a0 --- /dev/null +++ b/src/vs/platform/userDataSync/common/settingsMerge.ts @@ -0,0 +1,191 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as objects from 'vs/base/common/objects'; +import { parse, findNodeAtLocation, parseTree, Node } from 'vs/base/common/json'; +import { setProperty } from 'vs/base/common/jsonEdit'; +import { values } from 'vs/base/common/map'; +import { IStringDictionary } from 'vs/base/common/collections'; +import { FormattingOptions } from 'vs/base/common/jsonFormatter'; +import * as contentUtil from 'vs/platform/userDataSync/common/content'; + +export function computeRemoteContent(localContent: string, remoteContent: string, ignoredSettings: string[], formattingOptions: FormattingOptions): string { + if (ignoredSettings.length) { + const remote = parse(remoteContent); + const ignored = ignoredSettings.reduce((set, key) => { set.add(key); return set; }, new Set()); + for (const key of ignoredSettings) { + if (ignored.has(key)) { + localContent = contentUtil.edit(localContent, [key], remote[key], formattingOptions); + } + } + } + return localContent; +} + +export function merge(localContent: string, remoteContent: string, baseContent: string | null, ignoredSettings: string[], formattingOptions: FormattingOptions): { mergeContent: string, hasChanges: boolean, hasConflicts: boolean } { + const local = parse(localContent); + const remote = parse(remoteContent); + const base = baseContent ? parse(baseContent) : null; + const ignored = ignoredSettings.reduce((set, key) => { set.add(key); return set; }, new Set()); + + const localToRemote = compare(local, remote, ignored); + if (localToRemote.added.size === 0 && localToRemote.removed.size === 0 && localToRemote.updated.size === 0) { + // No changes found between local and remote. + return { mergeContent: localContent, hasChanges: false, hasConflicts: false }; + } + + const conflicts: Set = new Set(); + const baseToLocal = base ? compare(base, local, ignored) : { added: Object.keys(local).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; + const baseToRemote = base ? compare(base, remote, ignored) : { added: Object.keys(remote).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; + let mergeContent = localContent; + + // Removed settings in Local + for (const key of values(baseToLocal.removed)) { + // Got updated in remote + if (baseToRemote.updated.has(key)) { + conflicts.add(key); + } + } + + // Removed settings in Remote + for (const key of values(baseToRemote.removed)) { + if (conflicts.has(key)) { + continue; + } + // Got updated in local + if (baseToLocal.updated.has(key)) { + conflicts.add(key); + } else { + mergeContent = contentUtil.edit(mergeContent, [key], undefined, formattingOptions); + } + } + + // Added settings in Local + for (const key of values(baseToLocal.added)) { + if (conflicts.has(key)) { + continue; + } + // Got added in remote + if (baseToRemote.added.has(key)) { + // Has different value + if (localToRemote.updated.has(key)) { + conflicts.add(key); + } + } + } + + // Added settings in remote + for (const key of values(baseToRemote.added)) { + if (conflicts.has(key)) { + continue; + } + // Got added in local + if (baseToLocal.added.has(key)) { + // Has different value + if (localToRemote.updated.has(key)) { + conflicts.add(key); + } + } else { + mergeContent = contentUtil.edit(mergeContent, [key], remote[key], formattingOptions); + } + } + + // Updated settings in Local + for (const key of values(baseToLocal.updated)) { + if (conflicts.has(key)) { + continue; + } + // Got updated in remote + if (baseToRemote.updated.has(key)) { + // Has different value + if (localToRemote.updated.has(key)) { + conflicts.add(key); + } + } + } + + // Updated settings in Remote + for (const key of values(baseToRemote.updated)) { + if (conflicts.has(key)) { + continue; + } + // Got updated in local + if (baseToLocal.updated.has(key)) { + // Has different value + if (localToRemote.updated.has(key)) { + conflicts.add(key); + } + } else { + mergeContent = contentUtil.edit(mergeContent, [key], remote[key], formattingOptions); + } + } + + if (conflicts.size > 0) { + const conflictNodes: { key: string, node: Node | undefined }[] = []; + const tree = parseTree(mergeContent); + const eol = formattingOptions.eol!; + for (const key of values(conflicts)) { + const node = findNodeAtLocation(tree, [key]); + conflictNodes.push({ key, node }); + } + conflictNodes.sort((a, b) => { + if (a.node && b.node) { + return b.node.offset - a.node.offset; + } + return a.node ? 1 : -1; + }); + const lastNode = tree.children ? tree.children[tree.children.length - 1] : undefined; + for (const { key, node } of conflictNodes) { + const remoteEdit = setProperty(`{${eol}\t${eol}}`, [key], remote[key], { tabSize: 4, insertSpaces: false, eol: eol })[0]; + const remoteContent = remoteEdit ? `${remoteEdit.content.substring(remoteEdit.offset + remoteEdit.length + 1)},${eol}` : ''; + if (node) { + // Updated in Local and Remote with different value + const localStartOffset = contentUtil.getLineStartOffset(mergeContent, eol, node.parent!.offset); + const localEndOffset = contentUtil.getLineEndOffset(mergeContent, eol, node.offset + node.length); + mergeContent = mergeContent.substring(0, localStartOffset) + + `<<<<<<< local${eol}` + + mergeContent.substring(localStartOffset, localEndOffset) + + `${eol}=======${eol}${remoteContent}>>>>>>> remote` + + mergeContent.substring(localEndOffset); + } else { + // Removed in Local, but updated in Remote + if (lastNode) { + const localStartOffset = contentUtil.getLineEndOffset(mergeContent, eol, lastNode.offset + lastNode.length); + mergeContent = mergeContent.substring(0, localStartOffset) + + `${eol}<<<<<<< local${eol}=======${eol}${remoteContent}>>>>>>> remote` + + mergeContent.substring(localStartOffset); + } else { + const localStartOffset = tree.offset + 1; + mergeContent = mergeContent.substring(0, localStartOffset) + + `${eol}<<<<<<< local${eol}=======${eol}${remoteContent}>>>>>>> remote${eol}` + + mergeContent.substring(localStartOffset); + } + } + } + } + + return { mergeContent, hasChanges: true, hasConflicts: conflicts.size > 0 }; +} + +function compare(from: IStringDictionary, to: IStringDictionary, ignored: Set): { added: Set, removed: Set, updated: Set } { + const fromKeys = Object.keys(from).filter(key => !ignored.has(key)); + const toKeys = Object.keys(to).filter(key => !ignored.has(key)); + const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); + const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); + const updated: Set = new Set(); + + for (const key of fromKeys) { + if (removed.has(key)) { + continue; + } + const value1 = from[key]; + const value2 = to[key]; + if (!objects.equals(value1, value2)) { + updated.add(key); + } + } + + return { added, removed, updated }; +} diff --git a/src/vs/platform/userDataSync/common/settingsSync.ts b/src/vs/platform/userDataSync/common/settingsSync.ts index 4532f40b9dd..d65b456a539 100644 --- a/src/vs/platform/userDataSync/common/settingsSync.ts +++ b/src/vs/platform/userDataSync/common/settingsSync.ts @@ -5,7 +5,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IFileService, FileSystemProviderErrorCode, FileSystemProviderError, IFileContent } from 'vs/platform/files/common/files'; -import { IUserData, UserDataSyncStoreError, UserDataSyncStoreErrorCode, ISynchroniser, SyncStatus, ISettingsMergeService, IUserDataSyncStoreService, DEFAULT_IGNORED_SETTINGS, IUserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserData, UserDataSyncStoreError, UserDataSyncStoreErrorCode, ISynchroniser, SyncStatus, IUserDataSyncStoreService, DEFAULT_IGNORED_SETTINGS, IUserDataSyncLogService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; import { VSBuffer } from 'vs/base/common/buffer'; import { parse, ParseError } from 'vs/base/common/json'; import { localize } from 'vs/nls'; @@ -17,6 +17,8 @@ import { joinPath, dirname } from 'vs/base/common/resources'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { startsWith } from 'vs/base/common/strings'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { computeRemoteContent, merge } from 'vs/platform/userDataSync/common/settingsMerge'; +import { FormattingOptions } from 'vs/base/common/jsonFormatter'; interface ISyncPreviewResult { readonly fileContent: IFileContent | null; @@ -46,8 +48,8 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { @IFileService private readonly fileService: IFileService, @IEnvironmentService private readonly environmentService: IEnvironmentService, @IUserDataSyncStoreService private readonly userDataSyncStoreService: IUserDataSyncStoreService, - @ISettingsMergeService private readonly settingsMergeService: ISettingsMergeService, @IUserDataSyncLogService private readonly logService: IUserDataSyncLogService, + @IUserDataSyncUtilService private readonly userDataSyncUtilService: IUserDataSyncUtilService, @IConfigurationService private readonly configurationService: IConfigurationService, ) { super(); @@ -148,7 +150,8 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { await this.writeToLocal(content, fileContent); } if (hasRemoteChanged) { - const remoteContent = remoteUserData.content ? await this.settingsMergeService.computeRemoteContent(content, remoteUserData.content, this.getIgnoredSettings(content)) : content; + const formatUtils = await this.getFormattingOptions(); + const remoteContent = remoteUserData.content ? computeRemoteContent(content, remoteUserData.content, this.getIgnoredSettings(content), formatUtils) : content; this.logService.info('Settings: Updating remote settings'); const ref = await this.writeToRemote(remoteContent, remoteUserData.ref); remoteUserData = { ref, content }; @@ -205,7 +208,8 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { || lastSyncData.content !== remoteContent // Remote has forwarded ) { this.logService.trace('Settings: Merging remote settings with local settings...'); - const result = await this.settingsMergeService.merge(localContent, remoteContent, lastSyncData ? lastSyncData.content : null, this.getIgnoredSettings()); + const formatUtils = await this.getFormattingOptions(); + const result = merge(localContent, remoteContent, lastSyncData ? lastSyncData.content : null, this.getIgnoredSettings(), formatUtils); // Sync only if there are changes if (result.hasChanges) { hasLocalChanged = result.mergeContent !== localContent; @@ -230,6 +234,14 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser { return { fileContent, remoteUserData, hasLocalChanged, hasRemoteChanged, hasConflicts }; } + private _formattingOptions: Promise | undefined = undefined; + private getFormattingOptions(): Promise { + if (!this._formattingOptions) { + this._formattingOptions = this.userDataSyncUtilService.resolveFormattingOptions(this.environmentService.settingsResource); + } + return this._formattingOptions; + } + private getIgnoredSettings(settingsContent?: string): string[] { let value: string[] = []; if (settingsContent) { diff --git a/src/vs/platform/userDataSync/common/settingsSyncIpc.ts b/src/vs/platform/userDataSync/common/settingsSyncIpc.ts deleted file mode 100644 index 3f231e86454..00000000000 --- a/src/vs/platform/userDataSync/common/settingsSyncIpc.ts +++ /dev/null @@ -1,42 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -import { Event } from 'vs/base/common/event'; -import { ISettingsMergeService } from 'vs/platform/userDataSync/common/userDataSync'; - -export class SettingsMergeChannel implements IServerChannel { - - constructor(private readonly service: ISettingsMergeService) { } - - listen(_: unknown, event: string): Event { - throw new Error(`Event not found: ${event}`); - } - - call(context: any, command: string, args?: any): Promise { - switch (command) { - case 'merge': return this.service.merge(args[0], args[1], args[2], args[3]); - case 'computeRemoteContent': return this.service.computeRemoteContent(args[0], args[1], args[2]); - } - throw new Error('Invalid call'); - } -} - -export class SettingsMergeChannelClient implements ISettingsMergeService { - - _serviceBrand: undefined; - - constructor(private readonly channel: IChannel) { - } - - merge(localContent: string, remoteContent: string, baseContent: string | null, ignoredSettings: string[]): Promise<{ mergeContent: string, hasChanges: boolean, hasConflicts: boolean }> { - return this.channel.call('merge', [localContent, remoteContent, baseContent, ignoredSettings]); - } - - computeRemoteContent(localContent: string, remoteContent: string, ignoredSettings: string[]): Promise { - return this.channel.call('computeRemoteContent', [localContent, remoteContent, ignoredSettings]); - } - -} diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index bc76b41f9b0..21f92cacb8e 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -177,18 +177,6 @@ export interface IUserDataSyncService extends ISynchroniser { removeExtension(identifier: IExtensionIdentifier): Promise; } -export const ISettingsMergeService = createDecorator('ISettingsMergeService'); - -export interface ISettingsMergeService { - - _serviceBrand: undefined; - - merge(localContent: string, remoteContent: string, baseContent: string | null, ignoredSettings: string[]): Promise<{ mergeContent: string, hasChanges: boolean, hasConflicts: boolean }>; - - computeRemoteContent(localContent: string, remoteContent: string, ignoredSettings: string[]): Promise; - -} - export const IUserDataSyncUtilService = createDecorator('IUserDataSyncUtilService'); export interface IUserDataSyncUtilService { diff --git a/src/vs/platform/userDataSync/test/common/settingsMerge.test.ts b/src/vs/platform/userDataSync/test/common/settingsMerge.test.ts new file mode 100644 index 00000000000..911e11c97b7 --- /dev/null +++ b/src/vs/platform/userDataSync/test/common/settingsMerge.test.ts @@ -0,0 +1,547 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { merge, computeRemoteContent } from 'vs/platform/userDataSync/common/settingsMerge'; + +const formattingOptions = { eol: '\n', insertSpaces: false, tabSize: 4 }; + +suite('SettingsMerge - No Conflicts', () => { + + test('merge when local and remote are same with one entry', async () => { + const localContent = stringify({ 'a': 1 }); + const remoteContent = stringify({ 'a': 1 }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when local and remote are same with multiple entries', async () => { + const localContent = stringify({ + 'a': 1, + 'b': 2 + }); + const remoteContent = stringify({ + 'a': 1, + 'b': 2 + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when local and remote are same with multiple entries in different order', async () => { + const localContent = stringify({ + 'b': 2, + 'a': 1, + }); + const remoteContent = stringify({ + 'a': 1, + 'b': 2 + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when local and remote are same with different base content', async () => { + const localContent = stringify({ + 'b': 2, + 'a': 1, + }); + const baseContent = stringify({ + 'a': 2, + 'b': 1 + }); + const remoteContent = stringify({ + 'a': 1, + 'b': 2 + }); + const actual = merge(localContent, remoteContent, baseContent, [], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when a new entry is added to remote', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({ + 'a': 1, + 'b': 2 + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, remoteContent); + }); + + test('merge when multiple new entries are added to remote', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({ + 'b': 2, + 'a': 1, + 'c': 3, + }); + const expected = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, expected); + }); + + test('merge when multiple new entries are added to remote from base and local has not changed', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({ + 'b': 2, + 'a': 1, + 'c': 3, + }); + const expected = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + }); + const actual = merge(localContent, remoteContent, localContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, expected); + }); + + test('merge when an entry is removed from remote from base and local has not changed', async () => { + const localContent = stringify({ + 'a': 1, + 'b': 2, + }); + const remoteContent = stringify({ + 'a': 1, + }); + const actual = merge(localContent, remoteContent, localContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, remoteContent); + }); + + test('merge when all entries are removed from base and local has not changed', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({}); + const actual = merge(localContent, remoteContent, localContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.deepEqual(JSON.parse(actual.mergeContent), {}); + }); + + test('merge when an entry is updated in remote from base and local has not changed', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({ + 'a': 2 + }); + const actual = merge(localContent, remoteContent, localContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, remoteContent); + }); + + test('merge when remote has moved forwareded with multiple changes and local stays with base', async () => { + const localContent = stringify({ + 'a': 1, + }); + const remoteContent = stringify({ + 'a': 2, + 'b': 1, + 'c': 3, + 'd': 4, + }); + const actual = merge(localContent, remoteContent, localContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, remoteContent); + }); + + test('merge when a new entries are added to local', async () => { + const localContent = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + 'd': 4, + }); + const remoteContent = stringify({ + 'a': 1, + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when multiple new entries are added to local from base and remote is not changed', async () => { + const localContent = stringify({ + 'a': 2, + 'b': 1, + 'c': 3, + 'd': 4, + }); + const remoteContent = stringify({ + 'a': 1, + }); + const actual = merge(localContent, remoteContent, remoteContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when an entry is removed from local from base and remote has not changed', async () => { + const localContent = stringify({ + 'a': 1, + 'c': 2 + }); + const remoteContent = stringify({ + 'a': 2, + 'b': 1, + 'c': 3, + 'd': 4, + }); + const actual = merge(localContent, remoteContent, remoteContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when an entry is updated in local from base and remote has not changed', async () => { + const localContent = stringify({ + 'a': 1, + 'c': 2 + }); + const remoteContent = stringify({ + 'a': 2, + 'c': 2, + }); + const actual = merge(localContent, remoteContent, remoteContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('merge when local has moved forwarded with multiple changes and remote stays with base', async () => { + const localContent = stringify({ + 'a': 2, + 'b': 1, + 'c': 3, + 'd': 4, + }); + const remoteContent = stringify({ + 'a': 1, + }); + const actual = merge(localContent, remoteContent, remoteContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + +}); + +suite('SettingsMerge - Conflicts', () => { + + test('merge when local and remote with one entry but different value', async () => { + const localContent = stringify({ + 'a': 1 + }); + const remoteContent = stringify({ + 'a': 2 + }); + const actual = merge(localContent, remoteContent, null, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `{ +<<<<<<< local + "a": 1 +======= + "a": 2, +>>>>>>> remote +}`); + }); + + test('merge when the entry is removed in remote but updated in local and a new entry is added in remote', async () => { + const baseContent = stringify({ + 'a': 1 + }); + const localContent = stringify({ + 'a': 2 + }); + const remoteContent = stringify({ + 'b': 2 + }); + const actual = merge(localContent, remoteContent, baseContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `{ +<<<<<<< local + "a": 2, +======= +>>>>>>> remote + "b": 2 +}`); + }); + + test('merge with single entry and local is empty', async () => { + const baseContent = stringify({ + 'a': 1 + }); + const localContent = stringify({}); + const remoteContent = stringify({ + 'a': 2 + }); + const actual = merge(localContent, remoteContent, baseContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `{ +<<<<<<< local +======= + "a": 2, +>>>>>>> remote +}`); + }); + + test('merge when local and remote has moved forwareded with conflicts', async () => { + const baseContent = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + 'd': 4, + }); + const localContent = stringify({ + 'a': 2, + 'c': 3, + 'd': 5, + 'e': 4, + 'f': 1, + }); + const remoteContent = stringify({ + 'b': 3, + 'c': 3, + 'd': 6, + 'e': 5, + }); + const actual = merge(localContent, remoteContent, baseContent, [], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `{ +<<<<<<< local + "a": 2, +======= +>>>>>>> remote + "c": 3, +<<<<<<< local + "d": 5, +======= + "d": 6, +>>>>>>> remote +<<<<<<< local + "e": 4, +======= + "e": 5, +>>>>>>> remote + "f": 1 +<<<<<<< local +======= + "b": 3, +>>>>>>> remote +}`); + }); + +}); + +suite('SettingsMerge - Ignored Settings', () => { + + test('ignored setting is not merged when changed in local and remote', async () => { + const localContent = stringify({ 'a': 1 }); + const remoteContent = stringify({ 'a': 2 }); + const actual = merge(localContent, remoteContent, null, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged when changed in local and remote from base', async () => { + const baseContent = stringify({ 'a': 0 }); + const localContent = stringify({ 'a': 1 }); + const remoteContent = stringify({ 'a': 2 }); + const actual = merge(localContent, remoteContent, baseContent, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged when added in remote', async () => { + const localContent = stringify({}); + const remoteContent = stringify({ 'a': 1 }); + const actual = merge(localContent, remoteContent, null, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged when added in remote from base', async () => { + const localContent = stringify({ 'b': 2 }); + const remoteContent = stringify({ 'a': 1, 'b': 2 }); + const actual = merge(localContent, remoteContent, localContent, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged when removed in remote', async () => { + const localContent = stringify({ 'a': 1 }); + const remoteContent = stringify({}); + const actual = merge(localContent, remoteContent, null, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged when removed in remote from base', async () => { + const localContent = stringify({ 'a': 2 }); + const remoteContent = stringify({}); + const actual = merge(localContent, remoteContent, localContent, ['a'], formattingOptions); + assert.ok(!actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, localContent); + }); + + test('ignored setting is not merged with other changes without conflicts', async () => { + const baseContent = stringify({ + 'a': 2, + 'b': 2, + 'c': 3, + 'd': 4, + 'e': 5, + }); + const localContent = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + }); + const remoteContent = stringify({ + 'a': 3, + 'b': 3, + 'd': 4, + 'e': 6, + }); + const expectedContent = stringify({ + 'a': 1, + 'b': 3, + }); + const actual = merge(localContent, remoteContent, baseContent, ['a', 'e'], formattingOptions); + assert.ok(actual.hasChanges); + assert.ok(!actual.hasConflicts); + assert.equal(actual.mergeContent, expectedContent); + }); + + test('ignored setting is not merged with other changes conflicts', async () => { + const baseContent = stringify({ + 'a': 2, + 'b': 2, + 'c': 3, + 'd': 4, + 'e': 5, + }); + const localContent = stringify({ + 'a': 1, + 'b': 4, + 'c': 3, + 'd': 5, + }); + const remoteContent = stringify({ + 'a': 3, + 'b': 3, + 'e': 6, + }); + const actual = merge(localContent, remoteContent, baseContent, ['a', 'e'], formattingOptions); + //'{\n\t"a": 1,\n\n<<<<<<< local\t"b": 4,\n=======\n\t"b": 3,\n>>>>>>> remote' + //'{\n\t"a": 1,\n<<<<<<< local\n\t"b": 4,\n=======\n\t"b": 3,\n>>>>>>> remote\n<<<<<<< local\n\t"d": 5\n=======\n>>>>>>> remote\n}' + assert.ok(actual.hasChanges); + assert.ok(actual.hasChanges); + assert.ok(actual.hasConflicts); + assert.equal(actual.mergeContent, + `{ + "a": 1, +<<<<<<< local + "b": 4, +======= + "b": 3, +>>>>>>> remote +<<<<<<< local + "d": 5 +======= +>>>>>>> remote +}`); + }); + +}); + +suite('SettingsMerge - Compute Remote Content', () => { + + test('local content is returned when there are no ignored settings', async () => { + const localContent = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + }); + const remoteContent = stringify({ + 'a': 3, + 'b': 3, + 'd': 4, + 'e': 6, + }); + const actual = computeRemoteContent(localContent, remoteContent, [], formattingOptions); + assert.equal(actual, localContent); + }); + + test('ignored settings are not updated from remote content', async () => { + const localContent = stringify({ + 'a': 1, + 'b': 2, + 'c': 3, + }); + const remoteContent = stringify({ + 'a': 3, + 'b': 3, + 'd': 4, + 'e': 6, + }); + const expected = stringify({ + 'a': 3, + 'b': 2, + 'c': 3, + }); + const actual = computeRemoteContent(localContent, remoteContent, ['a'], formattingOptions); + assert.equal(actual, expected); + }); + +}); + +function stringify(value: any): string { + return JSON.stringify(value, null, '\t'); +} diff --git a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts index 1ff66d24159..db872bdd689 100644 --- a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts +++ b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts @@ -4,21 +4,18 @@ *--------------------------------------------------------------------------------------------*/ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions'; -import { ISettingsMergeService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; import { Registry } from 'vs/platform/registry/common/platform'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; -import { SettingsMergeChannel } from 'vs/platform/userDataSync/common/settingsSyncIpc'; import { UserDataSycnUtilServiceChannel } from 'vs/platform/userDataSync/common/keybindingsSyncIpc'; class UserDataSyncServicesContribution implements IWorkbenchContribution { constructor( - @ISettingsMergeService settingsMergeService: ISettingsMergeService, @IUserDataSyncUtilService userDataSyncUtilService: IUserDataSyncUtilService, @ISharedProcessService sharedProcessService: ISharedProcessService, ) { - sharedProcessService.registerChannel('settingsMerge', new SettingsMergeChannel(settingsMergeService)); sharedProcessService.registerChannel('userDataSyncUtil', new UserDataSycnUtilServiceChannel(userDataSyncUtilService)); } } diff --git a/src/vs/workbench/services/userDataSync/common/settingsMergeService.ts b/src/vs/workbench/services/userDataSync/common/settingsMergeService.ts deleted file mode 100644 index 3e3c652ff1f..00000000000 --- a/src/vs/workbench/services/userDataSync/common/settingsMergeService.ts +++ /dev/null @@ -1,208 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as objects from 'vs/base/common/objects'; -import { parse, findNodeAtLocation, parseTree } from 'vs/base/common/json'; -import { EditOperation } from 'vs/editor/common/core/editOperation'; -import { IModeService } from 'vs/editor/common/services/modeService'; -import { ITextModel } from 'vs/editor/common/model'; -import { setProperty } from 'vs/base/common/jsonEdit'; -import { Range } from 'vs/editor/common/core/range'; -import { Selection } from 'vs/editor/common/core/selection'; -import { IModelService } from 'vs/editor/common/services/modelService'; -import { Position } from 'vs/editor/common/core/position'; -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ISettingsMergeService } from 'vs/platform/userDataSync/common/userDataSync'; -import { values } from 'vs/base/common/map'; -import { IStringDictionary } from 'vs/base/common/collections'; - -class SettingsMergeService implements ISettingsMergeService { - - _serviceBrand: undefined; - - constructor( - @IModelService private readonly modelService: IModelService, - @IModeService private readonly modeService: IModeService, - ) { } - - async merge(localContent: string, remoteContent: string, baseContent: string | null, ignoredSettings: string[]): Promise<{ mergeContent: string, hasChanges: boolean, hasConflicts: boolean }> { - const local = parse(localContent); - const remote = parse(remoteContent); - const base = baseContent ? parse(baseContent) : null; - const ignored = ignoredSettings.reduce((set, key) => { set.add(key); return set; }, new Set()); - - const localToRemote = this.compare(local, remote, ignored); - if (localToRemote.added.size === 0 && localToRemote.removed.size === 0 && localToRemote.updated.size === 0) { - // No changes found between local and remote. - return { mergeContent: localContent, hasChanges: false, hasConflicts: false }; - } - - const conflicts: Set = new Set(); - const baseToLocal = base ? this.compare(base, local, ignored) : { added: Object.keys(local).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; - const baseToRemote = base ? this.compare(base, remote, ignored) : { added: Object.keys(remote).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; - const settingsPreviewModel = this.modelService.createModel(localContent, this.modeService.create('jsonc')); - - // Removed settings in Local - for (const key of values(baseToLocal.removed)) { - // Got updated in remote - if (baseToRemote.updated.has(key)) { - conflicts.add(key); - } - } - - // Removed settings in Remote - for (const key of values(baseToRemote.removed)) { - if (conflicts.has(key)) { - continue; - } - // Got updated in local - if (baseToLocal.updated.has(key)) { - conflicts.add(key); - } else { - this.editSetting(settingsPreviewModel, key, undefined); - } - } - - // Added settings in Local - for (const key of values(baseToLocal.added)) { - if (conflicts.has(key)) { - continue; - } - // Got added in remote - if (baseToRemote.added.has(key)) { - // Has different value - if (localToRemote.updated.has(key)) { - conflicts.add(key); - } - } - } - - // Added settings in remote - for (const key of values(baseToRemote.added)) { - if (conflicts.has(key)) { - continue; - } - // Got added in local - if (baseToLocal.added.has(key)) { - // Has different value - if (localToRemote.updated.has(key)) { - conflicts.add(key); - } - } else { - this.editSetting(settingsPreviewModel, key, remote[key]); - } - } - - // Updated settings in Local - for (const key of values(baseToLocal.updated)) { - if (conflicts.has(key)) { - continue; - } - // Got updated in remote - if (baseToRemote.updated.has(key)) { - // Has different value - if (localToRemote.updated.has(key)) { - conflicts.add(key); - } - } - } - - // Updated settings in Remote - for (const key of values(baseToRemote.updated)) { - if (conflicts.has(key)) { - continue; - } - // Got updated in local - if (baseToLocal.updated.has(key)) { - // Has different value - if (localToRemote.updated.has(key)) { - conflicts.add(key); - } - } else { - this.editSetting(settingsPreviewModel, key, remote[key]); - } - } - - for (const key of values(conflicts)) { - const tree = parseTree(settingsPreviewModel.getValue()); - const valueNode = findNodeAtLocation(tree, [key]); - const eol = settingsPreviewModel.getEOL(); - const remoteEdit = setProperty(`{${eol}\t${eol}}`, [key], remote[key], { tabSize: 4, insertSpaces: false, eol: eol })[0]; - const remoteContent = remoteEdit ? `${remoteEdit.content.substring(remoteEdit.offset + remoteEdit.length + 1)},${eol}` : ''; - if (valueNode) { - // Updated in Local and Remote with different value - const keyPosition = settingsPreviewModel.getPositionAt(valueNode.parent!.offset); - const valuePosition = settingsPreviewModel.getPositionAt(valueNode.offset + valueNode.length); - const editOperations = [ - EditOperation.insert(new Position(keyPosition.lineNumber - 1, settingsPreviewModel.getLineMaxColumn(keyPosition.lineNumber - 1)), `${eol}<<<<<<< local`), - EditOperation.insert(new Position(valuePosition.lineNumber, settingsPreviewModel.getLineMaxColumn(valuePosition.lineNumber)), `${eol}=======${eol}${remoteContent}>>>>>>> remote`) - ]; - settingsPreviewModel.pushEditOperations([new Selection(keyPosition.lineNumber, keyPosition.column, keyPosition.lineNumber, keyPosition.column)], editOperations, () => []); - } else { - // Removed in Local, but updated in Remote - const position = new Position(settingsPreviewModel.getLineCount() - 1, settingsPreviewModel.getLineMaxColumn(settingsPreviewModel.getLineCount() - 1)); - const editOperations = [ - EditOperation.insert(position, `${eol}<<<<<<< local${eol}=======${eol}${remoteContent}>>>>>>> remote`) - ]; - settingsPreviewModel.pushEditOperations([new Selection(position.lineNumber, position.column, position.lineNumber, position.column)], editOperations, () => []); - } - } - return { mergeContent: settingsPreviewModel.getValue(), hasChanges: true, hasConflicts: conflicts.size > 0 }; - } - - async computeRemoteContent(localContent: string, remoteContent: string, ignoredSettings: string[]): Promise { - const remote = parse(remoteContent); - const remoteModel = this.modelService.createModel(localContent, this.modeService.create('jsonc')); - const ignored = ignoredSettings.reduce((set, key) => { set.add(key); return set; }, new Set()); - for (const key of ignoredSettings) { - if (ignored.has(key)) { - this.editSetting(remoteModel, key, undefined); - this.editSetting(remoteModel, key, remote[key]); - } - } - return remoteModel.getValue(); - } - - private editSetting(model: ITextModel, key: string, value: any | undefined): void { - const insertSpaces = model.getOptions().insertSpaces; - const tabSize = model.getOptions().tabSize; - const eol = model.getEOL(); - const edit = setProperty(model.getValue(), [key], value, { tabSize, insertSpaces, eol })[0]; - if (edit) { - const startPosition = model.getPositionAt(edit.offset); - const endPosition = model.getPositionAt(edit.offset + edit.length); - const range = new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column); - let currentText = model.getValueInRange(range); - if (edit.content !== currentText) { - const editOperation = currentText ? EditOperation.replace(range, edit.content) : EditOperation.insert(startPosition, edit.content); - model.pushEditOperations([new Selection(startPosition.lineNumber, startPosition.column, startPosition.lineNumber, startPosition.column)], [editOperation], () => []); - } - } - } - - private compare(from: IStringDictionary, to: IStringDictionary, ignored: Set): { added: Set, removed: Set, updated: Set } { - const fromKeys = Object.keys(from).filter(key => !ignored.has(key)); - const toKeys = Object.keys(to).filter(key => !ignored.has(key)); - const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); - const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); - const updated: Set = new Set(); - - for (const key of fromKeys) { - if (removed.has(key)) { - continue; - } - const value1 = from[key]; - const value2 = to[key]; - if (!objects.equals(value1, value2)) { - updated.add(key); - } - } - - return { added, removed, updated }; - } - -} - -registerSingleton(ISettingsMergeService, SettingsMergeService); diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 9f9f8a80d7c..c0b70a6d0e9 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -79,7 +79,6 @@ import 'vs/workbench/services/label/common/labelService'; import 'vs/workbench/services/extensionManagement/common/extensionEnablementService'; import 'vs/workbench/services/notification/common/notificationService'; import 'vs/workbench/services/extensions/common/staticExtensions'; -import 'vs/workbench/services/userDataSync/common/settingsMergeService'; import 'vs/workbench/services/userDataSync/common/userDataSyncUtil'; import 'vs/workbench/services/path/common/remotePathService'; import 'vs/workbench/services/remote/common/remoteExplorerService'; From 34fb5e910e2941a8641f32d58be52a8006c27c40 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 12:51:32 +0100 Subject: [PATCH 229/637] print warning and telemetry message when resolveCompletionItem is changing the insert behaviour, #86122 --- .../api/common/extHostLanguageFeatures.ts | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 76a9b14643b..bd569e64b04 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -740,11 +740,16 @@ class SuggestAdapter { private _cache = new Cache('CompletionItem'); private _disposables = new Map(); + private _didWarnMust: boolean = false; + private _didWarnShould: boolean = false; + constructor( private readonly _documents: ExtHostDocuments, private readonly _commands: CommandsConverter, private readonly _provider: vscode.CompletionItemProvider, - private readonly _logService: ILogService + private readonly _logService: ILogService, + private readonly _telemetry: extHostProtocol.MainThreadTelemetryShape, + private readonly _extensionId: ExtensionIdentifier ) { } provideCompletionItems(resource: URI, position: IPosition, context: modes.CompletionContext, token: CancellationToken): Promise { @@ -809,12 +814,37 @@ class SuggestAdapter { return Promise.resolve(undefined); } + const _mustNotChange = SuggestAdapter._mustNotChangeHash(item); + const _mayNotChange = SuggestAdapter._mayNotChangeHash(item); + return asPromise(() => this._provider.resolveCompletionItem!(item, token)).then(resolvedItem => { if (!resolvedItem) { return undefined; } + type BlameExtension = { + extensionId: string; + kind: string + }; + + type BlameExtensionMeta = { + extensionId: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth' }; + kind: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth' }; + }; + + if (!this._didWarnMust && _mustNotChange !== SuggestAdapter._mustNotChangeHash(resolvedItem)) { + this._logService.warn(`[${this._extensionId.value}] INVALID result from 'resolveCompletionItem', extension MUST NOT change any of: label, sortText, filterText, insertText, or textEdit`); + this._telemetry.$publicLog2('resolveCompletionItem/invalid', { extensionId: this._extensionId.value, kind: 'must' }); + this._didWarnMust = true; + } + + if (!this._didWarnShould && _mayNotChange !== SuggestAdapter._mayNotChangeHash(resolvedItem)) { + this._logService.info(`[${this._extensionId.value}] UNSAVE result from 'resolveCompletionItem', extension SHOULD NOT change any of: additionalTextEdits, or command`); + this._telemetry.$publicLog2('resolveCompletionItem/invalid', { extensionId: this._extensionId.value, kind: 'should' }); + this._didWarnShould = true; + } + const pos = typeConvert.Position.to(position); return this._convertCompletionItem(resolvedItem, pos, id); }); @@ -908,6 +938,16 @@ class SuggestAdapter { private static _isValidRangeForCompletion(range: vscode.Range, position: vscode.Position): boolean { return range.isSingleLine || range.start.line === position.line; } + + private static _mustNotChangeHash(item: vscode.CompletionItem) { + const args = [item.label, item.sortText, item.filterText, item.insertText, item.range, item.range2]; + const res = JSON.stringify(args); + return res; + } + + private static _mayNotChangeHash(item: vscode.CompletionItem) { + return JSON.stringify([item.additionalTextEdits, item.command]); + } } class SignatureHelpAdapter { @@ -1253,7 +1293,8 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF private static _handlePool: number = 0; private readonly _uriTransformer: IURITransformer | null; - private _proxy: extHostProtocol.MainThreadLanguageFeaturesShape; + private readonly _proxy: extHostProtocol.MainThreadLanguageFeaturesShape; + private readonly _telemetryShape: extHostProtocol.MainThreadTelemetryShape; private _documents: ExtHostDocuments; private _commands: ExtHostCommands; private _diagnostics: ExtHostDiagnostics; @@ -1270,6 +1311,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF ) { this._uriTransformer = uriTransformer; this._proxy = mainContext.getProxy(extHostProtocol.MainContext.MainThreadLanguageFeatures); + this._telemetryShape = mainContext.getProxy(extHostProtocol.MainContext.MainThreadTelemetry); this._documents = documents; this._commands = commands; this._diagnostics = diagnostics; @@ -1584,7 +1626,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF // --- suggestion registerCompletionItemProvider(extension: IExtensionDescription, selector: vscode.DocumentSelector, provider: vscode.CompletionItemProvider, triggerCharacters: string[]): vscode.Disposable { - const handle = this._addNewAdapter(new SuggestAdapter(this._documents, this._commands.converter, provider, this._logService), extension); + const handle = this._addNewAdapter(new SuggestAdapter(this._documents, this._commands.converter, provider, this._logService, this._telemetryShape, extension.identifier), extension); this._proxy.$registerSuggestSupport(handle, this._transformDocumentSelector(selector), triggerCharacters, SuggestAdapter.supportsResolving(provider), extension.identifier); return this._createDisposable(handle); } From 687853ecc63d3b4b747cc95ef8b87199be47a52c Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 14:23:44 +0100 Subject: [PATCH 230/637] fix #86276 --- src/vs/editor/contrib/suggest/suggestModel.ts | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/vs/editor/contrib/suggest/suggestModel.ts b/src/vs/editor/contrib/suggest/suggestModel.ts index a6b85326cfe..8b54a83d451 100644 --- a/src/vs/editor/contrib/suggest/suggestModel.ts +++ b/src/vs/editor/contrib/suggest/suggestModel.ts @@ -21,6 +21,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { WordDistance } from 'vs/editor/contrib/suggest/wordDistance'; import { EditorOption } from 'vs/editor/common/config/editorOptions'; +import { isLowSurrogate, isHighSurrogate } from 'vs/base/common/strings'; export interface ICancelEvent { readonly retrigger: boolean; @@ -95,7 +96,7 @@ export class SuggestModel implements IDisposable { private readonly _toDispose = new DisposableStore(); private _quickSuggestDelay: number = 10; - private _triggerCharacterListener?: IDisposable; + private readonly _triggerCharacterListener = new DisposableStore(); private readonly _triggerQuickSuggest = new TimeoutTimer(); private _state: State = State.Idle; @@ -181,8 +182,7 @@ export class SuggestModel implements IDisposable { } private _updateTriggerCharacters(): void { - - dispose(this._triggerCharacterListener); + this._triggerCharacterListener.clear(); if (this._editor.getOption(EditorOption.readOnly) || !this._editor.hasModel() @@ -191,29 +191,49 @@ export class SuggestModel implements IDisposable { return; } - const supportsByTriggerCharacter: { [ch: string]: Set } = Object.create(null); + const supportsByTriggerCharacter = new Map>(); for (const support of CompletionProviderRegistry.all(this._editor.getModel())) { for (const ch of support.triggerCharacters || []) { - let set = supportsByTriggerCharacter[ch]; + let set = supportsByTriggerCharacter.get(ch); if (!set) { - set = supportsByTriggerCharacter[ch] = new Set(); + set = new Set(); set.add(getSnippetSuggestSupport()); + supportsByTriggerCharacter.set(ch, set); } set.add(support); } } - this._triggerCharacterListener = this._editor.onDidType(text => { - const lastChar = text.charAt(text.length - 1); - const supports = supportsByTriggerCharacter[lastChar]; + const checkTriggerCharacter = (text?: string) => { + + if (!text) { + // came here from the compositionEnd-event + const position = this._editor.getPosition()!; + const model = this._editor.getModel()!; + text = model.getLineContent(position.lineNumber).substr(0, position.column - 1); + } + + let lastChar = ''; + if (isLowSurrogate(text.charCodeAt(text.length - 1))) { + if (isHighSurrogate(text.charCodeAt(text.length - 2))) { + lastChar = text.substr(text.length - 2); + } + } else { + lastChar = text.charAt(text.length - 1); + } + + const supports = supportsByTriggerCharacter.get(lastChar); if (supports) { // keep existing items that where not computed by the // supports/providers that want to trigger now const items: CompletionItem[] | undefined = this._completionModel ? this._completionModel.adopt(supports) : undefined; this.trigger({ auto: true, shy: false, triggerCharacter: lastChar }, Boolean(this._completionModel), supports, items); } - }); + }; + + this._triggerCharacterListener.add(this._editor.onDidType(checkTriggerCharacter)); + this._triggerCharacterListener.add(this._editor.onCompositionEnd(checkTriggerCharacter)); } // --- trigger/retrigger/cancel suggest From 7155f246d191220373fa990eebc80aa446cdfbaf Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Mon, 9 Dec 2019 14:24:21 +0100 Subject: [PATCH 231/637] Improve JSDoc --- src/vs/vscode.proposed.d.ts | 145 ++++++++++++++++++++++-------------- 1 file changed, 90 insertions(+), 55 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 3e9061a0917..4b7ea910891 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -133,12 +133,15 @@ declare module 'vscode' { */ export interface SemanticTokensProvider { /** - * A file can contain many tokens, perhaps even hundreds of thousands tokens. Therefore, to improve - * the memory consumption around describing semantic tokens, we have decided to avoid allocating objects - * and we have decided to represent tokens from a file as an array of integers. + * A file can contain many tokens, perhaps even hundreds of thousands of tokens. Therefore, to improve + * the memory consumption around describing semantic tokens, we have decided to avoid allocating an object + * for each token and we represent tokens from a file as an array of integers. Furthermore, the position + * of each token is expressed relative to the token before it because most tokens remain stable relative to + * each other when edits are made in a file. * * - * In short, each token takes 5 integers to represent, so a specific token i in the file consists of the following fields: + * --- + * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following fields: * - at index `5*i` - `deltaLine`: token line number, relative to the previous token * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. @@ -146,87 +149,119 @@ declare module 'vscode' { * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` * * + * + * --- + * ### How to encode tokens + * * Here is an example for encoding a file with 3 tokens: * ``` - * [ { line: 2, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, + * { line: 2, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, * { line: 2, startChar: 10, length: 4, tokenType: "types", tokenModifiers: [] }, - * { line: 5, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } ] + * { line: 5, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } * ``` * * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. - * For this example, we will choose the following legend which is passed in when registering the provider: + * For this example, we will choose the following legend which must be passed in when registering the provider: * ``` - * { tokenTypes: ['', 'properties', 'types', 'classes'], - * tokenModifiers: ['', 'private', 'static'] } + * tokenTypes: ['properties', 'types', 'classes'], + * tokenModifiers: ['private', 'static'] * ``` * - * 2. The first transformation is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked + * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, - * so a `tokenModifier` value of `6` is first viewed as binary `0b110`, which means `[tokenModifiers[1], tokenModifiers[2]]` because - * bits 1 and 2 are set. Using this legend, the tokens now are: + * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because + * bits 0 and 1 are set. Using this legend, the tokens now are: * ``` - * [ { line: 2, startChar: 5, length: 3, tokenType: 1, tokenModifiers: 6 }, // 6 is 0b110 - * { line: 2, startChar: 10, length: 4, tokenType: 2, tokenModifiers: 0 }, - * { line: 5, startChar: 2, length: 7, tokenType: 3, tokenModifiers: 0 } ] + * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } * ``` * - * 3. Then, we will encode each token relative to the previous token in the file: + * 3. The next steps is to encode each token relative to the previous token in the file. In this case, the second token + * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` + * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the + * `startChar` of the third token will not be altered: * ``` - * [ { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 1, tokenModifiers: 6 }, - * // this token is on the same line as the first one, so the startChar is made relative - * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 2, tokenModifiers: 0 }, - * // this token is on a different line than the second one, so the startChar remains unchanged - * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 3, tokenModifiers: 0 } ] + * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } * ``` * - * 4. Finally, the integers are organized in a single array, which is a memory friendly representation: + * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: * ``` * // 1st token, 2nd token, 3rd token - * [ 2,5,3,1,6, 0,5,4,2,0, 3,2,7,3,0 ] + * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] * ``` * - * In principle, each call to `provideSemanticTokens` expects a complete representations of the semantic tokens. - * It is possible to simply return all the tokens at each call. * - * But oftentimes, a small edit in the file will result in a small change to the above delta-based represented tokens. - * (In fact, that is why the above tokens are delta-encoded relative to their corresponding previous tokens). - * In such a case, if VS Code passes in the previous result id, it is possible for an advanced tokenization provider - * to return a delta to the integers array. * - * To continue with the previous example, suppose a new line has been pressed at the beginning of the file, such that - * all the tokens are now one line lower, and that a new token has appeared since the last result on line 4. - * For example, the tokens might look like: + * --- + * ### How tokens change when the document changes + * + * Let's look at how tokens might change. + * + * Continuing with the above example, suppose a new line was inserted at the top of the file. + * That would make all the tokens move down by one line (notice how the line has changed for each one): * ``` - * [ { line: 3, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, + * { line: 3, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, + * { line: 3, startChar: 10, length: 4, tokenType: "types", tokenModifiers: [] }, + * { line: 6, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } + * ``` + * The integer encoding of the tokens does not change substantially because of the delta-encoding of positions: + * ``` + * // 1st token, 2nd token, 3rd token + * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * ``` + * It is possible to express these new tokens in terms of an edit applied to the previous tokens: + * ``` + * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * + * edit: { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3 + * ``` + * + * Furthermore, let's assume that a new token has appeared on line 4: + * ``` + * { line: 3, startChar: 5, length: 3, tokenType: "properties", tokenModifiers: ["private", "static"] }, * { line: 3, startChar: 10, length: 4, tokenType: "types", tokenModifiers: [] }, * { line: 4, startChar: 3, length: 5, tokenType: "properties", tokenModifiers: ["static"] }, - * { line: 6, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } ] + * { line: 6, startChar: 2, length: 7, tokenType: "classes", tokenModifiers: [] } + * ``` + * The integer encoding of the tokens is: + * ``` + * // 1st token, 2nd token, 3rd token, 4th token + * [ 3,5,3,0,3, 0,5,4,1,0, 1,3,5,0,2, 2,2,7,2,0, ] + * ``` + * Again, it is possible to express these new tokens in terms of an edit applied to the previous tokens: + * ``` + * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * [ 3,5,3,0,3, 0,5,4,1,0, 1,3,5,0,2, 2,2,7,2,0, ] + * + * edit: { start: 10, deleteCount: 1, data: [1,3,5,0,2,2] } // replace integer at offset 10 with [1,3,5,0,2,2] * ``` * - * The integer encoding of all new tokens would be: - * ``` - * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] - * ``` * - * A smart tokens provider can return a `resultId` to `SemanticTokens`. Then, if the editor still has in memory the previous - * result, the editor will pass in options the previous result id at `SemanticTokensRequestOptions.previousResultId`. Only when - * the editor passes in the previous result id, it is safe and smart for a smart tokens provider can compute a diff from the - * previous result to the new result. * - * *NOTE*: It is illegal to return `SemanticTokensEdits` if `options.previousResultId` is not set! + * --- + * ### When to return `SemanticTokensEdits` * - * ``` - * [ 2,5,3,1,6, 0,5,4,2,0, 3,2,7,3,0 ] - * [ 3,5,3,1,6, 0,5,4,2,0, 1,3,5,1,2, 2,2,7,3,0 ] - * ``` - * and return as simple integer edits the diff: - * ``` - * { edits: [ - * { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3 - * { start: 10, deleteCount: 1, data: [1,3,5,1,2,2] } // replace integer at offset 10 with [1,3,5,1,2,2] - * ]} - * ``` - * All indices expressed in the returned diff represent indices in the old result array, so they all refer to the previous result state. + * When doing edits, it is possible that multiple edits occur until VS Code decides to invoke the semantic tokens provider. + * In principle, each call to `provideSemanticTokens` can return a full representations of the semantic tokens, and that would + * be a perfectly reasonable semantic tokens provider implementation. + * + * However, when having a language server running in a separate process, transferring all the tokens between processes + * might be slow, so VS Code allows to return the new tokens expressed in terms of multiple edits applied to the previous + * tokens. + * + * To clearly define what "previous tokens" means, it is possible to return a `resultId` with the semantic tokens. If the + * editor still has in memory the previous result, the editor will pass in options the previous `resultId` at + * `SemanticTokensRequestOptions.previousResultId`. Only when the editor passes in the previous `resultId`, it is allowed + * that a semantic tokens provider returns the new tokens expressed as edits to be applied to the previous result. Even in this + * case, the semantic tokens provider needs to return a new `resultId` that will identify these new tokens as a basis + * for the next request. + * + * *NOTE 1*: It is illegal to return `SemanticTokensEdits` if `options.previousResultId` is not set. + * *NOTE 2*: All edits in `SemanticTokensEdits` contain indices in the old integers array, so they all refer to the previous result state. */ provideSemanticTokens(document: TextDocument, options: SemanticTokensRequestOptions, token: CancellationToken): ProviderResult; } From a70c73c7a4a375a4e6bcadf012853a2bbe54dfca Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 14:33:10 +0100 Subject: [PATCH 232/637] Simple file dialog working for network share Fixes #86420 --- .../services/dialogs/browser/simpleFileDialog.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts index a8469d94185..8d9fcbd9fa0 100644 --- a/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts +++ b/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts @@ -22,7 +22,7 @@ import { Schemas } from 'vs/base/common/network'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { equalsIgnoreCase, format, startsWithIgnoreCase } from 'vs/base/common/strings'; +import { equalsIgnoreCase, format, startsWithIgnoreCase, startsWith } from 'vs/base/common/strings'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment'; import { isValidBasename } from 'vs/base/common/extpath'; @@ -205,8 +205,11 @@ export class SimpleFileDialog { } private remoteUriFrom(path: string): URI { - path = path.replace(/\\/g, '/'); - return resources.toLocalResource(URI.from({ scheme: this.scheme, path }), this.scheme === Schemas.file ? undefined : this.remoteAuthority); + if (!startsWith(path, '\\\\')) { + path = path.replace(/\\/g, '/'); + } + const uri: URI = this.scheme === Schemas.file ? URI.file(path) : URI.from({ scheme: this.scheme, path }); + return resources.toLocalResource(uri, uri.scheme === Schemas.file ? undefined : this.remoteAuthority); } private getScheme(available: readonly string[] | undefined, defaultUri: URI | undefined): string { From d363b988e1e58cf49963841c498681cdc6cb55a3 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 14:53:09 +0100 Subject: [PATCH 233/637] Prevent task error when no folder open Fixes #86419 --- .../workbench/contrib/tasks/browser/terminalTaskSystem.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index e9c719a87ae..837428886f6 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -1358,7 +1358,13 @@ export class TerminalTaskSystem implements ITaskSystem { private resolveOptions(resolver: VariableResolver, options: CommandOptions | undefined): CommandOptions { if (options === undefined || options === null) { - return { cwd: this.resolveVariable(resolver, '${workspaceFolder}') }; + let cwd: string | undefined; + try { + cwd = this.resolveVariable(resolver, '${workspaceFolder}'); + } catch (e) { + // No workspace + } + return { cwd }; } let result: CommandOptions = Types.isString(options.cwd) ? { cwd: this.resolveVariable(resolver, options.cwd) } From 0dfa355b3ad185a6289ba28a99c141ab9e72d2be Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 15:42:23 +0100 Subject: [PATCH 234/637] remove deprecated code check, jsdoc is what we use elsewhere, helps with #84283 --- .../workbench/api/common/extHostTextEditor.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/vs/workbench/api/common/extHostTextEditor.ts b/src/vs/workbench/api/common/extHostTextEditor.ts index 1e5404bbf2b..617bf6fbda9 100644 --- a/src/vs/workbench/api/common/extHostTextEditor.ts +++ b/src/vs/workbench/api/common/extHostTextEditor.ts @@ -133,19 +133,6 @@ export class TextEditorEdit { } } - -function deprecated(name: string, message: string = 'Refer to the documentation for further details.') { - return (target: Object, key: string, descriptor: TypedPropertyDescriptor) => { - const originalMethod = descriptor.value; - descriptor.value = function (...args: any[]) { - console.warn(`[Deprecation Warning] method '${name}' is deprecated and should no longer be used. ${message}`); - return originalMethod.apply(this, args); - }; - - return descriptor; - }; -} - export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { private _proxy: MainThreadTextEditorsShape; @@ -409,11 +396,11 @@ export class ExtHostTextEditor implements vscode.TextEditor { this._disposed = true; } - @deprecated('TextEditor.show') show(column: vscode.ViewColumn) { + show(column: vscode.ViewColumn) { this._proxy.$tryShowEditor(this._id, TypeConverters.ViewColumn.from(column)); } - @deprecated('TextEditor.hide') hide() { + hide() { this._proxy.$tryHideEditor(this._id); } From d503beb795849cd93db0bfbf677c90a4b573123a Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 15:49:55 +0100 Subject: [PATCH 235/637] Fix ports not unforwarding #86074 --- src/vs/workbench/services/remote/node/tunnelService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/remote/node/tunnelService.ts b/src/vs/workbench/services/remote/node/tunnelService.ts index d668ac3d3c6..6cb90f13add 100644 --- a/src/vs/workbench/services/remote/node/tunnelService.ts +++ b/src/vs/workbench/services/remote/node/tunnelService.ts @@ -153,8 +153,10 @@ export class TunnelService implements ITunnelService { if (--existing.refcount <= 0) { existing.value.then(tunnel => tunnel.dispose()); this._tunnels.delete(tunnel.tunnelRemotePort); - this._onTunnelClosed.fire(tunnel.tunnelRemotePort); } + } else { + tunnel.dispose(); + this._onTunnelClosed.fire(tunnel.tunnelRemotePort); } } }; From c14fd7b590a5c16dff120ea0fec7c5a655c34dcb Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 15:59:45 +0100 Subject: [PATCH 236/637] more console removal, #84283 --- .../workbench/api/common/extHost.api.impl.ts | 3 +- .../api/common/extHostDocumentsAndEditors.ts | 5 +- .../workbench/api/common/extHostTextEditor.ts | 59 +++++++++---------- .../api/extHostApiCommands.test.ts | 2 +- .../extHostDocumentSaveParticipant.test.ts | 2 +- .../api/extHostDocumentsAndEditors.test.ts | 3 +- .../api/extHostLanguageFeatures.test.ts | 2 +- .../api/extHostTextEditor.test.ts | 18 +++--- .../api/extHostTextEditors.test.ts | 3 +- 9 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index a57e6cdfd26..17d88ec6b3d 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -496,7 +496,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostStatusBar.setStatusBarMessage(text, timeoutOrThenable); }, withScmProgress(task: (progress: vscode.Progress) => Thenable) { - console.warn(`[Deprecation Warning] function 'withScmProgress' is deprecated and should no longer be used. Use 'withProgress' instead.`); return extHostProgress.withProgress(extension, { location: extHostTypes.ProgressLocation.SourceControl }, (progress, token) => task({ report(n: number) { /*noop*/ } })); }, withProgress(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; worked?: number }>, token: vscode.CancellationToken) => Thenable) { @@ -555,7 +554,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I get rootPath() { if (extension.isUnderDevelopment && !warnedRootPathDeprecated) { warnedRootPathDeprecated = true; - console.warn(`[Deprecation Warning] 'workspace.rootPath' is deprecated and should no longer be used. Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath`); + extHostLogService.warn(`[Deprecation Warning] 'workspace.rootPath' is deprecated and should no longer be used. Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath`); } return extHostWorkspace.getPath(); diff --git a/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts b/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts index 3ec6dce6547..533f7c4c68a 100644 --- a/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts +++ b/src/vs/workbench/api/common/extHostDocumentsAndEditors.ts @@ -13,6 +13,7 @@ import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { ExtHostTextEditor } from 'vs/workbench/api/common/extHostTextEditor'; import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters'; +import { ILogService } from 'vs/platform/log/common/log'; export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsShape { @@ -35,6 +36,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha constructor( @IExtHostRpcService private readonly _extHostRpc: IExtHostRpcService, + @ILogService private readonly _logService: ILogService ) { } $acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta): void { @@ -92,8 +94,9 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha const documentData = this._documents.get(resource.toString())!; const editor = new ExtHostTextEditor( - this._extHostRpc.getProxy(MainContext.MainThreadTextEditors), data.id, + this._extHostRpc.getProxy(MainContext.MainThreadTextEditors), + this._logService, documentData, data.selections.map(typeConverters.Selection.to), data.options, diff --git a/src/vs/workbench/api/common/extHostTextEditor.ts b/src/vs/workbench/api/common/extHostTextEditor.ts index 617bf6fbda9..f57af9da4ef 100644 --- a/src/vs/workbench/api/common/extHostTextEditor.ts +++ b/src/vs/workbench/api/common/extHostTextEditor.ts @@ -14,6 +14,7 @@ import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData import * as TypeConverters from 'vs/workbench/api/common/extHostTypeConverters'; import { EndOfLine, Position, Range, Selection, SnippetString, TextEditorLineNumbersStyle, TextEditorRevealType } from 'vs/workbench/api/common/extHostTypes'; import * as vscode from 'vscode'; +import { ILogService } from 'vs/platform/log/common/log'; export class TextEditorDecorationType implements vscode.TextEditorDecorationType { @@ -137,6 +138,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { private _proxy: MainThreadTextEditorsShape; private _id: string; + private _logService: ILogService; private _tabSize!: number; private _indentSize!: number; @@ -144,10 +146,11 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { private _cursorStyle!: TextEditorCursorStyle; private _lineNumbers!: TextEditorLineNumbersStyle; - constructor(proxy: MainThreadTextEditorsShape, id: string, source: IResolvedTextEditorConfiguration) { + constructor(proxy: MainThreadTextEditorsShape, id: string, source: IResolvedTextEditorConfiguration, logService: ILogService) { this._proxy = proxy; this._id = id; this._accept(source); + this._logService = logService; } public _accept(source: IResolvedTextEditorConfiguration): void { @@ -194,7 +197,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { // reflect the new tabSize value immediately this._tabSize = tabSize; } - warnOnError(this._proxy.$trySetOptions(this._id, { + this._warnOnError(this._proxy.$trySetOptions(this._id, { tabSize: tabSize })); } @@ -235,7 +238,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { // reflect the new indentSize value immediately this._indentSize = indentSize; } - warnOnError(this._proxy.$trySetOptions(this._id, { + this._warnOnError(this._proxy.$trySetOptions(this._id, { indentSize: indentSize })); } @@ -261,7 +264,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { // reflect the new insertSpaces value immediately this._insertSpaces = insertSpaces; } - warnOnError(this._proxy.$trySetOptions(this._id, { + this._warnOnError(this._proxy.$trySetOptions(this._id, { insertSpaces: insertSpaces })); } @@ -276,7 +279,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { return; } this._cursorStyle = value; - warnOnError(this._proxy.$trySetOptions(this._id, { + this._warnOnError(this._proxy.$trySetOptions(this._id, { cursorStyle: value })); } @@ -291,7 +294,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { return; } this._lineNumbers = value; - warnOnError(this._proxy.$trySetOptions(this._id, { + this._warnOnError(this._proxy.$trySetOptions(this._id, { lineNumbers: TypeConverters.TextEditorLineNumbersStyle.from(value) })); } @@ -356,15 +359,17 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { } if (hasUpdate) { - warnOnError(this._proxy.$trySetOptions(this._id, bulkConfigurationUpdate)); + this._warnOnError(this._proxy.$trySetOptions(this._id, bulkConfigurationUpdate)); } } + + private _warnOnError(promise: Promise): void { + promise.catch(err => this._logService.warn(err)); + } } export class ExtHostTextEditor implements vscode.TextEditor { - private readonly _proxy: MainThreadTextEditorsShape; - private readonly _id: string; private readonly _documentData: ExtHostDocumentData; private _selections: Selection[]; @@ -374,18 +379,17 @@ export class ExtHostTextEditor implements vscode.TextEditor { private _disposed: boolean = false; private _hasDecorationsForKey: { [key: string]: boolean; }; - get id(): string { return this._id; } - constructor( - proxy: MainThreadTextEditorsShape, id: string, document: ExtHostDocumentData, + readonly id: string, + private readonly _proxy: MainThreadTextEditorsShape, + private readonly _logService: ILogService, + document: ExtHostDocumentData, selections: Selection[], options: IResolvedTextEditorConfiguration, visibleRanges: Range[], viewColumn: vscode.ViewColumn | undefined ) { - this._proxy = proxy; - this._id = id; this._documentData = document; this._selections = selections; - this._options = new ExtHostTextEditorOptions(this._proxy, this._id, options); + this._options = new ExtHostTextEditorOptions(this._proxy, this.id, options, _logService); this._visibleRanges = visibleRanges; this._viewColumn = viewColumn; this._hasDecorationsForKey = Object.create(null); @@ -397,11 +401,11 @@ export class ExtHostTextEditor implements vscode.TextEditor { } show(column: vscode.ViewColumn) { - this._proxy.$tryShowEditor(this._id, TypeConverters.ViewColumn.from(column)); + this._proxy.$tryShowEditor(this.id, TypeConverters.ViewColumn.from(column)); } hide() { - this._proxy.$tryHideEditor(this._id); + this._proxy.$tryHideEditor(this.id); } // ---- the document @@ -502,7 +506,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { () => { if (TypeConverters.isDecorationOptionsArr(ranges)) { return this._proxy.$trySetDecorations( - this._id, + this.id, decorationType.key, TypeConverters.fromRangeOrRangeWithMessage(ranges) ); @@ -516,7 +520,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { _ranges[4 * i + 3] = range.end.character + 1; } return this._proxy.$trySetDecorationsFast( - this._id, + this.id, decorationType.key, _ranges ); @@ -528,7 +532,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { revealRange(range: Range, revealType: vscode.TextEditorRevealType): void { this._runOnProxy( () => this._proxy.$tryRevealRange( - this._id, + this.id, TypeConverters.Range.from(range), (revealType || TextEditorRevealType.Default) ) @@ -537,7 +541,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { private _trySetSelection(): Promise { const selection = this._selections.map(TypeConverters.Selection.from); - return this._runOnProxy(() => this._proxy.$trySetSelections(this._id, selection)); + return this._runOnProxy(() => this._proxy.$trySetSelections(this.id, selection)); } _acceptSelections(selections: Selection[]): void { @@ -603,7 +607,7 @@ export class ExtHostTextEditor implements vscode.TextEditor { }; }); - return this._proxy.$tryApplyEdits(this._id, editData.documentVersionId, edits, { + return this._proxy.$tryApplyEdits(this.id, editData.documentVersionId, edits, { setEndOfLine: typeof editData.setEndOfLine === 'number' ? TypeConverters.EndOfLine.from(editData.setEndOfLine) : undefined, undoStopBefore: editData.undoStopBefore, undoStopAfter: editData.undoStopAfter @@ -637,27 +641,22 @@ export class ExtHostTextEditor implements vscode.TextEditor { } } - return this._proxy.$tryInsertSnippet(this._id, snippet.value, ranges, options); + return this._proxy.$tryInsertSnippet(this.id, snippet.value, ranges, options); } // ---- util private _runOnProxy(callback: () => Promise): Promise { if (this._disposed) { - console.warn('TextEditor is closed/disposed'); + this._logService.warn('TextEditor is closed/disposed'); return Promise.resolve(undefined); } return callback().then(() => this, err => { if (!(err instanceof Error && err.name === 'DISPOSED')) { - console.warn(err); + this._logService.warn(err); } return null; }); } } -function warnOnError(promise: Promise): void { - promise.then(undefined, (err) => { - console.warn(err); - }); -} diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index f10a77afa63..bc9ca5a94a3 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -93,7 +93,7 @@ suite('ExtHostLanguageFeatureCommands', function () { inst = instantiationService; } - const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol); + const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol, new NullLogService()); extHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({ addedDocuments: [{ isDirty: false, diff --git a/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts index 313272d338f..a219765f48b 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts @@ -37,7 +37,7 @@ suite('ExtHostDocumentSaveParticipant', () => { }; setup(() => { - const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null)); + const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null), new NullLogService()); documentsAndEditors.$acceptDocumentsAndEditorsDelta({ addedDocuments: [{ isDirty: false, diff --git a/src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts index ce9209f9344..6cd64c2c976 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts @@ -7,13 +7,14 @@ import * as assert from 'assert'; import { URI } from 'vs/base/common/uri'; import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors'; import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol'; +import { NullLogService } from 'vs/platform/log/common/log'; suite('ExtHostDocumentsAndEditors', () => { let editors: ExtHostDocumentsAndEditors; setup(function () { - editors = new ExtHostDocumentsAndEditors(new TestRPCProtocol()); + editors = new ExtHostDocumentsAndEditors(new TestRPCProtocol(), new NullLogService()); }); test('The value of TextDocument.isClosed is incorrect when a text document is closed, #27949', () => { diff --git a/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts b/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts index 658fecab325..9bb319fe7b7 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts @@ -84,7 +84,7 @@ suite('ExtHostLanguageFeatures', function () { originalErrorHandler = errorHandler.getUnexpectedErrorHandler(); setUnexpectedErrorHandler(() => { }); - const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol); + const extHostDocumentsAndEditors = new ExtHostDocumentsAndEditors(rpcProtocol, new NullLogService()); extHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({ addedDocuments: [{ isDirty: false, diff --git a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts index d4d311a3aa2..b783bf6984f 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts @@ -10,6 +10,7 @@ import { ExtHostTextEditorOptions, ExtHostTextEditor } from 'vs/workbench/api/co import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData'; import { URI } from 'vs/base/common/uri'; import { mock } from 'vs/workbench/test/electron-browser/api/mock'; +import { NullLogService } from 'vs/platform/log/common/log'; suite('ExtHostTextEditor', () => { @@ -19,7 +20,7 @@ suite('ExtHostTextEditor', () => { ], '\n', 'text', 1, false); setup(() => { - editor = new ExtHostTextEditor(null!, 'fake', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1); + editor = new ExtHostTextEditor('fake', null!, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1); }); test('disposed editor', () => { @@ -40,12 +41,13 @@ suite('ExtHostTextEditor', () => { test('API [bug]: registerTextEditorCommand clears redo stack even if no edits are made #55163', async function () { let applyCount = 0; - let editor = new ExtHostTextEditor(new class extends mock() { - $tryApplyEdits(): Promise { - applyCount += 1; - return Promise.resolve(true); - } - }, 'edt1', doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1); + let editor = new ExtHostTextEditor('edt1', + new class extends mock() { + $tryApplyEdits(): Promise { + applyCount += 1; + return Promise.resolve(true); + } + }, new NullLogService(), doc, [], { cursorStyle: 0, insertSpaces: true, lineNumbers: 1, tabSize: 4, indentSize: 4 }, [], 1); await editor.edit(edit => { }); assert.equal(applyCount, 0); @@ -92,7 +94,7 @@ suite('ExtHostTextEditorOptions', () => { insertSpaces: false, cursorStyle: TextEditorCursorStyle.Line, lineNumbers: RenderLineNumbersType.On - }); + }, new NullLogService()); }); teardown(() => { diff --git a/src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts index a66b5b43b9f..771900aaeca 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts @@ -11,6 +11,7 @@ import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocum import { SingleProxyRPCProtocol, TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol'; import { ExtHostEditors } from 'vs/workbench/api/common/extHostTextEditors'; import { ResourceTextEdit } from 'vs/editor/common/modes'; +import { NullLogService } from 'vs/platform/log/common/log'; suite('ExtHostTextEditors.applyWorkspaceEdit', () => { @@ -28,7 +29,7 @@ suite('ExtHostTextEditors.applyWorkspaceEdit', () => { return Promise.resolve(true); } }); - const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null)); + const documentsAndEditors = new ExtHostDocumentsAndEditors(SingleProxyRPCProtocol(null), new NullLogService()); documentsAndEditors.$acceptDocumentsAndEditorsDelta({ addedDocuments: [{ isDirty: false, From a68fd36b256d1d15989309971b771d575be4c436 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 9 Dec 2019 16:25:50 +0100 Subject: [PATCH 237/637] custom editors - adopt SaveContext --- .../contrib/customEditor/browser/customEditorInput.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index ab6ddeb66df..316fffe4b4f 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -15,7 +15,7 @@ import { IEditorModel, ITextEditorOptions } from 'vs/platform/editor/common/edit import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILabelService } from 'vs/platform/label/common/label'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; -import { GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, Verbosity } from 'vs/workbench/common/editor'; +import { GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, Verbosity, SaveContext } from 'vs/workbench/common/editor'; import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { WebviewEditorOverlay } from 'vs/workbench/contrib/webview/browser/webview'; @@ -128,9 +128,11 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { return false; } - const replacement = this.handleMove(groupId, target) || this.instantiationService.createInstance(FileEditorInput, target, undefined, undefined); + if (options?.context !== SaveContext.EDITOR_CLOSE) { + const replacement = this.handleMove(groupId, target) || this.instantiationService.createInstance(FileEditorInput, target, undefined, undefined); + await this.editorService.replaceEditors([{ editor: this, replacement, options: { pinned: true } }], groupId); + } - await this.editorService.replaceEditors([{ editor: this, replacement, options: { pinned: true } }], groupId); return true; } From 256f2e0965758b9b3b14e78ed6485339ae0c5dec Mon Sep 17 00:00:00 2001 From: Marvin Heilemann Date: Mon, 9 Dec 2019 16:41:29 +0100 Subject: [PATCH 238/637] First working version of native auto switching workspace theme This implements three new options to the workspace scope. One to enable/ disable the auto switch functionality and two others to set the dark and light theme. --- .../themes/browser/workbenchThemeService.ts | 402 ++++++++++++++---- .../themes/common/workbenchThemeService.ts | 36 +- 2 files changed, 345 insertions(+), 93 deletions(-) diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index c0172a4cdd8..b567c70281f 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -6,13 +6,41 @@ import * as nls from 'vs/nls'; import * as types from 'vs/base/common/types'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { IWorkbenchThemeService, IColorTheme, ITokenColorCustomizations, IFileIconTheme, ExtensionData, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME, COLOR_THEME_SETTING, ICON_THEME_SETTING, CUSTOM_WORKBENCH_COLORS_SETTING, CUSTOM_EDITOR_COLORS_SETTING, DETECT_HC_SETTING, HC_THEME_ID, IColorCustomizations, CUSTOM_EDITOR_TOKENSTYLES_SETTING, IExperimentalTokenStyleCustomizations } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { + IWorkbenchThemeService, + IColorTheme, + ITokenColorCustomizations, + IFileIconTheme, + ExtensionData, + VS_LIGHT_THEME, + VS_DARK_THEME, + VS_HC_THEME, + COLOR_THEME_SETTING, + ICON_THEME_SETTING, + CUSTOM_WORKBENCH_COLORS_SETTING, + CUSTOM_EDITOR_COLORS_SETTING, + DETECT_HC_SETTING, + HC_THEME_ID, + IColorCustomizations, + CUSTOM_EDITOR_TOKENSTYLES_SETTING, + IExperimentalTokenStyleCustomizations, + COLOR_THEME_DARK_SETTING, + COLOR_THEME_LIGHT_SETTING, + DETECT_AS_SETTING, + ColorScheme, + WINDOW_MATCH_PREFERS_COLOR_SCHEME +} from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Registry } from 'vs/platform/registry/common/platform'; import * as errors from 'vs/base/common/errors'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; -import { IConfigurationRegistry, Extensions as ConfigurationExtensions, IConfigurationPropertySchema, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry'; +import { + IConfigurationRegistry, + Extensions as ConfigurationExtensions, + IConfigurationPropertySchema, + IConfigurationNode +} from 'vs/platform/configuration/common/configurationRegistry'; import { ColorThemeData } from 'vs/workbench/services/themes/common/colorThemeData'; import { ITheme, Extensions as ThemingExtensions, IThemingRegistry } from 'vs/platform/theme/common/themeService'; import { Event, Emitter } from 'vs/base/common/event'; @@ -27,7 +55,11 @@ import { IFileService, FileChangeType } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import * as resources from 'vs/base/common/resources'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; -import { textmateColorsSchemaId, registerColorThemeSchemas, textmateColorSettingsSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; +import { + textmateColorsSchemaId, + registerColorThemeSchemas, + textmateColorSettingsSchemaId +} from 'vs/workbench/services/themes/common/colorThemeSchema'; import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'; import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; @@ -39,6 +71,9 @@ import { IExtensionResourceLoaderService } from 'vs/workbench/services/extension const DEFAULT_THEME_ID = 'vs-dark vscode-theme-defaults-themes-dark_plus-json'; const DEFAULT_THEME_SETTING_VALUE = 'Default Dark+'; +const DEFAULT_THEME_DARK_SETTING_VALUE = 'Default Dark+'; +const DEFAULT_THEME_LIGHT_SETTING_VALUE = 'Default Light+'; +const DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE = true; const PERSISTED_THEME_STORAGE_KEY = 'colorThemeData'; const PERSISTED_ICON_THEME_STORAGE_KEY = 'iconThemeData'; @@ -58,11 +93,16 @@ const themingRegistry = Registry.as(ThemingExtensions.ThemingC function validateThemeId(theme: string): string { // migrations switch (theme) { - case VS_LIGHT_THEME: return `vs ${defaultThemeExtensionId}-themes-light_vs-json`; - case VS_DARK_THEME: return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`; - case VS_HC_THEME: return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`; - case `vs ${oldDefaultThemeExtensionId}-themes-light_plus-tmTheme`: return `vs ${defaultThemeExtensionId}-themes-light_plus-json`; - case `vs-dark ${oldDefaultThemeExtensionId}-themes-dark_plus-tmTheme`: return `vs-dark ${defaultThemeExtensionId}-themes-dark_plus-json`; + case VS_LIGHT_THEME: + return `vs ${defaultThemeExtensionId}-themes-light_vs-json`; + case VS_DARK_THEME: + return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`; + case VS_HC_THEME: + return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`; + case `vs ${oldDefaultThemeExtensionId}-themes-light_plus-tmTheme`: + return `vs ${defaultThemeExtensionId}-themes-light_plus-json`; + case `vs-dark ${oldDefaultThemeExtensionId}-themes-dark_plus-tmTheme`: + return `vs-dark ${defaultThemeExtensionId}-themes-dark_plus-json`; } return theme; } @@ -71,6 +111,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { _serviceBrand: undefined; private colorThemeStore: ColorThemeStore; + private autoSwitchColorTheme = DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE; + private autoSwitchColorThemeListener: MediaQueryList | undefined = undefined; private currentColorTheme: ColorThemeData; private container: HTMLElement; private readonly onColorThemeChange: Emitter; @@ -94,7 +136,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } private get tokenStylesCustomizations(): IExperimentalTokenStyleCustomizations { - return this.configurationService.getValue(CUSTOM_EDITOR_TOKENSTYLES_SETTING) || {}; + return ( + this.configurationService.getValue(CUSTOM_EDITOR_TOKENSTYLES_SETTING) || {} + ); } constructor( @@ -107,13 +151,13 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { @IExtensionResourceLoaderService private readonly extensionResourceLoaderService: IExtensionResourceLoaderService, @IWorkbenchLayoutService readonly layoutService: IWorkbenchLayoutService ) { - this.container = layoutService.getWorkbenchContainer(); this.colorThemeStore = new ColorThemeStore(extensionService); this.onFileIconThemeChange = new Emitter(); this.iconThemeStore = new FileIconThemeStore(extensionService); this.onColorThemeChange = new Emitter({ leakWarningThreshold: 400 }); + this.onPreferColorSchemeChange = this.onPreferColorSchemeChange.bind(this); this.currentColorTheme = ColorThemeData.createUnloadedTheme(''); this.currentIconTheme = FileIconThemeData.createUnloadedTheme(''); @@ -146,9 +190,12 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } } - this.initialize().then(undefined, errors.onUnexpectedError).then(_ => { - this.installConfigurationListener(); - }); + this.initialize() + .then(undefined, errors.onUnexpectedError) + .then(_ => { + this.installConfigurationListener(); + this.installColorThemeSwitch(); + }); let prevColorId: string | undefined = undefined; @@ -177,7 +224,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { tokenColorCustomizationSchema.allOf![1] = themeSpecificTokenColors; experimentalTokenStylingCustomizationSchema.allOf![1] = themeSpecificTokenStyling; - configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration, tokenColorCustomizationConfiguration); + configurationRegistry.notifyConfigurationSchemaUpdated( + themeSettingsConfiguration, + tokenColorCustomizationConfiguration + ); if (this.currentColorTheme.isLoaded) { const themeData = await this.colorThemeStore.findThemeData(this.currentColorTheme.id); @@ -186,7 +236,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { prevColorId = this.currentColorTheme.id; this.setColorTheme(DEFAULT_THEME_ID, 'auto'); } else { - if (this.currentColorTheme.id === DEFAULT_THEME_ID && !types.isUndefined(prevColorId) && await this.colorThemeStore.findThemeData(prevColorId)) { + if ( + this.currentColorTheme.id === DEFAULT_THEME_ID && + !types.isUndefined(prevColorId) && + (await this.colorThemeStore.findThemeData(prevColorId)) + ) { // restore color this.setColorTheme(prevColorId, 'auto'); prevColorId = undefined; @@ -200,7 +254,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { let prevFileIconId: string | undefined = undefined; this.iconThemeStore.onDidChange(async event => { iconThemeSettingSchema.enum = [null, ...event.themes.map(t => t.settingsId)]; - iconThemeSettingSchema.enumDescriptions = [iconThemeSettingSchema.enumDescriptions![0], ...event.themes.map(t => t.description || '')]; + iconThemeSettingSchema.enumDescriptions = [ + iconThemeSettingSchema.enumDescriptions![0], + ...event.themes.map(t => t.description || '') + ]; configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration); if (this.currentIconTheme.isLoaded) { @@ -211,7 +268,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.setFileIconTheme(DEFAULT_ICON_THEME_ID, 'auto'); } else { // restore color - if (this.currentIconTheme.id === DEFAULT_ICON_THEME_ID && !types.isUndefined(prevFileIconId) && await this.iconThemeStore.findThemeData(prevFileIconId)) { + if ( + this.currentIconTheme.id === DEFAULT_ICON_THEME_ID && + !types.isUndefined(prevFileIconId) && + (await this.iconThemeStore.findThemeData(prevFileIconId)) + ) { this.setFileIconTheme(prevFileIconId, 'auto'); prevFileIconId = undefined; } else { @@ -222,10 +283,18 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { }); this.fileService.onFileChanges(async e => { - if (this.watchedColorThemeLocation && this.currentColorTheme && e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED)) { + if ( + this.watchedColorThemeLocation && + this.currentColorTheme && + e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED) + ) { this.reloadCurrentColorTheme(); } - if (this.watchedIconThemeLocation && this.currentIconTheme && e.contains(this.watchedIconThemeLocation, FileChangeType.UPDATED)) { + if ( + this.watchedIconThemeLocation && + this.currentIconTheme && + e.contains(this.watchedIconThemeLocation, FileChangeType.UPDATED) + ) { this.reloadCurrentFileIconTheme(); } }); @@ -248,16 +317,19 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } private initialize(): Promise<[IColorTheme | null, IFileIconTheme | null]> { - let detectHCThemeSetting = this.configurationService.getValue(DETECT_HC_SETTING); + let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); + let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); - let colorThemeSetting: string; - if (this.environmentService.configuration.highContrast && detectHCThemeSetting) { - colorThemeSetting = HC_THEME_ID; - } else { - colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); + let detectThemeAutoSwitch = this.configurationService.getValue(DETECT_AS_SETTING); + this.autoSwitchColorTheme = detectThemeAutoSwitch; + if (detectThemeAutoSwitch) { + colorThemeSetting = this.getPreferredTheme(); } - let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); + let detectHCThemeSetting = this.configurationService.getValue(DETECT_HC_SETTING); + if (this.environmentService.configuration.highContrast && detectHCThemeSetting) { + colorThemeSetting = HC_THEME_ID; + } const extDevLocs = this.environmentService.extensionDevelopmentLocationURI; let uri: URI | undefined; @@ -267,7 +339,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } return Promise.all([ - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { + this.getColorThemeData(colorThemeSetting).then(theme => { return this.colorThemeStore.findThemeDataByParentLocation(uri).then(devThemes => { if (devThemes.length) { return this.setColorTheme(devThemes[0].id, ConfigurationTarget.MEMORY); @@ -284,20 +356,76 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.setFileIconTheme(theme ? theme.id : DEFAULT_ICON_THEME_ID, undefined); } }); - }), + }) ]); } + private installColorThemeSwitch() { + console.log('INSTALL'); + this.autoSwitchColorThemeListener = window.matchMedia(WINDOW_MATCH_PREFERS_COLOR_SCHEME); + this.autoSwitchColorThemeListener.addListener(this.onPreferColorSchemeChange); + console.log('INSTALLED'); + } + + private deinstallColorThemeSwitch() { + console.log('DEINSTALL'); + if (this.autoSwitchColorThemeListener) { + this.autoSwitchColorThemeListener.removeListener(this.onPreferColorSchemeChange); + this.configurationService.updateValue(DETECT_AS_SETTING, false); + console.log('DEINSTALLED'); + } + } + + private onPreferColorSchemeChange({ matches }: MediaQueryListEvent) { + console.log('onPreferColorSchemeChange', matches); + let themeName = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); + if (matches) { + // prefers dark mode + themeName = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); + } + this.setTheme(themeName); + } + + private getPreferredTheme(): string { + let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); + const darkMode = this.getPreferredColorScheme() === ColorScheme.DARK; + if (darkMode) { + colorThemeSetting = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); + } + return colorThemeSetting; + } + + private setTheme(themeName: string) { + this.getColorThemeData(themeName).then(theme => { + if (theme) { + this.setColorTheme(theme.id, undefined); + this.configurationService.updateValue(COLOR_THEME_SETTING, themeName); + } + }); + } + private installConfigurationListener() { this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(COLOR_THEME_SETTING)) { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { - if (theme) { - this.setColorTheme(theme.id, undefined); - } - }); + this.setTheme(colorThemeSetting); + this.deinstallColorThemeSwitch(); + } + } + if (e.affectsConfiguration(DETECT_AS_SETTING)) { + let autoSwitchColorTheme = this.configurationService.getValue(DETECT_AS_SETTING); + console.log(autoSwitchColorTheme); + if (this.autoSwitchColorTheme !== autoSwitchColorTheme) { + this.autoSwitchColorTheme = autoSwitchColorTheme; + console.log('HAS CHANGED'); + if (autoSwitchColorTheme) { + this.installColorThemeSwitch(); + let themeName = this.getPreferredTheme(); + this.setTheme(themeName); + } else { + this.deinstallColorThemeSwitch(); + } } } if (e.affectsConfiguration(ICON_THEME_SETTING)) { @@ -338,11 +466,33 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.colorThemeStore.getColorThemes(); } + public getColorThemeData(colorThemeSetting: string): Promise { + return new Promise(resolve => { + this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { + resolve(theme); + }); + }); + } + + public getPreferredColorScheme(): ColorScheme { + const noPreference = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.NO_PREFERENCE})`).matches; + const prefersDark = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.DARK})`).matches; + if (noPreference) { + return ColorScheme.NO_PREFERENCE; + } else if (prefersDark) { + return ColorScheme.DARK; + } + return ColorScheme.LIGHT; + } + public getTheme(): ITheme { return this.getColorTheme(); } - public setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { + public setColorTheme( + themeId: string | undefined, + settingsTarget: ConfigurationTarget | undefined | 'auto' + ): Promise { if (!themeId) { return Promise.resolve(null); } @@ -357,24 +507,40 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return null; } const themeData = data; - return themeData.ensureLoaded(this.extensionResourceLoaderService).then(_ => { - if (themeId === this.currentColorTheme.id && !this.currentColorTheme.isLoaded && this.currentColorTheme.hasEqualData(themeData)) { - this.currentColorTheme.clearCaches(); - // the loaded theme is identical to the perisisted theme. Don't need to send an event. - this.currentColorTheme = themeData; + return themeData.ensureLoaded(this.extensionResourceLoaderService).then( + _ => { + if ( + themeId === this.currentColorTheme.id && + !this.currentColorTheme.isLoaded && + this.currentColorTheme.hasEqualData(themeData) + ) { + this.currentColorTheme.clearCaches(); + // the loaded theme is identical to the perisisted theme. Don't need to send an event. + this.currentColorTheme = themeData; + themeData.setCustomColors(this.colorCustomizations); + themeData.setCustomTokenColors(this.tokenColorCustomizations); + themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); + return Promise.resolve(themeData); + } themeData.setCustomColors(this.colorCustomizations); themeData.setCustomTokenColors(this.tokenColorCustomizations); themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); - return Promise.resolve(themeData); + this.updateDynamicCSSRules(themeData); + return this.applyTheme(themeData, settingsTarget); + }, + error => { + return Promise.reject( + new Error( + nls.localize( + 'error.cannotloadtheme', + 'Unable to load {0}: {1}', + themeData.location!.toString(), + error.message + ) + ) + ); } - themeData.setCustomColors(this.colorCustomizations); - themeData.setCustomTokenColors(this.tokenColorCustomizations); - themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); - this.updateDynamicCSSRules(themeData); - return this.applyTheme(themeData, settingsTarget); - }, error => { - return Promise.reject(new Error(nls.localize('error.cannotloadtheme', "Unable to load {0}: {1}", themeData.location!.toString(), error.message))); - }); + ); }); } @@ -390,11 +556,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { public restoreColorTheme() { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { - if (theme) { - this.setColorTheme(theme.id, undefined); - } - }); + this.setTheme(colorThemeSetting); } } @@ -411,7 +573,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { _applyRules([...cssRules].join('\n'), colorThemeRulesClassName); } - private applyTheme(newTheme: ColorThemeData, settingsTarget: ConfigurationTarget | undefined | 'auto', silent = false): Promise { + private applyTheme( + newTheme: ColorThemeData, + settingsTarget: ConfigurationTarget | undefined | 'auto', + silent = false + ): Promise { if (this.currentColorTheme.id) { removeClasses(this.container, this.currentColorTheme.id); } else { @@ -422,7 +588,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.currentColorTheme.clearCaches(); this.currentColorTheme = newTheme; if (!this.themingParticipantChangeListener) { - this.themingParticipantChangeListener = themingRegistry.onThemingParticipantAdded(_ => this.updateDynamicCSSRules(this.currentColorTheme)); + this.themingParticipantChangeListener = themingRegistry.onThemingParticipantAdded(_ => + this.updateDynamicCSSRules(this.currentColorTheme) + ); } if (this.fileService && !resources.isEqual(newTheme.location, this.watchedColorThemeLocation)) { @@ -453,7 +621,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { private writeColorThemeConfiguration(settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { if (!types.isUndefinedOrNull(settingsTarget)) { - return this.writeConfiguration(COLOR_THEME_SETTING, this.currentColorTheme.settingsId, settingsTarget).then(_ => this.currentColorTheme); + return this.writeConfiguration(COLOR_THEME_SETTING, this.currentColorTheme.settingsId, settingsTarget).then( + _ => this.currentColorTheme + ); } return Promise.resolve(this.currentColorTheme); } @@ -464,11 +634,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { let key = themeType + themeData.extensionId; if (!this.themeExtensionsActivated.get(key)) { type ActivatePluginClassification = { - id: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; - name: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; - isBuiltin: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; - publisherDisplayName: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; - themeId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; + id: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; + name: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; + isBuiltin: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true }; + publisherDisplayName: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' }; + themeId: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; }; type ActivatePluginEvent = { id: string; @@ -501,7 +671,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.currentIconTheme; } - public setFileIconTheme(iconTheme: string | undefined, settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { + public setFileIconTheme( + iconTheme: string | undefined, + settingsTarget: ConfigurationTarget | undefined | 'auto' + ): Promise { iconTheme = iconTheme || ''; if (iconTheme === this.currentIconTheme.id && this.currentIconTheme.isLoaded) { return this.writeFileIconConfiguration(settingsTarget); @@ -557,7 +730,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { dispose(this.watchedIconThemeDisposable); this.watchedIconThemeLocation = undefined; - if (iconThemeData.location && (iconThemeData.watch || !!this.environmentService.extensionDevelopmentLocationURI)) { + if ( + iconThemeData.location && + (iconThemeData.watch || !!this.environmentService.extensionDevelopmentLocationURI) + ) { this.watchedIconThemeLocation = iconThemeData.location; this.watchedIconThemeDisposable = this.fileService.watch(iconThemeData.location); } @@ -567,12 +743,15 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.sendTelemetry(iconThemeData.id, iconThemeData.extensionData, 'fileIcon'); } this.onFileIconThemeChange.fire(this.currentIconTheme); - } - private writeFileIconConfiguration(settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { + private writeFileIconConfiguration( + settingsTarget: ConfigurationTarget | undefined | 'auto' + ): Promise { if (!types.isUndefinedOrNull(settingsTarget)) { - return this.writeConfiguration(ICON_THEME_SETTING, this.currentIconTheme.settingsId, settingsTarget).then(_ => this.currentIconTheme); + return this.writeConfiguration(ICON_THEME_SETTING, this.currentIconTheme.settingsId, settingsTarget).then( + _ => this.currentIconTheme + ); } return Promise.resolve(this.currentIconTheme); } @@ -598,7 +777,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } value = undefined; // remove configuration from user settings } - } else if (settingsTarget === ConfigurationTarget.WORKSPACE || settingsTarget === ConfigurationTarget.WORKSPACE_FOLDER) { + } else if ( + settingsTarget === ConfigurationTarget.WORKSPACE || + settingsTarget === ConfigurationTarget.WORKSPACE_FOLDER + ) { if (value === settings.value) { return Promise.resolve(undefined); // nothing to do } @@ -617,7 +799,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } } -function _applyIconTheme(data: FileIconThemeData, onApply: (theme: FileIconThemeData) => Promise): Promise { +function _applyIconTheme( + data: FileIconThemeData, + onApply: (theme: FileIconThemeData) => Promise +): Promise { _applyRules(data.styleSheetContent!, iconThemeRulesClassName); return onApply(data); } @@ -643,30 +828,49 @@ const configurationRegistry = Registry.as(ConfigurationE const colorThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', - description: nls.localize('colorTheme', "Specifies the color theme used in the workbench."), + description: nls.localize('colorTheme', 'Specifies the color theme used in the workbench.'), default: DEFAULT_THEME_SETTING_VALUE, - enum: [], - enumDescriptions: [], - errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."), + errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') +}; +const colorThemeDarkSettingSchema: IConfigurationPropertySchema = { + type: 'string', + description: nls.localize('colorThemeDark', 'Specifies the color theme used for a dark OS appearance.'), + default: DEFAULT_THEME_DARK_SETTING_VALUE, + errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') +}; +const colorThemeLightSettingSchema: IConfigurationPropertySchema = { + type: 'string', + description: nls.localize('colorThemeLight', 'Specifies the color theme used for a light OS appearance.'), + default: DEFAULT_THEME_LIGHT_SETTING_VALUE, + errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') +}; +const colorThemeAutoSwitchSettingSchema: IConfigurationPropertySchema = { + type: 'boolean', + description: nls.localize('colorThemeAutoSwitch', 'Changes the color theme based on the OS appearance.'), + default: DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE }; const iconThemeSettingSchema: IConfigurationPropertySchema = { type: ['string', 'null'], default: DEFAULT_ICON_THEME_SETTING_VALUE, - description: nls.localize('iconTheme', "Specifies the icon theme used in the workbench or 'null' to not show any file icons."), + description: nls.localize( + 'iconTheme', + "Specifies the icon theme used in the workbench or 'null' to not show any file icons." + ), enum: [null], enumDescriptions: [nls.localize('noIconThemeDesc', 'No file icons')], - errorMessage: nls.localize('iconThemeError', "File icon theme is unknown or not installed.") + errorMessage: nls.localize('iconThemeError', 'File icon theme is unknown or not installed.') }; const colorCustomizationsSchema: IConfigurationPropertySchema = { type: 'object', - description: nls.localize('workbenchColors', "Overrides colors from the currently selected color theme."), + description: nls.localize('workbenchColors', 'Overrides colors from the currently selected color theme.'), allOf: [{ $ref: workbenchColorsSchemaId }], default: {}, - defaultSnippets: [{ - body: { + defaultSnippets: [ + { + body: {} } - }] + ] }; const themeSettingsConfiguration: IConfigurationNode = { @@ -675,6 +879,9 @@ const themeSettingsConfiguration: IConfigurationNode = { type: 'object', properties: { [COLOR_THEME_SETTING]: colorThemeSettingSchema, + [COLOR_THEME_DARK_SETTING]: colorThemeDarkSettingSchema, + [COLOR_THEME_LIGHT_SETTING]: colorThemeLightSettingSchema, + [DETECT_AS_SETTING]: colorThemeAutoSwitchSettingSchema, [ICON_THEME_SETTING]: iconThemeSettingSchema, [CUSTOM_WORKBENCH_COLORS_SETTING]: colorCustomizationsSchema } @@ -699,26 +906,45 @@ function tokenGroupSettings(description: string): IJSONSchema { const tokenColorSchema: IJSONSchema = { properties: { - comments: tokenGroupSettings(nls.localize('editorColors.comments', "Sets the colors and styles for comments")), - strings: tokenGroupSettings(nls.localize('editorColors.strings', "Sets the colors and styles for strings literals.")), - keywords: tokenGroupSettings(nls.localize('editorColors.keywords', "Sets the colors and styles for keywords.")), - numbers: tokenGroupSettings(nls.localize('editorColors.numbers', "Sets the colors and styles for number literals.")), - types: tokenGroupSettings(nls.localize('editorColors.types', "Sets the colors and styles for type declarations and references.")), - functions: tokenGroupSettings(nls.localize('editorColors.functions', "Sets the colors and styles for functions declarations and references.")), - variables: tokenGroupSettings(nls.localize('editorColors.variables', "Sets the colors and styles for variables declarations and references.")), + comments: tokenGroupSettings(nls.localize('editorColors.comments', 'Sets the colors and styles for comments')), + strings: tokenGroupSettings( + nls.localize('editorColors.strings', 'Sets the colors and styles for strings literals.') + ), + keywords: tokenGroupSettings(nls.localize('editorColors.keywords', 'Sets the colors and styles for keywords.')), + numbers: tokenGroupSettings( + nls.localize('editorColors.numbers', 'Sets the colors and styles for number literals.') + ), + types: tokenGroupSettings( + nls.localize('editorColors.types', 'Sets the colors and styles for type declarations and references.') + ), + functions: tokenGroupSettings( + nls.localize('editorColors.functions', 'Sets the colors and styles for functions declarations and references.') + ), + variables: tokenGroupSettings( + nls.localize('editorColors.variables', 'Sets the colors and styles for variables declarations and references.') + ), textMateRules: { - description: nls.localize('editorColors.textMateRules', 'Sets colors and styles using textmate theming rules (advanced).'), + description: nls.localize( + 'editorColors.textMateRules', + 'Sets colors and styles using textmate theming rules (advanced).' + ), $ref: textmateColorsSchemaId } } }; const tokenColorCustomizationSchema: IConfigurationPropertySchema = { - description: nls.localize('editorColors', "Overrides editor colors and font style from the currently selected color theme."), + description: nls.localize( + 'editorColors', + 'Overrides editor colors and font style from the currently selected color theme.' + ), default: {}, allOf: [tokenColorSchema] }; const experimentalTokenStylingCustomizationSchema: IConfigurationPropertySchema = { - description: nls.localize('editorColorsTokenStyles', "Overrides token color and styles from the currently selected color theme."), + description: nls.localize( + 'editorColorsTokenStyles', + 'Overrides token color and styles from the currently selected color theme.' + ), default: {}, allOf: [{ $ref: tokenStylingSchemaId }] }; diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index 9937ca11be9..6577eb4a1d9 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -18,12 +18,22 @@ export const VS_HC_THEME = 'hc-black'; export const HC_THEME_ID = 'Default High Contrast'; export const COLOR_THEME_SETTING = 'workbench.colorTheme'; +export const COLOR_THEME_DARK_SETTING = 'workbench.colorThemeDark'; +export const COLOR_THEME_LIGHT_SETTING = 'workbench.colorThemeLight'; +export const DETECT_AS_SETTING = 'workbench.colorThemeAutoSwitch'; +export const WINDOW_MATCH_PREFERS_COLOR_SCHEME = '(prefers-color-scheme: dark)'; export const DETECT_HC_SETTING = 'window.autoDetectHighContrast'; export const ICON_THEME_SETTING = 'workbench.iconTheme'; export const CUSTOM_WORKBENCH_COLORS_SETTING = 'workbench.colorCustomizations'; export const CUSTOM_EDITOR_COLORS_SETTING = 'editor.tokenColorCustomizations'; export const CUSTOM_EDITOR_TOKENSTYLES_SETTING = 'editor.tokenColorCustomizationsExperimental'; +export enum ColorScheme { + LIGHT = 'light', + DARK = 'dark', + NO_PREFERENCE = 'no-preference' +} + export interface IColorTheme extends ITheme { readonly id: string; readonly label: string; @@ -53,13 +63,20 @@ export interface IFileIconTheme extends IIconTheme { export interface IWorkbenchThemeService extends IThemeService { _serviceBrand: undefined; - setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; + setColorTheme( + themeId: string | undefined, + settingsTarget: ConfigurationTarget | undefined + ): Promise; getColorTheme(): IColorTheme; getColorThemes(): Promise; + getColorThemeData(colorThemeSetting: string): Promise; onDidColorThemeChange: Event; restoreColorTheme(): void; - setFileIconTheme(iconThemeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; + setFileIconTheme( + iconThemeId: string | undefined, + settingsTarget: ConfigurationTarget | undefined + ): Promise; getFileIconTheme(): IFileIconTheme; getFileIconThemes(): Promise; onDidFileIconThemeChange: Event; @@ -70,7 +87,12 @@ export interface IColorCustomizations { } export interface ITokenColorCustomizations { - [groupIdOrThemeSettingsId: string]: string | ITokenColorizationSetting | ITokenColorCustomizations | undefined | ITextMateThemingRule[]; + [groupIdOrThemeSettingsId: string]: + | string + | ITokenColorizationSetting + | ITokenColorCustomizations + | undefined + | ITextMateThemingRule[]; comments?: string | ITokenColorizationSetting; strings?: string | ITokenColorizationSetting; numbers?: string | ITokenColorizationSetting; @@ -82,7 +104,11 @@ export interface ITokenColorCustomizations { } export interface IExperimentalTokenStyleCustomizations { - [styleRuleOrThemeSettingsId: string]: string | ITokenColorizationSetting | IExperimentalTokenStyleCustomizations | undefined; + [styleRuleOrThemeSettingsId: string]: + | string + | ITokenColorizationSetting + | IExperimentalTokenStyleCustomizations + | undefined; } export interface ITextMateThemingRule { @@ -94,7 +120,7 @@ export interface ITextMateThemingRule { export interface ITokenColorizationSetting { foreground?: string; background?: string; - fontStyle?: string; /* [italic|underline|bold] */ + fontStyle?: string /* [italic|underline|bold] */; } export interface ExtensionData { From b4d5546ed5939e0d21733af1704bc2fb1be5880d Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 9 Dec 2019 16:42:27 +0100 Subject: [PATCH 239/637] debug: fix contexts --- .../contrib/debug/browser/callStackView.ts | 16 ++++++------- .../contrib/debug/browser/debugCommands.ts | 24 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index 6f0843b73db..b9c33fb09fa 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -818,7 +818,7 @@ class StopAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(STOP_ID, getContext(this.session)); + return this.commandService.executeCommand(STOP_ID, undefined, getContext(this.session)); } } @@ -832,7 +832,7 @@ class DisconnectAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(DISCONNECT_ID, getContext(this.session)); + return this.commandService.executeCommand(DISCONNECT_ID, undefined, getContext(this.session)); } } @@ -846,7 +846,7 @@ class RestartAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(RESTART_SESSION_ID, getContext(this.session)); + return this.commandService.executeCommand(RESTART_SESSION_ID, undefined, getContext(this.session)); } } @@ -860,7 +860,7 @@ class StepOverAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(STEP_OVER_ID, getContext(this.thread)); + return this.commandService.executeCommand(STEP_OVER_ID, undefined, getContext(this.thread)); } } @@ -874,7 +874,7 @@ class StepIntoAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(STEP_INTO_ID, getContext(this.thread)); + return this.commandService.executeCommand(STEP_INTO_ID, undefined, getContext(this.thread)); } } @@ -888,7 +888,7 @@ class StepOutAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(STEP_OUT_ID, getContext(this.thread)); + return this.commandService.executeCommand(STEP_OUT_ID, undefined, getContext(this.thread)); } } @@ -902,7 +902,7 @@ class PauseAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(PAUSE_ID, getContext(this.thread)); + return this.commandService.executeCommand(PAUSE_ID, undefined, getContext(this.thread)); } } @@ -916,6 +916,6 @@ class ContinueAction extends Action { } public run(): Promise { - return this.commandService.executeCommand(CONTINUE_ID, getContext(this.thread)); + return this.commandService.executeCommand(CONTINUE_ID, undefined, getContext(this.thread)); } } diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 4d8e0656a44..2b0cd1b2845 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -120,7 +120,7 @@ export function registerCommands(): void { // Same for stackFrame commands and session commands. CommandsRegistry.registerCommand({ id: COPY_STACK_TRACE_ID, - handler: async (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: async (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { const textResourcePropertiesService = accessor.get(ITextResourcePropertiesService); const clipboardService = accessor.get(IClipboardService); let frame = getFrame(accessor.get(IDebugService), context); @@ -133,21 +133,21 @@ export function registerCommands(): void { CommandsRegistry.registerCommand({ id: REVERSE_CONTINUE_ID, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, thread => thread.reverseContinue()); } }); CommandsRegistry.registerCommand({ id: STEP_BACK_ID, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, thread => thread.stepBack()); } }); CommandsRegistry.registerCommand({ id: TERMINATE_THREAD_ID, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, thread => thread.terminate()); } }); @@ -206,7 +206,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.F5, when: CONTEXT_IN_DEBUG_MODE, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { const debugService = accessor.get(IDebugService); let session: IDebugSession | undefined; if (isSessionContext(context)) { @@ -230,7 +230,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.F10, when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'), - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, (thread: IThread) => thread.next()); } }); @@ -240,7 +240,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib + 10, // Have a stronger weight to have priority over full screen when debugging primary: KeyCode.F11, when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'), - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, (thread: IThread) => thread.stepIn()); } }); @@ -250,7 +250,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyCode.F11, when: CONTEXT_DEBUG_STATE.isEqualTo('stopped'), - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, (thread: IThread) => thread.stepOut()); } }); @@ -260,7 +260,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.F6, when: CONTEXT_DEBUG_STATE.isEqualTo('running'), - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, thread => thread.pause()); } }); @@ -279,7 +279,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyMod.Shift | KeyCode.F5, when: CONTEXT_IN_DEBUG_MODE, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { const debugService = accessor.get(IDebugService); let session: IDebugSession | undefined; if (isSessionContext(context)) { @@ -301,7 +301,7 @@ export function registerCommands(): void { CommandsRegistry.registerCommand({ id: RESTART_FRAME_ID, - handler: async (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: async (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { const debugService = accessor.get(IDebugService); let frame = getFrame(debugService, context); if (frame) { @@ -315,7 +315,7 @@ export function registerCommands(): void { weight: KeybindingWeight.WorkbenchContrib, primary: KeyCode.F5, when: CONTEXT_IN_DEBUG_MODE, - handler: (accessor: ServicesAccessor, context: CallStackContext | unknown) => { + handler: (accessor: ServicesAccessor, _: string, context: CallStackContext | unknown) => { getThreadAndRun(accessor, context, thread => thread.continue()); } }); From 62d864e64a5a522ec8af96d21f7b90c5cc1f6a85 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 16:44:07 +0100 Subject: [PATCH 240/637] update loader --- src/vs/loader.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/loader.js b/src/vs/loader.js index a222ee64009..80d0e52ceea 100644 --- a/src/vs/loader.js +++ b/src/vs/loader.js @@ -728,7 +728,7 @@ var AMDLoader; var result = compileWrapper.apply(this.exports, args); // cached data aftermath that._handleCachedData(script, scriptSource, cachedDataPath, !options.cachedData, moduleManager); - that._verifyCachedData(script, scriptSource, cachedDataPath, hashData); + that._verifyCachedData(script, scriptSource, cachedDataPath, hashData, moduleManager); return result; }; }; @@ -775,7 +775,7 @@ var AMDLoader; var scriptOpts = { filename: vmScriptPathOrUri_1, cachedData: cachedData }; var script = _this._createAndEvalScript(moduleManager, scriptSource, scriptOpts, callback, errorback); _this._handleCachedData(script, scriptSource, cachedDataPath_1, wantsCachedData_1 && !cachedData, moduleManager); - _this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData); + _this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData, moduleManager); }); } }; @@ -906,7 +906,7 @@ var AMDLoader; }); } }; - NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData) { + NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData, moduleManager) { var _this = this; if (!hashData) { // nothing to do @@ -922,8 +922,8 @@ var AMDLoader; // for violations of this contract. var hashDataNow = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest(); if (!hashData.equals(hashDataNow)) { - console.warn("FAILED TO VERIFY CACHED DATA. Deleting '" + cachedDataPath + "' now, but a RESTART IS REQUIRED"); - _this._fs.unlink(cachedDataPath, function (err) { return console.error("FAILED to unlink: '" + cachedDataPath + "'", err); }); + moduleManager.getConfig().onError(new Error("FAILED TO VERIFY CACHED DATA, deleting stale '" + cachedDataPath + "' now, but a RESTART IS REQUIRED")); + _this._fs.unlink(cachedDataPath, function (err) { return moduleManager.getConfig().onError(err); }); } }, Math.ceil(5000 * (1 + Math.random()))); }; From a92df3eab56c3d11a0f284fb906c81e3e8dec713 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 16:51:15 +0100 Subject: [PATCH 241/637] fix #85422 --- .../extensions/electron-browser/extensionProfileService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts index 97d9f9f5839..6e081b5d157 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionProfileService.ts @@ -112,7 +112,7 @@ export class ExtensionHostProfileService extends Disposable implements IExtensio return null; } - const inspectPort = await this._extensionService.getInspectPort(false); + const inspectPort = await this._extensionService.getInspectPort(true); if (!inspectPort) { return this._dialogService.confirm({ type: 'info', From d1be3bd39ea8788c2a470a3cd7bb51c7c2b0a5db Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 9 Dec 2019 15:14:32 +0100 Subject: [PATCH 242/637] :lipstick: --- .../sharedProcess/sharedProcessMain.ts | 3 +- .../userDataSync/common/keybindingsSyncIpc.ts | 45 ------------------- .../userDataSync/common/userDataSyncIpc.ts | 42 ++++++++++++++++- .../userDataSync.contribution.ts | 2 +- 4 files changed, 42 insertions(+), 50 deletions(-) delete mode 100644 src/vs/platform/userDataSync/common/keybindingsSyncIpc.ts diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index b750a9b003f..adf5e433633 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -53,7 +53,7 @@ import { IProductService } from 'vs/platform/product/common/productService'; import { IUserDataSyncService, IUserDataSyncStoreService, registerConfiguration, IUserDataSyncLogService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; import { UserDataSyncService } from 'vs/platform/userDataSync/common/userDataSyncService'; import { UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService'; -import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; +import { UserDataSyncChannel, UserDataSyncUtilServiceClient } from 'vs/platform/userDataSync/common/userDataSyncIpc'; import { IElectronService } from 'vs/platform/electron/node/electron'; import { LoggerService } from 'vs/platform/log/node/loggerService'; import { UserDataSyncLogService } from 'vs/platform/userDataSync/common/userDataSyncLog'; @@ -62,7 +62,6 @@ import { AuthTokenService } from 'vs/platform/auth/electron-browser/authTokenSer import { AuthTokenChannel } from 'vs/platform/auth/common/authTokenIpc'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { KeytarCredentialsService } from 'vs/platform/credentials/node/credentialsService'; -import { UserDataSyncUtilServiceClient } from 'vs/platform/userDataSync/common/keybindingsSyncIpc'; import { UserDataAutoSync } from 'vs/platform/userDataSync/electron-browser/userDataAutoSync'; export interface ISharedProcessConfiguration { diff --git a/src/vs/platform/userDataSync/common/keybindingsSyncIpc.ts b/src/vs/platform/userDataSync/common/keybindingsSyncIpc.ts deleted file mode 100644 index f23b3c90c0b..00000000000 --- a/src/vs/platform/userDataSync/common/keybindingsSyncIpc.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -import { Event } from 'vs/base/common/event'; -import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; -import { IStringDictionary } from 'vs/base/common/collections'; -import { URI } from 'vs/base/common/uri'; -import { FormattingOptions } from 'vs/base/common/jsonFormatter'; - -export class UserDataSycnUtilServiceChannel implements IServerChannel { - - constructor(private readonly service: IUserDataSyncUtilService) { } - - listen(_: unknown, event: string): Event { - throw new Error(`Event not found: ${event}`); - } - - call(context: any, command: string, args?: any): Promise { - switch (command) { - case 'resolveUserKeybindings': return this.service.resolveUserBindings(args[0]); - case 'resolveFormattingOptions': return this.service.resolveFormattingOptions(URI.revive(args[0])); - } - throw new Error('Invalid call'); - } -} - -export class UserDataSyncUtilServiceClient implements IUserDataSyncUtilService { - - _serviceBrand: undefined; - - constructor(private readonly channel: IChannel) { - } - - async resolveUserBindings(userbindings: string[]): Promise> { - return this.channel.call('resolveUserKeybindings', [userbindings]); - } - - async resolveFormattingOptions(file: URI): Promise { - return this.channel.call('resolveFormattingOptions', [file]); - } - -} diff --git a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts index d772cbe47cb..b910d3f3b85 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts @@ -3,9 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IServerChannel } from 'vs/base/parts/ipc/common/ipc'; +import { IServerChannel, IChannel } from 'vs/base/parts/ipc/common/ipc'; import { Event } from 'vs/base/common/event'; -import { IUserDataSyncService } from 'vs/platform/userDataSync/common/userDataSync'; +import { IUserDataSyncService, IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync'; +import { URI } from 'vs/base/common/uri'; +import { IStringDictionary } from 'vs/base/common/collections'; +import { FormattingOptions } from 'vs/base/common/jsonFormatter'; export class UserDataSyncChannel implements IServerChannel { @@ -30,3 +33,38 @@ export class UserDataSyncChannel implements IServerChannel { throw new Error('Invalid call'); } } + +export class UserDataSycnUtilServiceChannel implements IServerChannel { + + constructor(private readonly service: IUserDataSyncUtilService) { } + + listen(_: unknown, event: string): Event { + throw new Error(`Event not found: ${event}`); + } + + call(context: any, command: string, args?: any): Promise { + switch (command) { + case 'resolveUserKeybindings': return this.service.resolveUserBindings(args[0]); + case 'resolveFormattingOptions': return this.service.resolveFormattingOptions(URI.revive(args[0])); + } + throw new Error('Invalid call'); + } +} + +export class UserDataSyncUtilServiceClient implements IUserDataSyncUtilService { + + _serviceBrand: undefined; + + constructor(private readonly channel: IChannel) { + } + + async resolveUserBindings(userbindings: string[]): Promise> { + return this.channel.call('resolveUserKeybindings', [userbindings]); + } + + async resolveFormattingOptions(file: URI): Promise { + return this.channel.call('resolveFormattingOptions', [file]); + } + +} + diff --git a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts index db872bdd689..926a6d2e7a2 100644 --- a/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts +++ b/src/vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution.ts @@ -8,7 +8,7 @@ import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDa import { Registry } from 'vs/platform/registry/common/platform'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; -import { UserDataSycnUtilServiceChannel } from 'vs/platform/userDataSync/common/keybindingsSyncIpc'; +import { UserDataSycnUtilServiceChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc'; class UserDataSyncServicesContribution implements IWorkbenchContribution { From 55988ef7fd1406adcf4c1f5fc5f9431755ce7ce3 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 9 Dec 2019 16:54:53 +0100 Subject: [PATCH 243/637] #86401 write tests for extensions merge --- .../userDataSync/common/extensionsMerge.ts | 169 ++++++++++++++++++ .../userDataSync/common/extensionsSync.ts | 167 +---------------- .../test/common/extensionsMerge.test.ts | 90 ++++++++++ 3 files changed, 268 insertions(+), 158 deletions(-) create mode 100644 src/vs/platform/userDataSync/common/extensionsMerge.ts create mode 100644 src/vs/platform/userDataSync/test/common/extensionsMerge.test.ts diff --git a/src/vs/platform/userDataSync/common/extensionsMerge.ts b/src/vs/platform/userDataSync/common/extensionsMerge.ts new file mode 100644 index 00000000000..ce4a95ea624 --- /dev/null +++ b/src/vs/platform/userDataSync/common/extensionsMerge.ts @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { values, keys } from 'vs/base/common/map'; +import { ISyncExtension } from 'vs/platform/userDataSync/common/userDataSync'; +import { IExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; +import { startsWith } from 'vs/base/common/strings'; + +export interface IMergeResult { + added: ISyncExtension[]; + removed: IExtensionIdentifier[]; + updated: ISyncExtension[]; + remote: ISyncExtension[] | null; +} + +export function merge(localExtensions: ISyncExtension[], remoteExtensions: ISyncExtension[] | null, lastSyncExtensions: ISyncExtension[] | null, skippedExtensions: ISyncExtension[], ignoredExtensions: string[]): IMergeResult { + const added: ISyncExtension[] = []; + const removed: IExtensionIdentifier[] = []; + const updated: ISyncExtension[] = []; + + if (!remoteExtensions) { + return { + added, + removed, + updated, + remote: localExtensions.filter(({ identifier }) => ignoredExtensions.every(id => id.toLowerCase() !== identifier.id.toLowerCase())) + }; + } + + const uuids: Map = new Map(); + const addUUID = (identifier: IExtensionIdentifier) => { if (identifier.uuid) { uuids.set(identifier.id.toLowerCase(), identifier.uuid); } }; + localExtensions.forEach(({ identifier }) => addUUID(identifier)); + remoteExtensions.forEach(({ identifier }) => addUUID(identifier)); + if (lastSyncExtensions) { + lastSyncExtensions.forEach(({ identifier }) => addUUID(identifier)); + } + + const addExtensionToMap = (map: Map, extension: ISyncExtension) => { + const uuid = extension.identifier.uuid || uuids.get(extension.identifier.id.toLowerCase()); + const key = uuid ? `uuid:${uuid}` : `id:${extension.identifier.id.toLowerCase()}`; + map.set(key, extension); + return map; + }; + const localExtensionsMap = localExtensions.reduce(addExtensionToMap, new Map()); + const remoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); + const newRemoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); + const lastSyncExtensionsMap = lastSyncExtensions ? lastSyncExtensions.reduce(addExtensionToMap, new Map()) : null; + const skippedExtensionsMap = skippedExtensions.reduce(addExtensionToMap, new Map()); + const ignoredExtensionsSet = ignoredExtensions.reduce((set, id) => { + const uuid = uuids.get(id.toLowerCase()); + return set.add(uuid ? `uuid:${uuid}` : `id:${id.toLowerCase()}`); + }, new Set()); + + const localToRemote = compare(localExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet); + if (localToRemote.added.size === 0 && localToRemote.removed.size === 0 && localToRemote.updated.size === 0) { + // No changes found between local and remote. + return { added: [], removed: [], updated: [], remote: null }; + } + + const baseToLocal = lastSyncExtensionsMap ? compare(lastSyncExtensionsMap, localExtensionsMap, ignoredExtensionsSet) : { added: keys(localExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; + const baseToRemote = lastSyncExtensionsMap ? compare(lastSyncExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet) : { added: keys(remoteExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; + + const massageSyncExtension = (extension: ISyncExtension, key: string): ISyncExtension => { + const massagedExtension: ISyncExtension = { + identifier: { + id: extension.identifier.id, + uuid: startsWith(key, 'uuid:') ? key.substring('uuid:'.length) : undefined + }, + enabled: extension.enabled, + }; + if (extension.version) { + massagedExtension.version = extension.version; + } + return massagedExtension; + }; + + // Remotely removed extension. + for (const key of values(baseToRemote.removed)) { + const e = localExtensionsMap.get(key); + if (e) { + removed.push(e.identifier); + } + } + + // Remotely added extension + for (const key of values(baseToRemote.added)) { + // Got added in local + if (baseToLocal.added.has(key)) { + // Is different from local to remote + if (localToRemote.updated.has(key)) { + updated.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); + } + } else { + // Add to local + added.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); + } + } + + // Remotely updated extensions + for (const key of values(baseToRemote.updated)) { + // If updated in local + if (baseToLocal.updated.has(key)) { + // Is different from local to remote + if (localToRemote.updated.has(key)) { + // update it in local + updated.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); + } + } + } + + // Locally added extensions + for (const key of values(baseToLocal.added)) { + // Not there in remote + if (!baseToRemote.added.has(key)) { + newRemoteExtensionsMap.set(key, massageSyncExtension(localExtensionsMap.get(key)!, key)); + } + } + + // Locally updated extensions + for (const key of values(baseToLocal.updated)) { + // If removed in remote + if (baseToRemote.removed.has(key)) { + continue; + } + + // If not updated in remote + if (!baseToRemote.updated.has(key)) { + newRemoteExtensionsMap.set(key, massageSyncExtension(localExtensionsMap.get(key)!, key)); + } + } + + // Locally removed extensions + for (const key of values(baseToLocal.removed)) { + // If not skipped and not updated in remote + if (!skippedExtensionsMap.has(key) && !baseToRemote.updated.has(key)) { + newRemoteExtensionsMap.delete(key); + } + } + + const remoteChanges = compare(remoteExtensionsMap, newRemoteExtensionsMap, new Set()); + const remote = remoteChanges.added.size > 0 || remoteChanges.updated.size > 0 || remoteChanges.removed.size > 0 ? values(newRemoteExtensionsMap) : null; + return { added, removed, updated, remote }; +} + +function compare(from: Map, to: Map, ignoredExtensions: Set): { added: Set, removed: Set, updated: Set } { + const fromKeys = keys(from).filter(key => !ignoredExtensions.has(key)); + const toKeys = keys(to).filter(key => !ignoredExtensions.has(key)); + const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); + const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); + const updated: Set = new Set(); + + for (const key of fromKeys) { + if (removed.has(key)) { + continue; + } + const fromExtension = from.get(key)!; + const toExtension = to.get(key); + if (!toExtension + || fromExtension.enabled !== toExtension.enabled + || fromExtension.version !== toExtension.version + ) { + updated.add(key); + } + } + + return { added, removed, updated }; +} diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index 2a0a9d7d603..43d86e6f26e 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -13,12 +13,11 @@ import { joinPath } from 'vs/base/common/resources'; import { IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionType, IExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; -import { keys, values } from 'vs/base/common/map'; -import { startsWith } from 'vs/base/common/strings'; import { IFileService } from 'vs/platform/files/common/files'; import { Queue } from 'vs/base/common/async'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { localize } from 'vs/nls'; +import { merge } from 'vs/platform/userDataSync/common/extensionsMerge'; export interface ISyncPreviewResult { readonly added: ISyncExtension[]; @@ -135,8 +134,14 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser const localExtensions = await this.getLocalExtensions(); - this.logService.trace('Extensions: Merging remote extensions with local extensions...'); - const { added, removed, updated, remote } = this.merge(localExtensions, remoteExtensions, lastSyncExtensions, skippedExtensions); + if (remoteExtensions) { + this.logService.trace('Extensions: Merging remote extensions with local extensions...'); + } else { + this.logService.info('Extensions: Remote extensions does not exist. Synchronizing extensions for the first time.'); + } + + const ignoredExtensions = this.configurationService.getValue('sync.ignoredExtensions') || []; + const { added, removed, updated, remote } = merge(localExtensions, remoteExtensions, lastSyncExtensions, skippedExtensions, ignoredExtensions); if (!added.length && !removed.length && !updated.length && !remote) { this.logService.trace('Extensions: No changes found during synchronizing extensions.'); @@ -162,160 +167,6 @@ export class ExtensionsSynchroniser extends Disposable implements ISynchroniser } } - /** - * Merge Strategy: - * - If remote does not exist, merge with local (First time sync) - * - Overwrite local with remote changes. Removed, Added, Updated. - * - Update remote with those local extension which are newly added or updated or removed and untouched in remote. - */ - private merge(localExtensions: ISyncExtension[], remoteExtensions: ISyncExtension[] | null, lastSyncExtensions: ISyncExtension[] | null, skippedExtensions: ISyncExtension[]): { added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[], remote: ISyncExtension[] | null } { - const ignoredExtensions = this.configurationService.getValue('sync.ignoredExtensions') || []; - // First time sync - if (!remoteExtensions) { - this.logService.info('Extensions: Remote extensions does not exist. Synchronizing extensions for the first time.'); - return { added: [], removed: [], updated: [], remote: localExtensions.filter(({ identifier }) => ignoredExtensions.every(id => id.toLowerCase() !== identifier.id.toLowerCase())) }; - } - - const uuids: Map = new Map(); - const addUUID = (identifier: IExtensionIdentifier) => { if (identifier.uuid) { uuids.set(identifier.id.toLowerCase(), identifier.uuid); } }; - localExtensions.forEach(({ identifier }) => addUUID(identifier)); - remoteExtensions.forEach(({ identifier }) => addUUID(identifier)); - if (lastSyncExtensions) { - lastSyncExtensions.forEach(({ identifier }) => addUUID(identifier)); - } - - const addExtensionToMap = (map: Map, extension: ISyncExtension) => { - const uuid = extension.identifier.uuid || uuids.get(extension.identifier.id.toLowerCase()); - const key = uuid ? `uuid:${uuid}` : `id:${extension.identifier.id.toLowerCase()}`; - map.set(key, extension); - return map; - }; - const localExtensionsMap = localExtensions.reduce(addExtensionToMap, new Map()); - const remoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); - const newRemoteExtensionsMap = remoteExtensions.reduce(addExtensionToMap, new Map()); - const lastSyncExtensionsMap = lastSyncExtensions ? lastSyncExtensions.reduce(addExtensionToMap, new Map()) : null; - const skippedExtensionsMap = skippedExtensions.reduce(addExtensionToMap, new Map()); - const ignoredExtensionsSet = ignoredExtensions.reduce((set, id) => { - const uuid = uuids.get(id.toLowerCase()); - return set.add(uuid ? `uuid:${uuid}` : `id:${id.toLowerCase()}`); - }, new Set()); - - const localToRemote = this.compare(localExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet); - if (localToRemote.added.size === 0 && localToRemote.removed.size === 0 && localToRemote.updated.size === 0) { - // No changes found between local and remote. - return { added: [], removed: [], updated: [], remote: null }; - } - - const added: ISyncExtension[] = []; - const removed: IExtensionIdentifier[] = []; - const updated: ISyncExtension[] = []; - - const baseToLocal = lastSyncExtensionsMap ? this.compare(lastSyncExtensionsMap, localExtensionsMap, ignoredExtensionsSet) : { added: keys(localExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; - const baseToRemote = lastSyncExtensionsMap ? this.compare(lastSyncExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet) : { added: keys(remoteExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; - - const massageSyncExtension = (extension: ISyncExtension, key: string): ISyncExtension => { - return { - identifier: { - id: extension.identifier.id, - uuid: startsWith(key, 'uuid:') ? key.substring('uuid:'.length) : undefined - }, - enabled: extension.enabled, - version: extension.version - }; - }; - - // Remotely removed extension. - for (const key of values(baseToRemote.removed)) { - const e = localExtensionsMap.get(key); - if (e) { - removed.push(e.identifier); - } - } - - // Remotely added extension - for (const key of values(baseToRemote.added)) { - // Got added in local - if (baseToLocal.added.has(key)) { - // Is different from local to remote - if (localToRemote.updated.has(key)) { - updated.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); - } - } else { - // Add to local - added.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); - } - } - - // Remotely updated extensions - for (const key of values(baseToRemote.updated)) { - // If updated in local - if (baseToLocal.updated.has(key)) { - // Is different from local to remote - if (localToRemote.updated.has(key)) { - // update it in local - updated.push(massageSyncExtension(remoteExtensionsMap.get(key)!, key)); - } - } - } - - // Locally added extensions - for (const key of values(baseToLocal.added)) { - // Not there in remote - if (!baseToRemote.added.has(key)) { - newRemoteExtensionsMap.set(key, massageSyncExtension(localExtensionsMap.get(key)!, key)); - } - } - - // Locally updated extensions - for (const key of values(baseToLocal.updated)) { - // If removed in remote - if (baseToRemote.removed.has(key)) { - continue; - } - - // If not updated in remote - if (!baseToRemote.updated.has(key)) { - newRemoteExtensionsMap.set(key, massageSyncExtension(localExtensionsMap.get(key)!, key)); - } - } - - // Locally removed extensions - for (const key of values(baseToLocal.removed)) { - // If not skipped and not updated in remote - if (!skippedExtensionsMap.has(key) && !baseToRemote.updated.has(key)) { - newRemoteExtensionsMap.delete(key); - } - } - - const remoteChanges = this.compare(remoteExtensionsMap, newRemoteExtensionsMap, new Set()); - const remote = remoteChanges.added.size > 0 || remoteChanges.updated.size > 0 || remoteChanges.removed.size > 0 ? values(newRemoteExtensionsMap) : null; - return { added, removed, updated, remote }; - } - - private compare(from: Map, to: Map, ignoredExtensions: Set): { added: Set, removed: Set, updated: Set } { - const fromKeys = keys(from).filter(key => !ignoredExtensions.has(key)); - const toKeys = keys(to).filter(key => !ignoredExtensions.has(key)); - const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); - const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); - const updated: Set = new Set(); - - for (const key of fromKeys) { - if (removed.has(key)) { - continue; - } - const fromExtension = from.get(key)!; - const toExtension = to.get(key); - if (!toExtension - || fromExtension.enabled !== toExtension.enabled - || fromExtension.version !== toExtension.version - ) { - updated.add(key); - } - } - - return { added, removed, updated }; - } - private async updateLocalExtensions(added: ISyncExtension[], removed: IExtensionIdentifier[], updated: ISyncExtension[], skippedExtensions: ISyncExtension[]): Promise { const removeFromSkipped: IExtensionIdentifier[] = []; const addToSkipped: ISyncExtension[] = []; diff --git a/src/vs/platform/userDataSync/test/common/extensionsMerge.test.ts b/src/vs/platform/userDataSync/test/common/extensionsMerge.test.ts new file mode 100644 index 00000000000..a907e94b634 --- /dev/null +++ b/src/vs/platform/userDataSync/test/common/extensionsMerge.test.ts @@ -0,0 +1,90 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { ISyncExtension } from 'vs/platform/userDataSync/common/userDataSync'; +import { merge } from 'vs/platform/userDataSync/common/extensionsMerge'; + +suite('ExtensionsMerge - No Conflicts', () => { + + test('merge returns local extension if remote does not exist', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, null, null, [], []); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, localExtensions); + }); + + test('merge returns local extension if remote does not exist with ignored extensions', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, null, null, [], ['a']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge returns local extension if remote does not exist with ignored extensions (ignore case)', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, null, null, [], ['A']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when there is no base', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, null, [], ['A']); + + assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + +}); From 17c4cf1b3a4e74872abd6d6a858168e3127bed69 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 16:40:56 +0100 Subject: [PATCH 244/637] Nicer fix for making sure tunnels are closed Part of #86074 --- .../services/remote/node/tunnelService.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/services/remote/node/tunnelService.ts b/src/vs/workbench/services/remote/node/tunnelService.ts index 6cb90f13add..f6e2e1aac18 100644 --- a/src/vs/workbench/services/remote/node/tunnelService.ts +++ b/src/vs/workbench/services/remote/node/tunnelService.ts @@ -151,22 +151,25 @@ export class TunnelService implements ITunnelService { const existing = this._tunnels.get(tunnel.tunnelRemotePort); if (existing) { if (--existing.refcount <= 0) { - existing.value.then(tunnel => tunnel.dispose()); + existing.value.then(tunnel => this.disposeTunnel(tunnel)); this._tunnels.delete(tunnel.tunnelRemotePort); } - } else { - tunnel.dispose(); - this._onTunnelClosed.fire(tunnel.tunnelRemotePort); } } }; } + private disposeTunnel(tunnel: RemoteTunnel) { + tunnel.dispose(); + this._onTunnelClosed.fire(tunnel.tunnelRemotePort); + } + async closeTunnel(remotePort: number): Promise { if (this._tunnels.has(remotePort)) { const value = this._tunnels.get(remotePort)!; - (await value.value).dispose(); + this.disposeTunnel(await value.value); value.refcount = 0; + this._tunnels.delete(remotePort); } } @@ -191,8 +194,7 @@ export class TunnelService implements ITunnelService { }; const tunnel = createRemoteTunnel(options, remotePort, localPort); - // Using makeTunnel here for the value does result in dispose getting called twice, but it also ensures that _onTunnelClosed will be fired when closeTunnel is called. - this._tunnels.set(remotePort, { refcount: 1, value: tunnel.then(value => this.makeTunnel(value)) }); + this._tunnels.set(remotePort, { refcount: 1, value: tunnel }); return tunnel; } } From 5b4efb8c20c8d108f5923a5f467941db27f40ef4 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 16:55:34 +0100 Subject: [PATCH 245/637] More dispose tunnel clean up --- .../services/remote/node/tunnelService.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/services/remote/node/tunnelService.ts b/src/vs/workbench/services/remote/node/tunnelService.ts index f6e2e1aac18..8809b75528d 100644 --- a/src/vs/workbench/services/remote/node/tunnelService.ts +++ b/src/vs/workbench/services/remote/node/tunnelService.ts @@ -150,26 +150,29 @@ export class TunnelService implements ITunnelService { dispose: () => { const existing = this._tunnels.get(tunnel.tunnelRemotePort); if (existing) { - if (--existing.refcount <= 0) { - existing.value.then(tunnel => this.disposeTunnel(tunnel)); - this._tunnels.delete(tunnel.tunnelRemotePort); - } + existing.refcount--; + this.tryDisposeTunnel(tunnel.tunnelRemotePort, existing); } } }; } - private disposeTunnel(tunnel: RemoteTunnel) { - tunnel.dispose(); - this._onTunnelClosed.fire(tunnel.tunnelRemotePort); + private async tryDisposeTunnel(remotePort: number, tunnel: { refcount: number, readonly value: Promise }): Promise { + if (tunnel.refcount <= 0) { + const disposePromise: Promise = tunnel.value.then(tunnel => { + tunnel.dispose(); + this._onTunnelClosed.fire(tunnel.tunnelRemotePort); + }); + this._tunnels.delete(remotePort); + return disposePromise; + } } async closeTunnel(remotePort: number): Promise { if (this._tunnels.has(remotePort)) { const value = this._tunnels.get(remotePort)!; - this.disposeTunnel(await value.value); value.refcount = 0; - this._tunnels.delete(remotePort); + await this.tryDisposeTunnel(remotePort, value); } } From 8bce45b285cbdc07fe77653b15282333d26efd8c Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 9 Dec 2019 16:57:12 +0100 Subject: [PATCH 246/637] fixes #86506 --- .../contrib/debug/browser/startView.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/startView.ts b/src/vs/workbench/contrib/debug/browser/startView.ts index bfade3e4b0e..6b37030b8a9 100644 --- a/src/vs/workbench/contrib/debug/browser/startView.ts +++ b/src/vs/workbench/contrib/debug/browser/startView.ts @@ -34,6 +34,7 @@ export class StartView extends ViewletPane { private runButton!: Button; private firstMessageContainer!: HTMLElement; private secondMessageContainer!: HTMLElement; + private clickElement: HTMLElement | undefined; private debuggerLabels: string[] | undefined = undefined; constructor( @@ -74,13 +75,13 @@ export class StartView extends ViewletPane { const setSecondMessage = () => { secondMessageElement.textContent = localize('specifyHowToRun', "To futher configure Debug and Run"); - const clickElement = this.createClickElement(localize('configure', " create a launch.json file."), () => this.commandService.executeCommand(ConfigureAction.ID)); - this.secondMessageContainer.appendChild(clickElement); + this.clickElement = this.createClickElement(localize('configure', " create a launch.json file."), () => this.commandService.executeCommand(ConfigureAction.ID)); + this.secondMessageContainer.appendChild(this.clickElement); }; const setSecondMessageWithFolder = () => { secondMessageElement.textContent = localize('noLaunchConfiguration', "To futher configure Debug and Run, "); - const clickElement = this.createClickElement(localize('openFolder', " open a folder"), () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false })); - this.secondMessageContainer.appendChild(clickElement); + this.clickElement = this.createClickElement(localize('openFolder', " open a folder"), () => this.dialogService.pickFolderAndOpen({ forceNewWindow: false })); + this.secondMessageContainer.appendChild(this.clickElement); const moreText = $('span.moreText'); moreText.textContent = localize('andconfigure', " and create a launch.json file."); @@ -104,8 +105,8 @@ export class StartView extends ViewletPane { } if (!enabled && emptyWorkbench) { - const clickElement = this.createClickElement(localize('openFile', "Open a file"), () => this.dialogService.pickFileAndOpen({ forceNewWindow: false })); - this.firstMessageContainer.appendChild(clickElement); + this.clickElement = this.createClickElement(localize('openFile', "Open a file"), () => this.dialogService.pickFileAndOpen({ forceNewWindow: false })); + this.firstMessageContainer.appendChild(this.clickElement); const firstMessageElement = $('span'); this.firstMessageContainer.appendChild(firstMessageElement); firstMessageElement.textContent = localize('canBeDebuggedOrRun', " which can be debugged or run."); @@ -161,6 +162,10 @@ export class StartView extends ViewletPane { } focus(): void { - this.runButton.focus(); + if (this.debugButton.enabled) { + this.debugButton.focus(); + } else if (this.clickElement) { + this.clickElement.focus(); + } } } From 6de6aa0278b35763d9063e079ab8eaa8f2031289 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Mon, 9 Dec 2019 17:00:59 +0100 Subject: [PATCH 247/637] Blur causes port 0 to be forwarded Fixes #86212 --- src/vs/workbench/contrib/remote/browser/tunnelView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 8e194bd815f..fdcdde36b53 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -603,7 +603,7 @@ namespace ForwardPortAction { }, validationMessage: (value) => { const asNumber = Number(value); - if (isNaN(asNumber) || (asNumber < 0) || (asNumber > 65535)) { + if ((value === '') || isNaN(asNumber) || (asNumber < 0) || (asNumber > 65535)) { return nls.localize('remote.tunnelsView.portNumberValid', "Port number is invalid"); } return null; From eab8ca79dc31d09af243350bed3f2ef42ec64e11 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 9 Dec 2019 17:32:56 +0100 Subject: [PATCH 248/637] ensure callFrame#url is successful, #86601 --- .../extensions/electron-browser/extensionHostProfiler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts index 9014546ff67..bbc743030cb 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts @@ -10,6 +10,7 @@ import { IExtensionHostProfile, IExtensionService, ProfileSegmentId, ProfileSess import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { withNullAsUndefined } from 'vs/base/common/types'; import { Schemas } from 'vs/base/common/network'; +import { URI } from 'vs/base/common/uri'; export class ExtensionHostProfiler { @@ -32,7 +33,7 @@ export class ExtensionHostProfiler { let searchTree = TernarySearchTree.forPaths(); for (let extension of extensions) { if (extension.extensionLocation.scheme === Schemas.file) { - searchTree.set(realpathSync(extension.extensionLocation.fsPath), extension); + searchTree.set(URI.file(realpathSync(extension.extensionLocation.fsPath)).toString(), extension); } } From c3c57ae3a01dfe28efc8e778f9059ba9f418107a Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 9 Dec 2019 19:17:41 +0100 Subject: [PATCH 249/637] fixes #86534 --- extensions/git/src/model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index bb664235103..60ed1744434 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -392,7 +392,7 @@ export class Model { if (hint instanceof Uri) { let resourcePath: string; - if (hint.scheme === 'git') { + if (hint.scheme === 'git' || hint.scheme === 'gitfs') { resourcePath = fromGitUri(hint).path; } else { resourcePath = hint.fsPath; From e30906162edbadfbeb53c8149218c05923b6050f Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 9 Dec 2019 10:34:39 -0800 Subject: [PATCH 250/637] [Search Editor] Add more TM scopes. Ref #86317. (#86612) --- .../syntaxes/searchResult.tmLanguage.json | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index d16ecb8c97c..8f13bc5075a 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -7,12 +7,30 @@ "name": "comment" }, { - "match": "^\\S.*:$", - "name": "string path.searchResult" + "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", + "name": "string path.searchResult", + "captures": { + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + } }, { - "match": "^ \\d+", - "name": "constant.numeric lineNumber.searchResult" + "match": "^ (\\d+)(:| )", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2:": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + } } ] } From 731e2b9591a3d99d949976c36f2c47e25d56a1e0 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 9 Dec 2019 10:56:30 -0800 Subject: [PATCH 251/637] Revert rootPath changes This reverts commits a416c77e56ef0314ae00633faa04878151610de8, 5bc80f3ea031739c2f8796857221be6825b288da, 0403a10885f2ce11c17c7222a70f8c73df7c3ba6 --- .../src/workspace-tests/workspace.test.ts | 2 +- .../workbench/api/common/extHostWorkspace.ts | 5 - .../browser/relauncher.contribution.ts | 99 +++++++++++++++++-- .../api/extHostWorkspace.test.ts | 2 +- 4 files changed, 93 insertions(+), 15 deletions(-) diff --git a/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts b/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts index 729dd8f14d5..f018f581c42 100644 --- a/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/workspace-tests/workspace.test.ts @@ -13,7 +13,7 @@ suite('workspace-namespace', () => { teardown(closeAllEditors); test('rootPath', () => { - assert.equal(vscode.workspace.rootPath, undefined); + assert.ok(pathEquals(vscode.workspace.rootPath!, join(__dirname, '../../testWorkspace'))); }); test('workspaceFile', () => { diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index 99654eded85..4b5c0c1301f 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -339,11 +339,6 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac if (folders.length === 0) { return undefined; } - - if (folders.length > 1) { - return undefined; - } - // #54483 @Joh Why are we still using fsPath? return folders[0].uri.fsPath; } diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 4ef39c8a040..a152b50423d 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -3,17 +3,23 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Disposable } from 'vs/base/common/lifecycle'; -import { isMacintosh, isNative } from 'vs/base/common/platform'; -import { localize } from 'vs/nls'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; -import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { IProductService } from 'vs/platform/product/common/productService'; +import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle'; +import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWindowsConfiguration } from 'vs/platform/windows/common/windows'; -import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { localize } from 'vs/nls'; +import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; +import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; +import { RunOnceScheduler } from 'vs/base/common/async'; +import { URI } from 'vs/base/common/uri'; +import { isEqual } from 'vs/base/common/resources'; +import { isMacintosh, isNative } from 'vs/base/common/platform'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { IProductService } from 'vs/platform/product/common/productService'; interface IConfiguration extends IWindowsConfiguration { update: { mode: string; }; @@ -126,5 +132,82 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo } } +export class WorkspaceChangeExtHostRelauncher extends Disposable implements IWorkbenchContribution { + + private firstFolderResource?: URI; + private extensionHostRestarter: RunOnceScheduler; + + private onDidChangeWorkspaceFoldersUnbind: IDisposable | undefined; + + constructor( + @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, + @IExtensionService extensionService: IExtensionService, + @IHostService hostService: IHostService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService + ) { + super(); + + this.extensionHostRestarter = this._register(new RunOnceScheduler(() => { + if (!!environmentService.extensionTestsLocationURI) { + return; // no restart when in tests: see https://github.com/Microsoft/vscode/issues/66936 + } + + if (environmentService.configuration.remoteAuthority) { + hostService.reload(); // TODO@aeschli, workaround + } else if (isNative) { + extensionService.restartExtensionHost(); + } + }, 10)); + + this.contextService.getCompleteWorkspace() + .then(workspace => { + this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; + this.handleWorkbenchState(); + this._register(this.contextService.onDidChangeWorkbenchState(() => setTimeout(() => this.handleWorkbenchState()))); + }); + + this._register(toDisposable(() => { + if (this.onDidChangeWorkspaceFoldersUnbind) { + this.onDidChangeWorkspaceFoldersUnbind.dispose(); + } + })); + } + + private handleWorkbenchState(): void { + + // React to folder changes when we are in workspace state + if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) { + + // Update our known first folder path if we entered workspace + const workspace = this.contextService.getWorkspace(); + this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; + + // Install workspace folder listener + if (!this.onDidChangeWorkspaceFoldersUnbind) { + this.onDidChangeWorkspaceFoldersUnbind = this.contextService.onDidChangeWorkspaceFolders(() => this.onDidChangeWorkspaceFolders()); + } + } + + // Ignore the workspace folder changes in EMPTY or FOLDER state + else { + dispose(this.onDidChangeWorkspaceFoldersUnbind); + this.onDidChangeWorkspaceFoldersUnbind = undefined; + } + } + + private onDidChangeWorkspaceFolders(): void { + const workspace = this.contextService.getWorkspace(); + + // Restart extension host if first root folder changed (impact on deprecated workspace.rootPath API) + const newFirstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : undefined; + if (!isEqual(this.firstFolderResource, newFirstFolderResource)) { + this.firstFolderResource = newFirstFolderResource; + + this.extensionHostRestarter.schedule(); // buffer calls to extension host restart + } + } +} + const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); workbenchRegistry.registerWorkbenchContribution(SettingsChangeRelauncher, LifecyclePhase.Restored); +workbenchRegistry.registerWorkbenchContribution(WorkspaceChangeExtHostRelauncher, LifecyclePhase.Restored); diff --git a/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts b/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts index d505968d588..c05a1d72fd8 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts @@ -120,7 +120,7 @@ suite('ExtHostWorkspace', function () { assert.equal(ws.getPath(), undefined); ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('Folder'), 0), aWorkspaceFolderData(URI.file('Another/Folder'), 1)] }, new NullLogService()); - assert.equal(ws.getPath(), undefined); + assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder'); ws = createExtHostWorkspace(new TestRPCProtocol(), { id: 'foo', name: 'Test', folders: [aWorkspaceFolderData(URI.file('/Folder'), 0)] }, new NullLogService()); assert.equal(ws.getPath()!.replace(/\\/g, '/'), '/Folder'); From d7ce91be575dc4f87bd48939081a2422a222d5c2 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 9 Dec 2019 20:01:32 +0100 Subject: [PATCH 252/637] #86401 add merge tests --- .../userDataSync/common/extensionsMerge.ts | 10 +- .../test/common/extensionsMerge.test.ts | 412 +++++++++++++++++- 2 files changed, 416 insertions(+), 6 deletions(-) diff --git a/src/vs/platform/userDataSync/common/extensionsMerge.ts b/src/vs/platform/userDataSync/common/extensionsMerge.ts index ce4a95ea624..364c7513ecd 100644 --- a/src/vs/platform/userDataSync/common/extensionsMerge.ts +++ b/src/vs/platform/userDataSync/common/extensionsMerge.ts @@ -59,8 +59,8 @@ export function merge(localExtensions: ISyncExtension[], remoteExtensions: ISync return { added: [], removed: [], updated: [], remote: null }; } - const baseToLocal = lastSyncExtensionsMap ? compare(lastSyncExtensionsMap, localExtensionsMap, ignoredExtensionsSet) : { added: keys(localExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; - const baseToRemote = lastSyncExtensionsMap ? compare(lastSyncExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet) : { added: keys(remoteExtensionsMap).reduce((r, k) => { r.add(k); return r; }, new Set()), removed: new Set(), updated: new Set() }; + const baseToLocal = compare(lastSyncExtensionsMap, localExtensionsMap, ignoredExtensionsSet); + const baseToRemote = compare(lastSyncExtensionsMap, remoteExtensionsMap, ignoredExtensionsSet); const massageSyncExtension = (extension: ISyncExtension, key: string): ISyncExtension => { const massagedExtension: ISyncExtension = { @@ -144,8 +144,8 @@ export function merge(localExtensions: ISyncExtension[], remoteExtensions: ISync return { added, removed, updated, remote }; } -function compare(from: Map, to: Map, ignoredExtensions: Set): { added: Set, removed: Set, updated: Set } { - const fromKeys = keys(from).filter(key => !ignoredExtensions.has(key)); +function compare(from: Map | null, to: Map, ignoredExtensions: Set): { added: Set, removed: Set, updated: Set } { + const fromKeys = from ? keys(from).filter(key => !ignoredExtensions.has(key)) : []; const toKeys = keys(to).filter(key => !ignoredExtensions.has(key)); const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set()); @@ -155,7 +155,7 @@ function compare(from: Map, to: Map { assert.deepEqual(actual.remote, expected); }); + test('merge returns local extension if remote does not exist with skipped extensions', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const skippedExtension: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, null, null, skippedExtension, []); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge returns local extension if remote does not exist with skipped and ignored extensions', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const skippedExtension: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, null, null, skippedExtension, ['a']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + test('merge local and remote extensions when there is no base', async () => { const localExtensions: ISyncExtension[] = [ { identifier: { id: 'a', uuid: 'a' }, enabled: true }, @@ -78,7 +123,7 @@ suite('ExtensionsMerge - No Conflicts', () => { { identifier: { id: 'd', uuid: 'd' }, enabled: true }, ]; - const actual = merge(localExtensions, remoteExtensions, null, [], ['A']); + const actual = merge(localExtensions, remoteExtensions, null, [], []); assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); assert.deepEqual(actual.removed, []); @@ -86,5 +131,370 @@ suite('ExtensionsMerge - No Conflicts', () => { assert.deepEqual(actual.remote, expected); }); + test('merge local and remote extensions when there is no base and with ignored extensions', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, null, [], ['a']); + + assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when remote is moved forwarded', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], []); + + assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, [{ id: 'a', uuid: 'a' }, { id: 'd', uuid: 'd' }]); + assert.deepEqual(actual.updated, []); + assert.equal(actual.remote, null); + }); + + test('merge local and remote extensions when remote moved forwarded with ignored extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], ['a']); + + assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, [{ id: 'd', uuid: 'd' }]); + assert.deepEqual(actual.updated, []); + assert.equal(actual.remote, null); + }); + + test('merge local and remote extensions when remote is moved forwarded with skipped extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, []); + + assert.deepEqual(actual.added, [{ identifier: { id: 'b', uuid: 'b' }, enabled: true }, { identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, [{ id: 'd', uuid: 'd' }]); + assert.deepEqual(actual.updated, []); + assert.equal(actual.remote, null); + }); + + test('merge local and remote extensions when remote is moved forwarded with skipped and ignored extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, ['b']); + + assert.deepEqual(actual.added, [{ identifier: { id: 'c', uuid: 'c' }, enabled: true }]); + assert.deepEqual(actual.removed, [{ id: 'd', uuid: 'd' }]); + assert.deepEqual(actual.updated, []); + assert.equal(actual.remote, null); + }); + + test('merge local and remote extensions when local is moved forwarded', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], []); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, localExtensions); + }); + + test('merge local and remote extensions when local is moved forwarded with ignored settings', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], ['b']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, [ + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]); + }); + + test('merge local and remote extensions when local is moved forwarded with skipped extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, []); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when local is moved forwarded with skipped and ignored extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, ['c']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when both moved forwarded', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], []); + + assert.deepEqual(actual.added, [{ identifier: { id: 'e', uuid: 'e' }, enabled: true }]); + assert.deepEqual(actual.removed, [{ id: 'a', uuid: 'a' }]); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when both moved forwarded with ignored extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, [], ['a', 'e']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when both moved forwarded with skipped extensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, []); + + assert.deepEqual(actual.added, [{ identifier: { id: 'e', uuid: 'e' }, enabled: true }]); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge local and remote extensions when both moved forwarded with skipped and ignoredextensions', async () => { + const baseExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const skippedExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + ]; + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'e', uuid: 'e' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, baseExtensions, skippedExtensions, ['e']); + + assert.deepEqual(actual.added, []); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + + test('merge when remote extension has no uuid and different extension id case', async () => { + const localExtensions: ISyncExtension[] = [ + { identifier: { id: 'a', uuid: 'a' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + const remoteExtensions: ISyncExtension[] = [ + { identifier: { id: 'A' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + ]; + const expected: ISyncExtension[] = [ + { identifier: { id: 'A' }, enabled: true }, + { identifier: { id: 'd', uuid: 'd' }, enabled: true }, + { identifier: { id: 'b', uuid: 'b' }, enabled: true }, + { identifier: { id: 'c', uuid: 'c' }, enabled: true }, + ]; + + const actual = merge(localExtensions, remoteExtensions, null, [], []); + + assert.deepEqual(actual.added, [{ identifier: { id: 'd', uuid: 'd' }, enabled: true }]); + assert.deepEqual(actual.removed, []); + assert.deepEqual(actual.updated, []); + assert.deepEqual(actual.remote, expected); + }); + }); From 1a4a377a96cb1c16dde5b372ae56c0d6b1364a6b Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Mon, 9 Dec 2019 11:25:12 -0800 Subject: [PATCH 253/637] Fix #85242 --- src/vs/editor/contrib/parameterHints/parameterHints.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.css b/src/vs/editor/contrib/parameterHints/parameterHints.css index c764f5e9581..13888e672b2 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.css +++ b/src/vs/editor/contrib/parameterHints/parameterHints.css @@ -54,6 +54,10 @@ white-space: initial; } +.monaco-editor .parameter-hints-widget .docs .markdown-docs p code { + font-family: var(--monaco-monospace-font); +} + .monaco-editor .parameter-hints-widget .docs .code { white-space: pre-wrap; } From 16888e50f6923bb672742b5806f9badb0705e4b0 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 9 Dec 2019 14:55:05 -0800 Subject: [PATCH 254/637] Fix prefs search error telemetry --- .../contrib/preferences/browser/preferencesEditor.ts | 5 ++--- .../workbench/contrib/preferences/browser/settingsEditor2.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts index 29e80ca36b1..479838724d0 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts @@ -603,14 +603,13 @@ class PreferencesRenderersController extends Disposable { } else { /* __GDPR__ "defaultSettings.searchError" : { - "message": { "classification": "CallstackOrException", "purpose": "FeatureInsight" }, - "filter": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + "message": { "classification": "CallstackOrException", "purpose": "FeatureInsight" } } */ const message = getErrorMessage(err).trim(); if (message && message !== 'Error') { // "Error" = any generic network error - this.telemetryService.publicLog('defaultSettings.searchError', { message, filter }); + this.telemetryService.publicLog('defaultSettings.searchError', { message }); this.logService.info('Setting search error: ' + message); } return undefined; diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 5d009be83ef..571022f6a29 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -1324,14 +1324,13 @@ export class SettingsEditor2 extends BaseEditor { } else { /* __GDPR__ "settingsEditor.searchError" : { - "message": { "classification": "CallstackOrException", "purpose": "FeatureInsight" }, - "filter": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + "message": { "classification": "CallstackOrException", "purpose": "FeatureInsight" } } */ const message = getErrorMessage(err).trim(); if (message && message !== 'Error') { // "Error" = any generic network error - this.telemetryService.publicLog('settingsEditor.searchError', { message, filter }); + this.telemetryService.publicLog('settingsEditor.searchError', { message }); this.logService.info('Setting search error: ' + message); } return null; From cabcace4b5c5816c4715d6dca26edb0e6e826f8b Mon Sep 17 00:00:00 2001 From: SteVen Batten <6561887+sbatten@users.noreply.github.com> Date: Mon, 9 Dec 2019 15:30:46 -0800 Subject: [PATCH 255/637] Viewlet Refactor (#85566) * wip 2 * use viewlet stubs * fix layering issue * fix saveState and contextmenus * move context menu logic into panecomposite * revert tasks.json * tasks again * add showHeaderInTitleWhenSingleView values * patch tests * some cleanup * more cleanup * start view * merging conflicts * fix title and dnd * adding missing api surface to pane composite * additional merge resolution --- .../api/browser/viewsExtensionPoint.ts | 27 +- src/vs/workbench/browser/panecomposite.ts | 85 ++ .../browser/parts/views/customView.ts | 6 +- .../browser/parts/views/paneViewlet.ts | 469 ----------- .../browser/parts/views/viewPaneContainer.ts | 759 ++++++++++++++++++ .../browser/parts/views/viewsViewlet.ts | 321 +------- src/vs/workbench/browser/viewlet.ts | 55 +- src/vs/workbench/common/panecomposite.ts | 14 + src/vs/workbench/common/viewPaneContainer.ts | 16 + src/vs/workbench/common/viewlet.ts | 4 +- .../contrib/debug/browser/breakpointsView.ts | 6 +- .../contrib/debug/browser/callStackView.ts | 7 +- .../debug/browser/debug.contribution.ts | 2 +- .../contrib/debug/browser/debugCommands.ts | 4 +- .../contrib/debug/browser/debugViewlet.ts | 31 +- .../debug/browser/loadedScriptsView.ts | 6 +- .../contrib/debug/browser/startView.ts | 7 +- .../contrib/debug/browser/variablesView.ts | 6 +- .../debug/browser/watchExpressionsView.ts | 6 +- .../workbench/contrib/debug/common/debug.ts | 4 +- .../experiments/browser/experimentalPrompt.ts | 4 +- .../extensions/browser/extensionEditor.ts | 4 +- .../browser/extensionTipsService.ts | 4 +- .../browser/extensions.contribution.ts | 2 +- .../extensions/browser/extensionsActions.ts | 36 +- .../extensions/browser/extensionsQuickOpen.ts | 10 +- .../extensions/browser/extensionsViewlet.ts | 30 +- .../extensions/browser/extensionsViews.ts | 6 +- .../contrib/extensions/common/extensions.ts | 8 +- .../contrib/files/browser/explorerViewlet.ts | 28 +- .../contrib/files/browser/fileActions.ts | 4 +- .../contrib/files/browser/fileCommands.ts | 12 +- .../files/browser/files.contribution.ts | 2 +- .../contrib/files/browser/views/emptyView.ts | 6 +- .../files/browser/views/explorerView.ts | 8 +- .../files/browser/views/openEditorsView.ts | 6 +- .../format/browser/showExtensionQuery.ts | 4 +- .../browser/localizations.contribution.ts | 6 +- .../browser/localizationsActions.ts | 5 +- .../contrib/outline/browser/outlinePane.ts | 4 +- .../contrib/remote/browser/remote.ts | 28 +- .../contrib/remote/browser/tunnelView.ts | 6 +- .../workbench/contrib/scm/browser/mainPane.ts | 6 +- .../contrib/scm/browser/repositoryPane.ts | 6 +- .../contrib/scm/browser/scmViewlet.ts | 23 +- src/vs/workbench/contrib/scm/common/scm.ts | 4 +- .../search/browser/search.contribution.ts | 10 +- .../contrib/search/browser/searchActions.ts | 6 +- .../contrib/search/browser/searchView.ts | 6 +- .../contrib/search/browser/searchViewlet.ts | 29 +- .../themes/browser/themes.contribution.ts | 4 +- .../progress/test/progressIndicator.test.ts | 5 + .../services/search/common/search.ts | 4 +- src/vs/workbench/test/browser/viewlet.test.ts | 2 +- 54 files changed, 1204 insertions(+), 959 deletions(-) create mode 100644 src/vs/workbench/browser/panecomposite.ts delete mode 100644 src/vs/workbench/browser/parts/views/paneViewlet.ts create mode 100644 src/vs/workbench/browser/parts/views/viewPaneContainer.ts create mode 100644 src/vs/workbench/common/panecomposite.ts create mode 100644 src/vs/workbench/common/viewPaneContainer.ts diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 3fad85d1949..98a6468b92c 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -22,9 +22,8 @@ import { VIEWLET_ID as DEBUG } from 'vs/workbench/contrib/debug/common/debug'; import { VIEWLET_ID as REMOTE } from 'vs/workbench/contrib/remote/common/remote.contribution'; import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { URI } from 'vs/base/common/uri'; -import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction } from 'vs/workbench/browser/viewlet'; +import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction, Viewlet } from 'vs/workbench/browser/viewlet'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; @@ -37,6 +36,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; +import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; export interface IUserFriendlyViewsContainerDescriptor { id: string; @@ -315,8 +315,24 @@ class ViewsExtensionHandler implements IWorkbenchContribution { viewContainer = this.viewContainersRegistry.registerViewContainer(id, true, extensionId); - // Register as viewlet - class CustomViewlet extends ViewContainerViewlet { + class CustomViewPaneContainer extends ViewPaneContainer { + constructor( + @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, + @ITelemetryService telemetryService: ITelemetryService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IStorageService protected storageService: IStorageService, + @IConfigurationService configurationService: IConfigurationService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService contextMenuService: IContextMenuService, + @IExtensionService extensionService: IExtensionService, + ) { + super(id, `${id}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + } + } + + // Register a viewlet + class CustomViewlet extends Viewlet { constructor( @IConfigurationService configurationService: IConfigurationService, @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, @@ -329,9 +345,10 @@ class ViewsExtensionHandler implements IWorkbenchContribution { @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService ) { - super(id, `${id}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(id, instantiationService.createInstance(CustomViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); } } + const viewletDescriptor = ViewletDescriptor.create( CustomViewlet, id, diff --git a/src/vs/workbench/browser/panecomposite.ts b/src/vs/workbench/browser/panecomposite.ts new file mode 100644 index 00000000000..edd85f1f83b --- /dev/null +++ b/src/vs/workbench/browser/panecomposite.ts @@ -0,0 +1,85 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Dimension } from 'vs/base/browser/dom'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { IView } from 'vs/workbench/common/views'; +import { IStorageService } from 'vs/platform/storage/common/storage'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; +import { Composite } from 'vs/workbench/browser/composite'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { ViewPaneContainer } from './parts/views/viewPaneContainer'; +import { IPaneComposite } from 'vs/workbench/common/panecomposite'; +import { IAction, IActionViewItem } from 'vs/base/common/actions'; + +export class PaneComposite extends Composite implements IPaneComposite { + constructor(id: string, + protected readonly viewPaneContainer: ViewPaneContainer, + @ITelemetryService + telemetryService: ITelemetryService, + @IStorageService + protected storageService: IStorageService, + @IInstantiationService + protected instantiationService: IInstantiationService, + @IThemeService + themeService: IThemeService, + @IContextMenuService + protected contextMenuService: IContextMenuService, + @IExtensionService + protected extensionService: IExtensionService, + @IWorkspaceContextService + protected contextService: IWorkspaceContextService) { + super(id, telemetryService, themeService, storageService); + + this._register(this.viewPaneContainer.onTitleAreaUpdate(() => this.updateTitleArea())); + } + create(parent: HTMLElement): void { + this.viewPaneContainer.create(parent); + } + setVisible(visible: boolean): void { + super.setVisible(visible); + this.viewPaneContainer.setVisible(visible); + } + layout(dimension: Dimension): void { + this.viewPaneContainer.layout(dimension); + } + getOptimalWidth(): number { + return this.viewPaneContainer.getOptimalWidth(); + } + openView(id: string, focus?: boolean): IView { + return this.viewPaneContainer.openView(id, focus); + } + + getViewPaneContainer(): ViewPaneContainer { + return this.viewPaneContainer; + } + + getContextMenuActions(): ReadonlyArray { + return this.viewPaneContainer.getContextMenuActions(); + } + + getActions(): ReadonlyArray { + return this.viewPaneContainer.getActions(); + } + + getSecondaryActions(): ReadonlyArray { + return this.viewPaneContainer.getSecondaryActions(); + } + + getActionViewItem(action: IAction): IActionViewItem | undefined { + return this.viewPaneContainer.getActionViewItem(action); + } + + getTitle(): string { + return this.viewPaneContainer.getTitle(); + } + + saveState(): void { + super.saveState(); + } +} diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 73a8fa54525..d8379e3ae26 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -29,7 +29,7 @@ import { dirname, basename } from 'vs/base/common/resources'; import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService'; import { FileKind } from 'vs/platform/files/common/files'; import { WorkbenchAsyncDataTree, TreeResourceNavigator2 } from 'vs/platform/list/browser/listService'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { localize } from 'vs/nls'; import { timeout } from 'vs/base/common/async'; import { textLinkForeground, textCodeBlockBackground, focusBorder, listFilterMatchHighlight, listFilterMatchHighlightBorder } from 'vs/platform/theme/common/colorRegistry'; @@ -43,7 +43,7 @@ import { CollapseAllAction } from 'vs/base/browser/ui/tree/treeDefaults'; import { isFalsyOrWhitespace } from 'vs/base/common/strings'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; -export class CustomTreeViewPane extends ViewletPane { +export class CustomTreeViewPane extends ViewPane { private treeView: ITreeView; @@ -55,7 +55,7 @@ export class CustomTreeViewPane extends ViewletPane { @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService); const { treeView } = (Registry.as(Extensions.ViewsRegistry).getView(options.id)); this.treeView = treeView; this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this)); diff --git a/src/vs/workbench/browser/parts/views/paneViewlet.ts b/src/vs/workbench/browser/parts/views/paneViewlet.ts deleted file mode 100644 index 9125018139a..00000000000 --- a/src/vs/workbench/browser/parts/views/paneViewlet.ts +++ /dev/null @@ -1,469 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import 'vs/css!./media/paneviewlet'; -import * as nls from 'vs/nls'; -import { Event, Emitter } from 'vs/base/common/event'; -import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry'; -import { attachStyler, IColorMapping } from 'vs/platform/theme/common/styler'; -import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER } from 'vs/workbench/common/theme'; -import { append, $, trackFocus, toggleClass, EventType, isAncestor, Dimension, addDisposableListener } from 'vs/base/browser/dom'; -import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle'; -import { firstIndex } from 'vs/base/common/arrays'; -import { IAction, IActionRunner } from 'vs/base/common/actions'; -import { IActionViewItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { prepareActions } from 'vs/workbench/browser/actions'; -import { Viewlet, ViewletRegistry, Extensions } from 'vs/workbench/browser/viewlet'; -import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { PaneView, IPaneViewOptions, IPaneOptions, Pane } from 'vs/base/browser/ui/splitview/paneview'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; -import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; -import { IView, FocusedViewContext } from 'vs/workbench/common/views'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { assertIsDefined } from 'vs/base/common/types'; - -export interface IPaneColors extends IColorMapping { - dropBackground?: ColorIdentifier; - headerForeground?: ColorIdentifier; - headerBackground?: ColorIdentifier; - headerBorder?: ColorIdentifier; -} - -export interface IViewletPaneOptions extends IPaneOptions { - actionRunner?: IActionRunner; - id: string; - title: string; - showActionsAlways?: boolean; -} - -export abstract class ViewletPane extends Pane implements IView { - - private static readonly AlwaysShowActionsConfig = 'workbench.view.alwaysShowHeaderActions'; - - private _onDidFocus = this._register(new Emitter()); - readonly onDidFocus: Event = this._onDidFocus.event; - - private _onDidBlur = this._register(new Emitter()); - readonly onDidBlur: Event = this._onDidBlur.event; - - private _onDidChangeBodyVisibility = this._register(new Emitter()); - readonly onDidChangeBodyVisibility: Event = this._onDidChangeBodyVisibility.event; - - protected _onDidChangeTitleArea = this._register(new Emitter()); - readonly onDidChangeTitleArea: Event = this._onDidChangeTitleArea.event; - - private focusedViewContextKey: IContextKey; - - private _isVisible: boolean = false; - readonly id: string; - title: string; - - protected actionRunner?: IActionRunner; - protected toolbar?: ToolBar; - private readonly showActionsAlways: boolean = false; - private headerContainer?: HTMLElement; - private titleContainer?: HTMLElement; - protected twistiesContainer?: HTMLElement; - - constructor( - options: IViewletPaneOptions, - @IKeybindingService protected keybindingService: IKeybindingService, - @IContextMenuService protected contextMenuService: IContextMenuService, - @IConfigurationService protected readonly configurationService: IConfigurationService, - @IContextKeyService contextKeyService: IContextKeyService - ) { - super(options); - - this.id = options.id; - this.title = options.title; - this.actionRunner = options.actionRunner; - this.showActionsAlways = !!options.showActionsAlways; - this.focusedViewContextKey = FocusedViewContext.bindTo(contextKeyService); - } - - setVisible(visible: boolean): void { - if (this._isVisible !== visible) { - this._isVisible = visible; - - if (this.isExpanded()) { - this._onDidChangeBodyVisibility.fire(visible); - } - } - } - - isVisible(): boolean { - return this._isVisible; - } - - isBodyVisible(): boolean { - return this._isVisible && this.isExpanded(); - } - - setExpanded(expanded: boolean): boolean { - const changed = super.setExpanded(expanded); - if (changed) { - this._onDidChangeBodyVisibility.fire(expanded); - } - - return changed; - } - - render(): void { - super.render(); - - const focusTracker = trackFocus(this.element); - this._register(focusTracker); - this._register(focusTracker.onDidFocus(() => { - this.focusedViewContextKey.set(this.id); - this._onDidFocus.fire(); - })); - this._register(focusTracker.onDidBlur(() => { - this.focusedViewContextKey.reset(); - this._onDidBlur.fire(); - })); - } - - protected renderHeader(container: HTMLElement): void { - this.headerContainer = container; - - this.renderTwisties(container); - - this.renderHeaderTitle(container, this.title); - - const actions = append(container, $('.actions')); - toggleClass(actions, 'show', this.showActionsAlways); - this.toolbar = new ToolBar(actions, this.contextMenuService, { - orientation: ActionsOrientation.HORIZONTAL, - actionViewItemProvider: action => this.getActionViewItem(action), - ariaLabel: nls.localize('viewToolbarAriaLabel', "{0} actions", this.title), - getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id), - actionRunner: this.actionRunner - }); - - this._register(this.toolbar); - this.setActions(); - - const onDidRelevantConfigurationChange = Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(ViewletPane.AlwaysShowActionsConfig)); - this._register(onDidRelevantConfigurationChange(this.updateActionsVisibility, this)); - this.updateActionsVisibility(); - } - - protected renderTwisties(container: HTMLElement): void { - this.twistiesContainer = append(container, $('.twisties.codicon.codicon-chevron-right')); - } - - protected renderHeaderTitle(container: HTMLElement, title: string): void { - this.titleContainer = append(container, $('h3.title', undefined, title)); - } - - protected updateTitle(title: string): void { - if (this.titleContainer) { - this.titleContainer.textContent = title; - } - this.title = title; - this._onDidChangeTitleArea.fire(); - } - - focus(): void { - if (this.element) { - this.element.focus(); - this._onDidFocus.fire(); - } - } - - private setActions(): void { - if (this.toolbar) { - this.toolbar.setActions(prepareActions(this.getActions()), prepareActions(this.getSecondaryActions()))(); - this.toolbar.context = this.getActionsContext(); - } - } - - private updateActionsVisibility(): void { - if (!this.headerContainer) { - return; - } - const shouldAlwaysShowActions = this.configurationService.getValue('workbench.view.alwaysShowHeaderActions'); - toggleClass(this.headerContainer, 'actions-always-visible', shouldAlwaysShowActions); - } - - protected updateActions(): void { - this.setActions(); - this._onDidChangeTitleArea.fire(); - } - - getActions(): IAction[] { - return []; - } - - getSecondaryActions(): IAction[] { - return []; - } - - getActionViewItem(action: IAction): IActionViewItem | undefined { - return undefined; - } - - getActionsContext(): unknown { - return undefined; - } - - getOptimalWidth(): number { - return 0; - } - - saveState(): void { - // Subclasses to implement for saving state - } -} - -export interface IViewsViewletOptions extends IPaneViewOptions { - showHeaderInTitleWhenSingleView: boolean; -} - -interface IViewletPaneItem { - pane: ViewletPane; - disposable: IDisposable; -} - -export class PaneViewlet extends Viewlet { - - private lastFocusedPane: ViewletPane | undefined; - private paneItems: IViewletPaneItem[] = []; - private paneview?: PaneView; - - get onDidSashChange(): Event { - return assertIsDefined(this.paneview).onDidSashChange; - } - - protected get panes(): ViewletPane[] { - return this.paneItems.map(i => i.pane); - } - - protected get length(): number { - return this.paneItems.length; - } - - constructor( - id: string, - private options: IViewsViewletOptions, - @IConfigurationService configurationService: IConfigurationService, - @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, - @IContextMenuService protected contextMenuService: IContextMenuService, - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IStorageService storageService: IStorageService - ) { - super(id, configurationService, layoutService, telemetryService, themeService, storageService); - } - - create(parent: HTMLElement): void { - super.create(parent); - this.paneview = this._register(new PaneView(parent, this.options)); - this._register(this.paneview.onDidDrop(({ from, to }) => this.movePane(from as ViewletPane, to as ViewletPane))); - this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, (e: MouseEvent) => this.showContextMenu(new StandardMouseEvent(e)))); - } - - private showContextMenu(event: StandardMouseEvent): void { - for (const paneItem of this.paneItems) { - // Do not show context menu if target is coming from inside pane views - if (isAncestor(event.target, paneItem.pane.element)) { - return; - } - } - - event.stopPropagation(); - event.preventDefault(); - - let anchor: { x: number, y: number; } = { x: event.posx, y: event.posy }; - this.contextMenuService.showContextMenu({ - getAnchor: () => anchor, - getActions: () => this.getContextMenuActions() - }); - } - - getTitle(): string { - let title = Registry.as(Extensions.Viewlets).getViewlet(this.getId()).name; - - if (this.isSingleView()) { - const paneItemTitle = this.paneItems[0].pane.title; - title = paneItemTitle ? `${title}: ${paneItemTitle}` : title; - } - - return title; - } - - getActions(): IAction[] { - if (this.isSingleView()) { - return this.paneItems[0].pane.getActions(); - } - - return []; - } - - getSecondaryActions(): IAction[] { - if (this.isSingleView()) { - return this.paneItems[0].pane.getSecondaryActions(); - } - - return []; - } - - getActionViewItem(action: IAction): IActionViewItem | undefined { - if (this.isSingleView()) { - return this.paneItems[0].pane.getActionViewItem(action); - } - - return super.getActionViewItem(action); - } - - focus(): void { - super.focus(); - - if (this.lastFocusedPane) { - this.lastFocusedPane.focus(); - } else if (this.paneItems.length > 0) { - for (const { pane: pane } of this.paneItems) { - if (pane.isExpanded()) { - pane.focus(); - return; - } - } - } - } - - layout(dimension: Dimension): void { - if (this.paneview) { - this.paneview.layout(dimension.height, dimension.width); - } - } - - getOptimalWidth(): number { - const sizes = this.paneItems - .map(paneItem => paneItem.pane.getOptimalWidth() || 0); - - return Math.max(...sizes); - } - - addPanes(panes: { pane: ViewletPane, size: number, index?: number; }[]): void { - const wasSingleView = this.isSingleView(); - - for (const { pane: pane, size, index } of panes) { - this.addPane(pane, size, index); - } - - this.updateViewHeaders(); - if (this.isSingleView() !== wasSingleView) { - this.updateTitleArea(); - } - } - - private addPane(pane: ViewletPane, size: number, index = this.paneItems.length - 1): void { - const onDidFocus = pane.onDidFocus(() => this.lastFocusedPane = pane); - const onDidChangeTitleArea = pane.onDidChangeTitleArea(() => { - if (this.isSingleView()) { - this.updateTitleArea(); - } - }); - const onDidChange = pane.onDidChange(() => { - if (pane === this.lastFocusedPane && !pane.isExpanded()) { - this.lastFocusedPane = undefined; - } - }); - - const paneStyler = attachStyler(this.themeService, { - headerForeground: SIDE_BAR_SECTION_HEADER_FOREGROUND, - headerBackground: SIDE_BAR_SECTION_HEADER_BACKGROUND, - headerBorder: SIDE_BAR_SECTION_HEADER_BORDER, - dropBackground: SIDE_BAR_DRAG_AND_DROP_BACKGROUND - }, pane); - const disposable = combinedDisposable(onDidFocus, onDidChangeTitleArea, paneStyler, onDidChange); - const paneItem: IViewletPaneItem = { pane: pane, disposable }; - - this.paneItems.splice(index, 0, paneItem); - assertIsDefined(this.paneview).addPane(pane, size, index); - } - - removePanes(panes: ViewletPane[]): void { - const wasSingleView = this.isSingleView(); - - panes.forEach(pane => this.removePane(pane)); - - this.updateViewHeaders(); - if (wasSingleView !== this.isSingleView()) { - this.updateTitleArea(); - } - } - - private removePane(pane: ViewletPane): void { - const index = firstIndex(this.paneItems, i => i.pane === pane); - - if (index === -1) { - return; - } - - if (this.lastFocusedPane === pane) { - this.lastFocusedPane = undefined; - } - - assertIsDefined(this.paneview).removePane(pane); - const [paneItem] = this.paneItems.splice(index, 1); - paneItem.disposable.dispose(); - - } - - movePane(from: ViewletPane, to: ViewletPane): void { - const fromIndex = firstIndex(this.paneItems, item => item.pane === from); - const toIndex = firstIndex(this.paneItems, item => item.pane === to); - - if (fromIndex < 0 || fromIndex >= this.paneItems.length) { - return; - } - - if (toIndex < 0 || toIndex >= this.paneItems.length) { - return; - } - - const [paneItem] = this.paneItems.splice(fromIndex, 1); - this.paneItems.splice(toIndex, 0, paneItem); - - assertIsDefined(this.paneview).movePane(from, to); - } - - resizePane(pane: ViewletPane, size: number): void { - assertIsDefined(this.paneview).resizePane(pane, size); - } - - getPaneSize(pane: ViewletPane): number { - return assertIsDefined(this.paneview).getPaneSize(pane); - } - - protected updateViewHeaders(): void { - if (this.isSingleView()) { - this.paneItems[0].pane.setExpanded(true); - this.paneItems[0].pane.headerVisible = false; - } else { - this.paneItems.forEach(i => i.pane.headerVisible = true); - } - } - - protected isSingleView(): boolean { - return this.options.showHeaderInTitleWhenSingleView && this.paneItems.length === 1; - } - - dispose(): void { - super.dispose(); - this.paneItems.forEach(i => i.disposable.dispose()); - if (this.paneview) { - this.paneview.dispose(); - } - } -} diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts new file mode 100644 index 00000000000..0dd8c50cffb --- /dev/null +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -0,0 +1,759 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import 'vs/css!./media/paneviewlet'; +import * as nls from 'vs/nls'; +import { Event, Emitter } from 'vs/base/common/event'; +import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry'; +import { attachStyler, IColorMapping } from 'vs/platform/theme/common/styler'; +import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER } from 'vs/workbench/common/theme'; +import { append, $, trackFocus, toggleClass, EventType, isAncestor, Dimension, addDisposableListener } from 'vs/base/browser/dom'; +import { IDisposable, combinedDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; +import { firstIndex } from 'vs/base/common/arrays'; +import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions'; +import { IActionViewItem, ActionsOrientation, Separator } from 'vs/base/browser/ui/actionbar/actionbar'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { prepareActions } from 'vs/workbench/browser/actions'; +import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { PaneView, IPaneViewOptions, IPaneOptions, Pane, DefaultPaneDndController } from 'vs/base/browser/ui/splitview/paneview'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; +import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; +import { Extensions as ViewContainerExtensions, IView, FocusedViewContext, IViewContainersRegistry, IViewDescriptor } from 'vs/workbench/common/views'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { assertIsDefined } from 'vs/base/common/types'; +import { PersistentContributableViewsModel, IAddedViewDescriptorRef, IViewDescriptorRef } from 'vs/workbench/browser/parts/views/views'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; +import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; +import { Component } from 'vs/workbench/common/component'; +import { Extensions, ViewletRegistry } from 'vs/workbench/browser/viewlet'; + +export interface IPaneColors extends IColorMapping { + dropBackground?: ColorIdentifier; + headerForeground?: ColorIdentifier; + headerBackground?: ColorIdentifier; + headerBorder?: ColorIdentifier; +} + +export interface IViewPaneOptions extends IPaneOptions { + actionRunner?: IActionRunner; + id: string; + title: string; + showActionsAlways?: boolean; +} + +export abstract class ViewPane extends Pane implements IView { + + private static readonly AlwaysShowActionsConfig = 'workbench.view.alwaysShowHeaderActions'; + + private _onDidFocus = this._register(new Emitter()); + readonly onDidFocus: Event = this._onDidFocus.event; + + private _onDidBlur = this._register(new Emitter()); + readonly onDidBlur: Event = this._onDidBlur.event; + + private _onDidChangeBodyVisibility = this._register(new Emitter()); + readonly onDidChangeBodyVisibility: Event = this._onDidChangeBodyVisibility.event; + + protected _onDidChangeTitleArea = this._register(new Emitter()); + readonly onDidChangeTitleArea: Event = this._onDidChangeTitleArea.event; + + private focusedViewContextKey: IContextKey; + + private _isVisible: boolean = false; + readonly id: string; + title: string; + + protected actionRunner?: IActionRunner; + protected toolbar?: ToolBar; + private readonly showActionsAlways: boolean = false; + private headerContainer?: HTMLElement; + private titleContainer?: HTMLElement; + protected twistiesContainer?: HTMLElement; + + constructor( + options: IViewPaneOptions, + @IKeybindingService protected keybindingService: IKeybindingService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IConfigurationService protected readonly configurationService: IConfigurationService, + @IContextKeyService contextKeyService: IContextKeyService + ) { + super(options); + + this.id = options.id; + this.title = options.title; + this.actionRunner = options.actionRunner; + this.showActionsAlways = !!options.showActionsAlways; + this.focusedViewContextKey = FocusedViewContext.bindTo(contextKeyService); + } + + setVisible(visible: boolean): void { + if (this._isVisible !== visible) { + this._isVisible = visible; + + if (this.isExpanded()) { + this._onDidChangeBodyVisibility.fire(visible); + } + } + } + + isVisible(): boolean { + return this._isVisible; + } + + isBodyVisible(): boolean { + return this._isVisible && this.isExpanded(); + } + + setExpanded(expanded: boolean): boolean { + const changed = super.setExpanded(expanded); + if (changed) { + this._onDidChangeBodyVisibility.fire(expanded); + } + + return changed; + } + + render(): void { + super.render(); + + const focusTracker = trackFocus(this.element); + this._register(focusTracker); + this._register(focusTracker.onDidFocus(() => { + this.focusedViewContextKey.set(this.id); + this._onDidFocus.fire(); + })); + this._register(focusTracker.onDidBlur(() => { + this.focusedViewContextKey.reset(); + this._onDidBlur.fire(); + })); + } + + protected renderHeader(container: HTMLElement): void { + this.headerContainer = container; + + this.renderTwisties(container); + + this.renderHeaderTitle(container, this.title); + + const actions = append(container, $('.actions')); + toggleClass(actions, 'show', this.showActionsAlways); + this.toolbar = new ToolBar(actions, this.contextMenuService, { + orientation: ActionsOrientation.HORIZONTAL, + actionViewItemProvider: action => this.getActionViewItem(action), + ariaLabel: nls.localize('viewToolbarAriaLabel', "{0} actions", this.title), + getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id), + actionRunner: this.actionRunner + }); + + this._register(this.toolbar); + this.setActions(); + + const onDidRelevantConfigurationChange = Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(ViewPane.AlwaysShowActionsConfig)); + this._register(onDidRelevantConfigurationChange(this.updateActionsVisibility, this)); + this.updateActionsVisibility(); + } + + protected renderTwisties(container: HTMLElement): void { + this.twistiesContainer = append(container, $('.twisties.codicon.codicon-chevron-right')); + } + + protected renderHeaderTitle(container: HTMLElement, title: string): void { + this.titleContainer = append(container, $('h3.title', undefined, title)); + } + + protected updateTitle(title: string): void { + if (this.titleContainer) { + this.titleContainer.textContent = title; + } + this.title = title; + this._onDidChangeTitleArea.fire(); + } + + focus(): void { + if (this.element) { + this.element.focus(); + this._onDidFocus.fire(); + } + } + + private setActions(): void { + if (this.toolbar) { + this.toolbar.setActions(prepareActions(this.getActions()), prepareActions(this.getSecondaryActions()))(); + this.toolbar.context = this.getActionsContext(); + } + } + + private updateActionsVisibility(): void { + if (!this.headerContainer) { + return; + } + const shouldAlwaysShowActions = this.configurationService.getValue('workbench.view.alwaysShowHeaderActions'); + toggleClass(this.headerContainer, 'actions-always-visible', shouldAlwaysShowActions); + } + + protected updateActions(): void { + this.setActions(); + this._onDidChangeTitleArea.fire(); + } + + getActions(): IAction[] { + return []; + } + + getSecondaryActions(): IAction[] { + return []; + } + + getActionViewItem(action: IAction): IActionViewItem | undefined { + return undefined; + } + + getActionsContext(): unknown { + return undefined; + } + + getOptimalWidth(): number { + return 0; + } + + saveState(): void { + // Subclasses to implement for saving state + } +} + +export interface IViewPaneContainerOptions extends IPaneViewOptions { + showHeaderInTitleWhenSingleView: boolean; +} + +interface IViewPaneItem { + pane: ViewPane; + disposable: IDisposable; +} + +export class ViewPaneContainer extends Component implements IViewPaneContainer { + + private lastFocusedPane: ViewPane | undefined; + private paneItems: IViewPaneItem[] = []; + private paneview?: PaneView; + + private visible: boolean = false; + + private areExtensionsReady: boolean = false; + + private didLayout = false; + private dimension: Dimension | undefined; + + protected actionRunner: IActionRunner | undefined; + + private readonly visibleViewsCountFromCache: number | undefined; + private readonly visibleViewsStorageId: string; + protected readonly viewsModel: PersistentContributableViewsModel; + private viewDisposables: IDisposable[] = []; + + private readonly _onTitleAreaUpdate: Emitter = this._register(new Emitter()); + readonly onTitleAreaUpdate: Event = this._onTitleAreaUpdate.event; + + private readonly _onDidChangeVisibility = this._register(new Emitter()); + readonly onDidChangeVisibility = this._onDidChangeVisibility.event; + + + get onDidSashChange(): Event { + return assertIsDefined(this.paneview).onDidSashChange; + } + + protected get panes(): ViewPane[] { + return this.paneItems.map(i => i.pane); + } + + protected get length(): number { + return this.paneItems.length; + } + + constructor( + id: string, + viewPaneContainerStateStorageId: string, + private options: IViewPaneContainerOptions, + @IInstantiationService protected instantiationService: IInstantiationService, + @IConfigurationService protected configurationService: IConfigurationService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @ITelemetryService protected telemetryService: ITelemetryService, + @IExtensionService protected extensionService: IExtensionService, + @IThemeService protected themeService: IThemeService, + @IStorageService protected storageService: IStorageService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService + ) { + + super(id, themeService, storageService); + + const container = Registry.as(ViewContainerExtensions.ViewContainersRegistry).get(id); + if (!container) { + throw new Error('Could not find container'); + } + + // Use default pane dnd controller if not specified + if (!this.options.dnd) { + this.options.dnd = new DefaultPaneDndController(); + } + + this.visibleViewsStorageId = `${id}.numberOfVisibleViews`; + this.visibleViewsCountFromCache = this.storageService.getNumber(this.visibleViewsStorageId, StorageScope.WORKSPACE, undefined); + this._register(toDisposable(() => this.viewDisposables = dispose(this.viewDisposables))); + this.viewsModel = this._register(this.instantiationService.createInstance(PersistentContributableViewsModel, container, viewPaneContainerStateStorageId)); + } + + create(parent: HTMLElement): void { + // super.create(parent); + this.paneview = this._register(new PaneView(parent, this.options)); + this._register(this.paneview.onDidDrop(({ from, to }) => this.movePane(from as ViewPane, to as ViewPane))); + this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, (e: MouseEvent) => this.showContextMenu(new StandardMouseEvent(e)))); + + this._register(this.onDidSashChange(() => this.saveViewSizes())); + this.viewsModel.onDidAdd(added => this.onDidAddViews(added)); + this.viewsModel.onDidRemove(removed => this.onDidRemoveViews(removed)); + const addedViews: IAddedViewDescriptorRef[] = this.viewsModel.visibleViewDescriptors.map((viewDescriptor, index) => { + const size = this.viewsModel.getSize(viewDescriptor.id); + const collapsed = this.viewsModel.isCollapsed(viewDescriptor.id); + return ({ viewDescriptor, index, size, collapsed }); + }); + if (addedViews.length) { + this.onDidAddViews(addedViews); + } + + // Update headers after and title contributed views after available, since we read from cache in the beginning to know if the viewlet has single view or not. Ref #29609 + this.extensionService.whenInstalledExtensionsRegistered().then(() => { + this.areExtensionsReady = true; + if (this.panes.length) { + this.updateTitleArea(); + this.updateViewHeaders(); + } + }); + + this.focus(); + } + + getTitle(): string { + let title = Registry.as(Extensions.Viewlets).getViewlet(this.getId()).name; + + if (this.isSingleView()) { + const paneItemTitle = this.paneItems[0].pane.title; + title = paneItemTitle ? `${title}: ${paneItemTitle}` : title; + } + + return title; + } + + private showContextMenu(event: StandardMouseEvent): void { + for (const paneItem of this.paneItems) { + // Do not show context menu if target is coming from inside pane views + if (isAncestor(event.target, paneItem.pane.element)) { + return; + } + } + + event.stopPropagation(); + event.preventDefault(); + + let anchor: { x: number, y: number; } = { x: event.posx, y: event.posy }; + this.contextMenuService.showContextMenu({ + getAnchor: () => anchor, + getActions: () => this.getContextMenuActions() + }); + } + + getContextMenuActions(viewDescriptor?: IViewDescriptor): IAction[] { + const result: IAction[] = []; + if (viewDescriptor) { + result.push({ + id: `${viewDescriptor.id}.removeView`, + label: nls.localize('hideView', "Hide"), + enabled: viewDescriptor.canToggleVisibility, + run: () => this.toggleViewVisibility(viewDescriptor.id) + }); + } + + const viewToggleActions = this.viewsModel.viewDescriptors.map(viewDescriptor => ({ + id: `${viewDescriptor.id}.toggleVisibility`, + label: viewDescriptor.name, + checked: this.viewsModel.isVisible(viewDescriptor.id), + enabled: viewDescriptor.canToggleVisibility, + run: () => this.toggleViewVisibility(viewDescriptor.id) + })); + + if (result.length && viewToggleActions.length) { + result.push(new Separator()); + } + + result.push(...viewToggleActions); + return result; + } + + getActions(): IAction[] { + if (this.isSingleView()) { + return this.paneItems[0].pane.getActions(); + } + + return []; + } + + getSecondaryActions(): IAction[] { + if (this.isSingleView()) { + return this.paneItems[0].pane.getSecondaryActions(); + } + + return []; + } + + getActionViewItem(action: IAction): IActionViewItem | undefined { + if (this.isSingleView()) { + return this.paneItems[0].pane.getActionViewItem(action); + } + + return undefined; + } + + focus(): void { + if (this.lastFocusedPane) { + this.lastFocusedPane.focus(); + } else if (this.paneItems.length > 0) { + for (const { pane: pane } of this.paneItems) { + if (pane.isExpanded()) { + pane.focus(); + return; + } + } + } + } + + layout(dimension: Dimension): void { + if (this.paneview) { + this.paneview.layout(dimension.height, dimension.width); + } + + this.dimension = dimension; + if (this.didLayout) { + this.saveViewSizes(); + } else { + this.didLayout = true; + this.restoreViewSizes(); + } + } + + getOptimalWidth(): number { + const additionalMargin = 16; + const optimalWidth = Math.max(...this.panes.map(view => view.getOptimalWidth() || 0)); + return optimalWidth + additionalMargin; + } + + addPanes(panes: { pane: ViewPane, size: number, index?: number; }[]): void { + const wasSingleView = this.isSingleView(); + + for (const { pane: pane, size, index } of panes) { + this.addPane(pane, size, index); + } + + this.updateViewHeaders(); + if (this.isSingleView() !== wasSingleView) { + this.updateTitleArea(); + } + } + + setVisible(visible: boolean): void { + if (this.visible !== !!visible) { + this.visible = visible; + + this._onDidChangeVisibility.fire(visible); + } + + this.panes.filter(view => view.isVisible() !== visible) + .map((view) => view.setVisible(visible)); + } + + isVisible(): boolean { + return this.visible; + } + + protected updateTitleArea(): void { + this._onTitleAreaUpdate.fire(); + + } + + protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewPane { + return (this.instantiationService as any).createInstance(viewDescriptor.ctorDescriptor.ctor, ...(viewDescriptor.ctorDescriptor.arguments || []), options) as ViewPane; + } + + getView(id: string): ViewPane | undefined { + return this.panes.filter(view => view.id === id)[0]; + } + + private saveViewSizes(): void { + // Save size only when the layout has happened + if (this.didLayout) { + for (const view of this.panes) { + this.viewsModel.setSize(view.id, this.getPaneSize(view)); + } + } + } + + private restoreViewSizes(): void { + // Restore sizes only when the layout has happened + if (this.didLayout) { + let initialSizes; + for (let i = 0; i < this.viewsModel.visibleViewDescriptors.length; i++) { + const pane = this.panes[i]; + const viewDescriptor = this.viewsModel.visibleViewDescriptors[i]; + const size = this.viewsModel.getSize(viewDescriptor.id); + + if (typeof size === 'number') { + this.resizePane(pane, size); + } else { + initialSizes = initialSizes ? initialSizes : this.computeInitialSizes(); + this.resizePane(pane, initialSizes.get(pane.id) || 200); + } + } + } + } + + private computeInitialSizes(): Map { + const sizes: Map = new Map(); + if (this.dimension) { + const totalWeight = this.viewsModel.visibleViewDescriptors.reduce((totalWeight, { weight }) => totalWeight + (weight || 20), 0); + for (const viewDescriptor of this.viewsModel.visibleViewDescriptors) { + sizes.set(viewDescriptor.id, this.dimension.height * (viewDescriptor.weight || 20) / totalWeight); + } + } + return sizes; + } + + saveState(): void { + this.panes.forEach((view) => view.saveState()); + this.storageService.store(this.visibleViewsStorageId, this.length, StorageScope.WORKSPACE); + } + + private onContextMenu(event: StandardMouseEvent, viewDescriptor: IViewDescriptor): void { + event.stopPropagation(); + event.preventDefault(); + + const actions: IAction[] = this.getContextMenuActions(viewDescriptor); + + let anchor: { x: number, y: number } = { x: event.posx, y: event.posy }; + this.contextMenuService.showContextMenu({ + getAnchor: () => anchor, + getActions: () => actions + }); + } + + openView(id: string, focus?: boolean): IView { + if (focus) { + this.focus(); + } + let view = this.getView(id); + if (!view) { + this.toggleViewVisibility(id); + } + view = this.getView(id)!; + view.setExpanded(true); + if (focus) { + view.focus(); + } + return view; + } + + protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] { + const panesToAdd: { pane: ViewPane, size: number, index: number }[] = []; + for (const { viewDescriptor, collapsed, index, size } of added) { + const pane = this.createView(viewDescriptor, + { + id: viewDescriptor.id, + title: viewDescriptor.name, + actionRunner: this.getActionRunner(), + expanded: !collapsed + }); + + pane.render(); + const contextMenuDisposable = addDisposableListener(pane.draggableElement, 'contextmenu', e => { + e.stopPropagation(); + e.preventDefault(); + this.onContextMenu(new StandardMouseEvent(e), viewDescriptor); + }); + + const collapseDisposable = Event.latch(Event.map(pane.onDidChange, () => !pane.isExpanded()))(collapsed => { + this.viewsModel.setCollapsed(viewDescriptor.id, collapsed); + }); + + this.viewDisposables.splice(index, 0, combinedDisposable(contextMenuDisposable, collapseDisposable)); + panesToAdd.push({ pane, size: size || pane.minimumSize, index }); + } + + this.addPanes(panesToAdd); + this.restoreViewSizes(); + + const panes: ViewPane[] = []; + for (const { pane } of panesToAdd) { + pane.setVisible(this.isVisible()); + panes.push(pane); + } + return panes; + } + + getActionRunner(): IActionRunner { + if (!this.actionRunner) { + this.actionRunner = new ActionRunner(); + } + + return this.actionRunner; + } + + private onDidRemoveViews(removed: IViewDescriptorRef[]): void { + removed = removed.sort((a, b) => b.index - a.index); + const panesToRemove: ViewPane[] = []; + for (const { index } of removed) { + const [disposable] = this.viewDisposables.splice(index, 1); + disposable.dispose(); + panesToRemove.push(this.panes[index]); + } + this.removePanes(panesToRemove); + dispose(panesToRemove); + } + + protected toggleViewVisibility(viewId: string): void { + const visible = !this.viewsModel.isVisible(viewId); + type ViewsToggleVisibilityClassification = { + viewId: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + visible: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + }; + this.telemetryService.publicLog2<{ viewId: String, visible: boolean }, ViewsToggleVisibilityClassification>('views.toggleVisibility', { viewId, visible }); + this.viewsModel.setVisible(viewId, visible); + } + + + private addPane(pane: ViewPane, size: number, index = this.paneItems.length - 1): void { + const onDidFocus = pane.onDidFocus(() => this.lastFocusedPane = pane); + const onDidChangeTitleArea = pane.onDidChangeTitleArea(() => { + if (this.isSingleView()) { + this.updateTitleArea(); + } + }); + const onDidChange = pane.onDidChange(() => { + if (pane === this.lastFocusedPane && !pane.isExpanded()) { + this.lastFocusedPane = undefined; + } + }); + + // TODO@sbatten Styling is viewlet specific, must fix + const paneStyler = attachStyler(this.themeService, { + headerForeground: SIDE_BAR_SECTION_HEADER_FOREGROUND, + headerBackground: SIDE_BAR_SECTION_HEADER_BACKGROUND, + headerBorder: SIDE_BAR_SECTION_HEADER_BORDER, + dropBackground: SIDE_BAR_DRAG_AND_DROP_BACKGROUND + }, pane); + const disposable = combinedDisposable(onDidFocus, onDidChangeTitleArea, paneStyler, onDidChange); + const paneItem: IViewPaneItem = { pane: pane, disposable }; + + this.paneItems.splice(index, 0, paneItem); + assertIsDefined(this.paneview).addPane(pane, size, index); + } + + removePanes(panes: ViewPane[]): void { + const wasSingleView = this.isSingleView(); + + panes.forEach(pane => this.removePane(pane)); + + this.updateViewHeaders(); + if (wasSingleView !== this.isSingleView()) { + this.updateTitleArea(); + } + } + + private removePane(pane: ViewPane): void { + const index = firstIndex(this.paneItems, i => i.pane === pane); + + if (index === -1) { + return; + } + + if (this.lastFocusedPane === pane) { + this.lastFocusedPane = undefined; + } + + assertIsDefined(this.paneview).removePane(pane); + const [paneItem] = this.paneItems.splice(index, 1); + paneItem.disposable.dispose(); + + } + + movePane(from: ViewPane, to: ViewPane): void { + const fromIndex = firstIndex(this.paneItems, item => item.pane === from); + const toIndex = firstIndex(this.paneItems, item => item.pane === to); + + const fromViewDescriptor = this.viewsModel.visibleViewDescriptors[fromIndex]; + const toViewDescriptor = this.viewsModel.visibleViewDescriptors[toIndex]; + + if (fromIndex < 0 || fromIndex >= this.paneItems.length) { + return; + } + + if (toIndex < 0 || toIndex >= this.paneItems.length) { + return; + } + + const [paneItem] = this.paneItems.splice(fromIndex, 1); + this.paneItems.splice(toIndex, 0, paneItem); + + assertIsDefined(this.paneview).movePane(from, to); + + this.viewsModel.move(fromViewDescriptor.id, toViewDescriptor.id); + } + + resizePane(pane: ViewPane, size: number): void { + assertIsDefined(this.paneview).resizePane(pane, size); + } + + getPaneSize(pane: ViewPane): number { + return assertIsDefined(this.paneview).getPaneSize(pane); + } + + protected updateViewHeaders(): void { + if (this.isSingleView()) { + this.paneItems[0].pane.setExpanded(true); + this.paneItems[0].pane.headerVisible = false; + } else { + this.paneItems.forEach(i => i.pane.headerVisible = true); + } + } + + protected isSingleView(): boolean { + if (!(this.options.showHeaderInTitleWhenSingleView && this.paneItems.length === 1)) { + return false; + } + if (!this.areExtensionsReady) { + if (this.visibleViewsCountFromCache === undefined) { + return false; + } + // Check in cache so that view do not jump. See #29609 + return this.visibleViewsCountFromCache === 1; + } + return true; + } + + dispose(): void { + super.dispose(); + this.paneItems.forEach(i => i.disposable.dispose()); + if (this.paneview) { + this.paneview.dispose(); + } + } +} + + diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index 13968eb74c9..fa22f5d0b97 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -4,330 +4,30 @@ *--------------------------------------------------------------------------------------------*/ import * as DOM from 'vs/base/browser/dom'; -import { dispose, IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { IAction } from 'vs/base/common/actions'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; -import { firstIndex } from 'vs/base/common/arrays'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { IViewDescriptor, IViewsViewlet, IViewContainersRegistry, Extensions as ViewContainerExtensions, IView } from 'vs/workbench/common/views'; +import { IViewDescriptor } from 'vs/workbench/common/views'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { IStorageService } from 'vs/platform/storage/common/storage'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; -import { PaneViewlet, ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; -import { DefaultPaneDndController } from 'vs/base/browser/ui/splitview/paneview'; +import { ViewPaneContainer, ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService'; import { IWorkbenchThemeService, IFileIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/browser/tree'; import { Event } from 'vs/base/common/event'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; -import { localize } from 'vs/nls'; -import { IAddedViewDescriptorRef, IViewDescriptorRef, PersistentContributableViewsModel } from 'vs/workbench/browser/parts/views/views'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { MementoObject } from 'vs/workbench/common/memento'; +import { IAddedViewDescriptorRef } from 'vs/workbench/browser/parts/views/views'; -export interface IViewletViewOptions extends IViewletPaneOptions { - viewletState: MementoObject; +export interface IViewletViewOptions extends IViewPaneOptions { } -export abstract class ViewContainerViewlet extends PaneViewlet implements IViewsViewlet { - - private readonly viewletState: MementoObject; - private didLayout = false; - private dimension: DOM.Dimension | undefined; - private areExtensionsReady: boolean = false; - - private readonly visibleViewsCountFromCache: number | undefined; - private readonly visibleViewsStorageId: string; - protected readonly viewsModel: PersistentContributableViewsModel; - private viewDisposables: IDisposable[] = []; - - constructor( - id: string, - viewletStateStorageId: string, - showHeaderInTitleWhenSingleView: boolean, - @IConfigurationService configurationService: IConfigurationService, - @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, - @ITelemetryService telemetryService: ITelemetryService, - @IStorageService protected storageService: IStorageService, - @IInstantiationService protected instantiationService: IInstantiationService, - @IThemeService themeService: IThemeService, - @IContextMenuService protected contextMenuService: IContextMenuService, - @IExtensionService protected extensionService: IExtensionService, - @IWorkspaceContextService protected contextService: IWorkspaceContextService - ) { - super(id, { showHeaderInTitleWhenSingleView, dnd: new DefaultPaneDndController() }, configurationService, layoutService, contextMenuService, telemetryService, themeService, storageService); - - const container = Registry.as(ViewContainerExtensions.ViewContainersRegistry).get(id); - if (!container) { - throw new Error('Could not find container'); - } - this.viewsModel = this._register(this.instantiationService.createInstance(PersistentContributableViewsModel, container, viewletStateStorageId)); - this.viewletState = this.getMemento(StorageScope.WORKSPACE); - - this.visibleViewsStorageId = `${id}.numberOfVisibleViews`; - this.visibleViewsCountFromCache = this.storageService.getNumber(this.visibleViewsStorageId, StorageScope.WORKSPACE, undefined); - this._register(toDisposable(() => this.viewDisposables = dispose(this.viewDisposables))); - } - - create(parent: HTMLElement): void { - super.create(parent); - this._register(this.onDidSashChange(() => this.saveViewSizes())); - this.viewsModel.onDidAdd(added => this.onDidAddViews(added)); - this.viewsModel.onDidRemove(removed => this.onDidRemoveViews(removed)); - const addedViews: IAddedViewDescriptorRef[] = this.viewsModel.visibleViewDescriptors.map((viewDescriptor, index) => { - const size = this.viewsModel.getSize(viewDescriptor.id); - const collapsed = this.viewsModel.isCollapsed(viewDescriptor.id); - return ({ viewDescriptor, index, size, collapsed }); - }); - if (addedViews.length) { - this.onDidAddViews(addedViews); - } - - // Update headers after and title contributed views after available, since we read from cache in the beginning to know if the viewlet has single view or not. Ref #29609 - this.extensionService.whenInstalledExtensionsRegistered().then(() => { - this.areExtensionsReady = true; - if (this.panes.length) { - this.updateTitleArea(); - this.updateViewHeaders(); - } - }); - - this.focus(); - } - - getContextMenuActions(viewDescriptor?: IViewDescriptor): IAction[] { - const result: IAction[] = []; - if (viewDescriptor) { - result.push({ - id: `${viewDescriptor.id}.removeView`, - label: localize('hideView', "Hide"), - enabled: viewDescriptor.canToggleVisibility, - run: () => this.toggleViewVisibility(viewDescriptor.id) - }); - } - const viewToggleActions = this.viewsModel.viewDescriptors.map(viewDescriptor => ({ - id: `${viewDescriptor.id}.toggleVisibility`, - label: viewDescriptor.name, - checked: this.viewsModel.isVisible(viewDescriptor.id), - enabled: viewDescriptor.canToggleVisibility, - run: () => this.toggleViewVisibility(viewDescriptor.id) - })); - - if (result.length && viewToggleActions.length) { - result.push(new Separator()); - } - result.push(...viewToggleActions); - - const parentActions = this.getViewletContextMenuActions(); - if (result.length && parentActions.length) { - result.push(new Separator()); - } - result.push(...parentActions); - - return result; - } - - protected getViewletContextMenuActions() { - return super.getContextMenuActions(); - } - - setVisible(visible: boolean): void { - super.setVisible(visible); - this.panes.filter(view => view.isVisible() !== visible) - .map((view) => view.setVisible(visible)); - } - - openView(id: string, focus?: boolean): IView { - if (focus) { - this.focus(); - } - let view = this.getView(id); - if (!view) { - this.toggleViewVisibility(id); - } - view = this.getView(id)!; - view.setExpanded(true); - if (focus) { - view.focus(); - } - return view; - } - - movePane(from: ViewletPane, to: ViewletPane): void { - const fromIndex = firstIndex(this.panes, pane => pane === from); - const toIndex = firstIndex(this.panes, pane => pane === to); - const fromViewDescriptor = this.viewsModel.visibleViewDescriptors[fromIndex]; - const toViewDescriptor = this.viewsModel.visibleViewDescriptors[toIndex]; - - super.movePane(from, to); - this.viewsModel.move(fromViewDescriptor.id, toViewDescriptor.id); - } - - layout(dimension: DOM.Dimension): void { - super.layout(dimension); - this.dimension = dimension; - if (this.didLayout) { - this.saveViewSizes(); - } else { - this.didLayout = true; - this.restoreViewSizes(); - } - } - - getOptimalWidth(): number { - const additionalMargin = 16; - const optimalWidth = Math.max(...this.panes.map(view => view.getOptimalWidth() || 0)); - return optimalWidth + additionalMargin; - } - - protected isSingleView(): boolean { - if (!super.isSingleView()) { - return false; - } - if (!this.areExtensionsReady) { - if (this.visibleViewsCountFromCache === undefined) { - return false; - } - // Check in cache so that view do not jump. See #29609 - return this.visibleViewsCountFromCache === 1; - } - return true; - } - - protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewletPane { - return (this.instantiationService as any).createInstance(viewDescriptor.ctorDescriptor.ctor, ...(viewDescriptor.ctorDescriptor.arguments || []), options) as ViewletPane; - } - - protected getView(id: string): ViewletPane | undefined { - return this.panes.filter(view => view.id === id)[0]; - } - - protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPane[] { - const panesToAdd: { pane: ViewletPane, size: number, index: number }[] = []; - for (const { viewDescriptor, collapsed, index, size } of added) { - const pane = this.createView(viewDescriptor, - { - id: viewDescriptor.id, - title: viewDescriptor.name, - actionRunner: this.getActionRunner(), - expanded: !collapsed, - viewletState: this.viewletState - }); - pane.render(); - const contextMenuDisposable = DOM.addDisposableListener(pane.draggableElement, 'contextmenu', e => { - e.stopPropagation(); - e.preventDefault(); - this.onContextMenu(new StandardMouseEvent(e), viewDescriptor); - }); - - const collapseDisposable = Event.latch(Event.map(pane.onDidChange, () => !pane.isExpanded()))(collapsed => { - this.viewsModel.setCollapsed(viewDescriptor.id, collapsed); - }); - - this.viewDisposables.splice(index, 0, combinedDisposable(contextMenuDisposable, collapseDisposable)); - panesToAdd.push({ pane, size: size || pane.minimumSize, index }); - } - - this.addPanes(panesToAdd); - this.restoreViewSizes(); - - const panes: ViewletPane[] = []; - for (const { pane } of panesToAdd) { - pane.setVisible(this.isVisible()); - panes.push(pane); - } - return panes; - } - - private onDidRemoveViews(removed: IViewDescriptorRef[]): void { - removed = removed.sort((a, b) => b.index - a.index); - const panesToRemove: ViewletPane[] = []; - for (const { index } of removed) { - const [disposable] = this.viewDisposables.splice(index, 1); - disposable.dispose(); - panesToRemove.push(this.panes[index]); - } - this.removePanes(panesToRemove); - dispose(panesToRemove); - } - - private onContextMenu(event: StandardMouseEvent, viewDescriptor: IViewDescriptor): void { - event.stopPropagation(); - event.preventDefault(); - - const actions: IAction[] = this.getContextMenuActions(viewDescriptor); - - let anchor: { x: number, y: number } = { x: event.posx, y: event.posy }; - this.contextMenuService.showContextMenu({ - getAnchor: () => anchor, - getActions: () => actions - }); - } - - protected toggleViewVisibility(viewId: string): void { - const visible = !this.viewsModel.isVisible(viewId); - type ViewsToggleVisibilityClassification = { - viewId: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; - visible: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; - }; - this.telemetryService.publicLog2<{ viewId: String, visible: boolean }, ViewsToggleVisibilityClassification>('views.toggleVisibility', { viewId, visible }); - this.viewsModel.setVisible(viewId, visible); - } - - private saveViewSizes(): void { - // Save size only when the layout has happened - if (this.didLayout) { - for (const view of this.panes) { - this.viewsModel.setSize(view.id, this.getPaneSize(view)); - } - } - } - - private restoreViewSizes(): void { - // Restore sizes only when the layout has happened - if (this.didLayout) { - let initialSizes; - for (let i = 0; i < this.viewsModel.visibleViewDescriptors.length; i++) { - const pane = this.panes[i]; - const viewDescriptor = this.viewsModel.visibleViewDescriptors[i]; - const size = this.viewsModel.getSize(viewDescriptor.id); - - if (typeof size === 'number') { - this.resizePane(pane, size); - } else { - initialSizes = initialSizes ? initialSizes : this.computeInitialSizes(); - this.resizePane(pane, initialSizes.get(pane.id) || 200); - } - } - } - } - - private computeInitialSizes(): Map { - const sizes: Map = new Map(); - if (this.dimension) { - const totalWeight = this.viewsModel.visibleViewDescriptors.reduce((totalWeight, { weight }) => totalWeight + (weight || 20), 0); - for (const viewDescriptor of this.viewsModel.visibleViewDescriptors) { - sizes.set(viewDescriptor.id, this.dimension.height * (viewDescriptor.weight || 20) / totalWeight); - } - } - return sizes; - } - - protected saveState(): void { - this.panes.forEach((view) => view.saveState()); - this.storageService.store(this.visibleViewsStorageId, this.length, StorageScope.WORKSPACE); - - super.saveState(); - } -} - -export abstract class FilterViewContainerViewlet extends ViewContainerViewlet { +export abstract class FilterViewPaneContainer extends ViewPaneContainer { private constantViewDescriptors: Map = new Map(); private allViews: Map> = new Map(); private filterValue: string | undefined; @@ -345,7 +45,8 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet { @IExtensionService extensionService: IExtensionService, @IWorkspaceContextService contextService: IWorkspaceContextService ) { - super(viewletId, `${viewletId}.state`, false, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + + super(viewletId, `${viewletId}.state`, { showHeaderInTitleWhenSingleView: false }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this._register(onDidChangeFilterValue(newFilterValue => { this.filterValue = newFilterValue; this.onFilterChanged(newFilterValue); @@ -397,7 +98,7 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet { })); result.push(...viewToggleActions); - const parentActions = this.getViewletContextMenuActions(); + const parentActions = super.getContextMenuActions(); if (viewToggleActions.length && parentActions.length) { result.push(new Separator()); } @@ -423,8 +124,8 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet { return views; } - onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPane[] { - const panes: ViewletPane[] = super.onDidAddViews(added); + onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] { + const panes: ViewPane[] = super.onDidAddViews(added); for (let i = 0; i < added.length; i++) { if (this.constantViewDescriptors.has(added[i].viewDescriptor.id)) { panes[i].setExpanded(false); diff --git a/src/vs/workbench/browser/viewlet.ts b/src/vs/workbench/browser/viewlet.ts index 2e4c2f168e1..2ea6bcae00f 100644 --- a/src/vs/workbench/browser/viewlet.ts +++ b/src/vs/workbench/browser/viewlet.ts @@ -9,45 +9,57 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { Action, IAction } from 'vs/base/common/actions'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IViewlet } from 'vs/workbench/common/viewlet'; -import { Composite, CompositeDescriptor, CompositeRegistry } from 'vs/workbench/browser/composite'; -import { IConstructorSignature0, BrandedService } from 'vs/platform/instantiation/common/instantiation'; +import { CompositeDescriptor, CompositeRegistry } from 'vs/workbench/browser/composite'; +import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation'; import { ToggleSidebarVisibilityAction, ToggleSidebarPositionAction } from 'vs/workbench/browser/actions/layoutActions'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { URI } from 'vs/base/common/uri'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree'; import { AbstractTree } from 'vs/base/browser/ui/tree/abstractTree'; import { assertIsDefined } from 'vs/base/common/types'; +import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; +import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; +import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { PaneComposite } from 'vs/workbench/browser/panecomposite'; +import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; -export abstract class Viewlet extends Composite implements IViewlet { +export abstract class Viewlet extends PaneComposite implements IViewlet { constructor(id: string, - protected configurationService: IConfigurationService, - private layoutService: IWorkbenchLayoutService, - telemetryService: ITelemetryService, - themeService: IThemeService, - storageService: IStorageService + viewPaneContainer: ViewPaneContainer, + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService ) { - super(id, telemetryService, themeService, storageService); - } - - getOptimalWidth(): number | undefined { - return undefined; + super(id, viewPaneContainer, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); } getContextMenuActions(): IAction[] { + const parentActions = [...super.getContextMenuActions()]; + if (parentActions.length) { + parentActions.push(new Separator()); + } + const toggleSidebarPositionAction = new ToggleSidebarPositionAction(ToggleSidebarPositionAction.ID, ToggleSidebarPositionAction.getLabel(this.layoutService), this.layoutService, this.configurationService); - return [toggleSidebarPositionAction, - { - id: ToggleSidebarVisibilityAction.ID, - label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"), - enabled: true, - run: () => this.layoutService.setSideBarHidden(true) - }]; + return [...parentActions, toggleSidebarPositionAction, + { + id: ToggleSidebarVisibilityAction.ID, + label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"), + enabled: true, + run: () => this.layoutService.setSideBarHidden(true) + }]; } } @@ -64,6 +76,7 @@ export class ViewletDescriptor extends CompositeDescriptor { order?: number, iconUrl?: URI ): ViewletDescriptor { + return new ViewletDescriptor(ctor as IConstructorSignature0, id, name, cssClass, order, iconUrl); } diff --git a/src/vs/workbench/common/panecomposite.ts b/src/vs/workbench/common/panecomposite.ts new file mode 100644 index 00000000000..3c6de0c3a60 --- /dev/null +++ b/src/vs/workbench/common/panecomposite.ts @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IView } from 'vs/workbench/common/views'; +import { IComposite } from 'vs/workbench/common/composite'; +import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; + +export interface IPaneComposite extends IComposite { + openView(id: string, focus?: boolean): IView; + getViewPaneContainer(): IViewPaneContainer; + saveState(): void; +} diff --git a/src/vs/workbench/common/viewPaneContainer.ts b/src/vs/workbench/common/viewPaneContainer.ts new file mode 100644 index 00000000000..0c8f841fd6e --- /dev/null +++ b/src/vs/workbench/common/viewPaneContainer.ts @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IAction, IActionViewItem } from 'vs/base/common/actions'; + +export interface IViewPaneContainer { + setVisible(visible: boolean): void; + isVisible(): boolean; + focus(): void; + getActions(): IAction[]; + getSecondaryActions(): IAction[]; + getActionViewItem(action: IAction): IActionViewItem | undefined; + saveState(): void; +} diff --git a/src/vs/workbench/common/viewlet.ts b/src/vs/workbench/common/viewlet.ts index 01fafea5968..46965e94031 100644 --- a/src/vs/workbench/common/viewlet.ts +++ b/src/vs/workbench/common/viewlet.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IComposite } from 'vs/workbench/common/composite'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; +import { IPaneComposite } from 'vs/workbench/common/panecomposite'; export const SideBarVisibleContext = new RawContextKey('sideBarVisible', false); export const SidebarFocusContext = new RawContextKey('sideBarFocus', false); export const ActiveViewletContext = new RawContextKey('activeViewlet', ''); -export interface IViewlet extends IComposite { +export interface IViewlet extends IPaneComposite { /** * Returns the minimal width needed to avoid any content horizontal truncation diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index 7f277994bb7..4e5c9e5de43 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -28,7 +28,7 @@ import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { ILabelService } from 'vs/platform/label/common/label'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; @@ -45,7 +45,7 @@ function createCheckbox(): HTMLInputElement { return checkbox; } -export class BreakpointsView extends ViewletPane { +export class BreakpointsView extends ViewPane { private static readonly MAX_VISIBLE_FILES = 9; private list!: WorkbenchList; @@ -63,7 +63,7 @@ export class BreakpointsView extends ViewletPane { @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this.minimumBodySize = this.maximumBodySize = this.getExpandedBodySize(); this._register(this.debugService.getModel().onDidChangeBreakpoints(() => this.onBreakpointsChange())); diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index b9c33fb09fa..879ab556c07 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -18,7 +18,7 @@ import { IAction, Action } from 'vs/base/common/actions'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { ILabelService } from 'vs/platform/label/common/label'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; @@ -53,8 +53,7 @@ function getContext(element: CallStackItem | null): any { } : undefined; } -export class CallStackView extends ViewletPane { - +export class CallStackView extends ViewPane { private pauseMessage!: HTMLSpanElement; private pauseMessageLabel!: HTMLSpanElement; private onCallStackChangeScheduler: RunOnceScheduler; @@ -79,7 +78,7 @@ export class CallStackView extends ViewletPane { @IMenuService menuService: IMenuService, @IContextKeyService readonly contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService); this.contributedContextMenu = menuService.createMenu(MenuId.DebugCallStackContext, contextKeyService); diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index 2ee642b2c86..ae27dbd0f82 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -35,7 +35,6 @@ import { IViewsRegistry, Extensions as ViewExtensions } from 'vs/workbench/commo import { isMacintosh } from 'vs/base/common/platform'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { URI } from 'vs/base/common/uri'; -import { DebugViewlet } from 'vs/workbench/contrib/debug/browser/debugViewlet'; import { DebugQuickOpenHandler } from 'vs/workbench/contrib/debug/browser/debugQuickOpen'; import { DebugStatusContribution } from 'vs/workbench/contrib/debug/browser/debugStatus'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; @@ -48,6 +47,7 @@ import { VariablesView } from 'vs/workbench/contrib/debug/browser/variablesView' import { ClearReplAction, Repl } from 'vs/workbench/contrib/debug/browser/repl'; import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider'; import { DebugCallStackContribution } from 'vs/workbench/contrib/debug/browser/debugCallStackContribution'; +import { DebugViewlet } from 'vs/workbench/contrib/debug/browser/debugViewlet'; import { StartView } from 'vs/workbench/contrib/debug/browser/startView'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 2b0cd1b2845..e0aedfd64ac 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -11,7 +11,7 @@ import { IListService } from 'vs/platform/list/browser/listService'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, CONTEXT_BREAKPOINT_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, REPL_ID, IDebugConfiguration, CONTEXT_JUMP_TO_CURSOR_SUPPORTED } from 'vs/workbench/contrib/debug/common/debug'; import { Expression, Variable, Breakpoint, FunctionBreakpoint, DataBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel'; -import { IExtensionsViewlet, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ICodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; @@ -470,7 +470,7 @@ export function registerCommands(): void { primary: undefined, handler: async (accessor) => { const viewletService = accessor.get(IViewletService); - const viewlet = await viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true) as IExtensionsViewlet; + const viewlet = (await viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer; viewlet.search('tag:debuggers @sort:installs'); viewlet.focus(); } diff --git a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts index d84b2cff137..6b3ab5e7ec2 100644 --- a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts @@ -8,7 +8,6 @@ import * as nls from 'vs/nls'; import { IAction } from 'vs/base/common/actions'; import * as DOM from 'vs/base/browser/dom'; import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; -import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IDebugService, VIEWLET_ID, State, BREAKPOINTS_VIEW_ID, IDebugConfiguration, REPL_ID, CONTEXT_DEBUG_UX, CONTEXT_DEBUG_UX_KEY } from 'vs/workbench/contrib/debug/common/debug'; import { StartAction, ConfigureAction, SelectAndStartAction, FocusSessionAction } from 'vs/workbench/contrib/debug/browser/debugActions'; import { StartDebugActionViewItem, FocusSessionActionViewItem } from 'vs/workbench/contrib/debug/browser/debugActionViewItems'; @@ -26,20 +25,38 @@ import { memoize } from 'vs/base/common/decorators'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IMenu, MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { MenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { TogglePanelAction } from 'vs/workbench/browser/panel'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; +import { Viewlet } from 'vs/workbench/browser/viewlet'; import { StartView } from 'vs/workbench/contrib/debug/browser/startView'; -export class DebugViewlet extends ViewContainerViewlet { +// Register a lightweight viewlet responsible for making the container +export class DebugViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(DebugViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class DebugViewPaneContainer extends ViewPaneContainer { private startDebugActionViewItem: StartDebugActionViewItem | undefined; private progressResolve: (() => void) | undefined; - private breakpointView: ViewletPane | undefined; + private breakpointView: ViewPane | undefined; private paneListeners = new Map(); private debugToolBarMenu: IMenu | undefined; private disposeOnTitleUpdate: IDisposable | undefined; @@ -62,7 +79,7 @@ export class DebugViewlet extends ViewContainerViewlet { @IContextKeyService private readonly contextKeyService: IContextKeyService, @INotificationService private readonly notificationService: INotificationService ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: false }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state))); this._register(this.debugService.onDidNewSession(() => this.updateToolBar())); @@ -198,7 +215,7 @@ export class DebugViewlet extends ViewContainerViewlet { } } - addPanes(panes: { pane: ViewletPane, size: number, index?: number }[]): void { + addPanes(panes: { pane: ViewPane, size: number, index?: number }[]): void { super.addPanes(panes); for (const { pane: pane } of panes) { @@ -212,7 +229,7 @@ export class DebugViewlet extends ViewContainerViewlet { } } - removePanes(panes: ViewletPane[]): void { + removePanes(panes: ViewPane[]): void { super.removePanes(panes); for (const pane of panes) { dispose(this.paneListeners.get(pane.id)); diff --git a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts index c825a856bdd..0866f659ed8 100644 --- a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts +++ b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts @@ -7,7 +7,7 @@ import * as nls from 'vs/nls'; import * as dom from 'vs/base/browser/dom'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { normalize, isAbsolute, posix } from 'vs/base/common/path'; -import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -388,7 +388,7 @@ class SessionTreeItem extends BaseTreeItem { } } -export class LoadedScriptsView extends ViewletPane { +export class LoadedScriptsView extends ViewPane { private treeContainer!: HTMLElement; private loadedScriptsItemType: IContextKey; @@ -411,7 +411,7 @@ export class LoadedScriptsView extends ViewletPane { @IDebugService private readonly debugService: IDebugService, @ILabelService private readonly labelService: ILabelService ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService); } diff --git a/src/vs/workbench/contrib/debug/browser/startView.ts b/src/vs/workbench/contrib/debug/browser/startView.ts index 6b37030b8a9..04a73b0eca6 100644 --- a/src/vs/workbench/contrib/debug/browser/startView.ts +++ b/src/vs/workbench/contrib/debug/browser/startView.ts @@ -11,7 +11,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { localize } from 'vs/nls'; import { ICommandService } from 'vs/platform/commands/common/commands'; @@ -21,11 +20,13 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { equals } from 'vs/base/common/arrays'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; const $ = dom.$; -export class StartView extends ViewletPane { + +export class StartView extends ViewPane { static ID = 'workbench.debug.startView'; static LABEL = localize('start', "Start"); @@ -50,7 +51,7 @@ export class StartView extends ViewletPane { @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IFileDialogService private readonly dialogService: IFileDialogService ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this._register(editorService.onDidActiveEditorChange(() => this.updateView())); this._register(this.debugService.getConfigurationManager().onDidRegisterDebugger(() => this.updateView())); } diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index fb82b157b50..d94bbb7b945 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -17,7 +17,7 @@ import { IAction, Action } from 'vs/base/common/actions'; import { CopyValueAction } from 'vs/workbench/contrib/debug/browser/debugActions'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { ITreeRenderer, ITreeNode, ITreeMouseEvent, ITreeContextMenuEvent, IAsyncDataSource } from 'vs/base/browser/ui/tree/tree'; @@ -37,7 +37,7 @@ let forgetScopes = true; export const variableSetEmitter = new Emitter(); -export class VariablesView extends ViewletPane { +export class VariablesView extends ViewPane { private onFocusStackFrameScheduler: RunOnceScheduler; private needsRefresh = false; @@ -54,7 +54,7 @@ export class VariablesView extends ViewletPane { @IClipboardService private readonly clipboardService: IClipboardService, @IContextKeyService contextKeyService: IContextKeyService ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); // Use scheduler to prevent unnecessary flashing this.onFocusStackFrameScheduler = new RunOnceScheduler(async () => { diff --git a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts index 23928662699..1ad39a9bf8a 100644 --- a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts +++ b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts @@ -18,7 +18,7 @@ import { IAction, Action } from 'vs/base/common/actions'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { renderExpressionValue, renderViewTree, IInputBoxOptions, AbstractExpressionsRenderer, IExpressionTemplateData } from 'vs/workbench/contrib/debug/browser/baseDebugView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService'; @@ -34,7 +34,7 @@ import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024; -export class WatchExpressionsView extends ViewletPane { +export class WatchExpressionsView extends ViewPane { private onWatchExpressionsUpdatedScheduler: RunOnceScheduler; private needsRefresh = false; @@ -49,7 +49,7 @@ export class WatchExpressionsView extends ViewletPane { @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this.onWatchExpressionsUpdatedScheduler = new RunOnceScheduler(() => { this.needsRefresh = false; diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 88ac5aa6786..06639384c6c 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -20,12 +20,12 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IDisposable } from 'vs/base/common/lifecycle'; -import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views'; -import { Registry } from 'vs/platform/registry/common/platform'; import { TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks'; import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { Extensions as ViewContainerExtensions, IViewContainersRegistry, ViewContainer } from 'vs/workbench/common/views'; +import { Registry } from 'vs/platform/registry/common/platform'; export const VIEWLET_ID = 'workbench.view.debug'; export const VIEW_CONTAINER: ViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID); diff --git a/src/vs/workbench/contrib/experiments/browser/experimentalPrompt.ts b/src/vs/workbench/contrib/experiments/browser/experimentalPrompt.ts index b8ded4b910a..627af58fb9c 100644 --- a/src/vs/workbench/contrib/experiments/browser/experimentalPrompt.ts +++ b/src/vs/workbench/contrib/experiments/browser/experimentalPrompt.ts @@ -7,7 +7,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { INotificationService, Severity, IPromptChoice } from 'vs/platform/notification/common/notification'; import { IExperimentService, IExperiment, ExperimentActionType, IExperimentActionPromptProperties, IExperimentActionPromptCommand, ExperimentState } from 'vs/workbench/contrib/experiments/common/experimentService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IExtensionsViewlet } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { Disposable } from 'vs/base/common/lifecycle'; import { language } from 'vs/base/common/platform'; @@ -71,7 +71,7 @@ export class ExperimentalPrompts extends Disposable implements IWorkbenchContrib this.openerService.open(URI.parse(command.externalLink)); } else if (command.curatedExtensionsKey && Array.isArray(command.curatedExtensionsList)) { this.viewletService.openViewlet('workbench.view.extensions', true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { if (viewlet) { viewlet.search('curated:' + command.curatedExtensionsKey); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index f302a97cfc7..c3dd4df0b90 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -23,7 +23,7 @@ import { IExtensionTipsService } from 'vs/workbench/services/extensionManagement import { IExtensionManifest, IKeyBinding, IView, IViewContainer, ExtensionType } from 'vs/platform/extensions/common/extensions'; import { ResolvedKeybinding, KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput'; -import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, IExtension, ExtensionContainers } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsWorkbenchService, IExtensionsViewPaneContainer, VIEWLET_ID, IExtension, ExtensionContainers } from 'vs/workbench/contrib/extensions/common/extensions'; import { RatingsWidget, InstallCountWidget, RemoteBadgeWidget } from 'vs/workbench/contrib/extensions/browser/extensionsWidgets'; import { EditorOptions } from 'vs/workbench/common/editor'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; @@ -365,7 +365,7 @@ export class ExtensionEditor extends BaseEditor { this.transientDisposables.add(this.onClick(template.rating, () => this.openerService.open(URI.parse(`${extension.url}#review-details`)))); this.transientDisposables.add(this.onClick(template.publisher, () => { this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => viewlet.search(`publisher:"${extension.publisherDisplayName}"`)); })); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 3d934b3d584..598b849ed37 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -19,7 +19,7 @@ import { ShowRecommendedExtensionsAction, InstallWorkspaceRecommendedExtensionsA import Severity from 'vs/base/common/severity'; import { IWorkspaceContextService, IWorkspaceFolder, IWorkspace, IWorkspaceFoldersChangeEvent, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IFileService } from 'vs/platform/files/common/files'; -import { IExtensionsConfiguration, ConfigurationKey, ShowRecommendationsOnlyOnDemandKey, IExtensionsViewlet, IExtensionsWorkbenchService, EXTENSIONS_CONFIG } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsConfiguration, ConfigurationKey, ShowRecommendationsOnlyOnDemandKey, IExtensionsViewPaneContainer, IExtensionsWorkbenchService, EXTENSIONS_CONFIG } from 'vs/workbench/contrib/extensions/common/extensions'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { flatten, distinct, shuffle, coalesce } from 'vs/base/common/arrays'; @@ -889,7 +889,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe */ this.telemetryService.publicLog('fileExtensionSuggestion:popup', { userReaction: 'ok', fileExtension: fileExtension }); this.viewletService.openViewlet('workbench.view.extensions', true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(`ext:${fileExtension}`); viewlet.focus(); diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index c624c7956b2..e1527477edd 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -24,7 +24,7 @@ import { import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput'; import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet'; import { ExtensionEditor } from 'vs/workbench/contrib/extensions/browser/extensionEditor'; -import { StatusUpdater, ExtensionsViewlet, MaliciousExtensionChecker, ExtensionsViewletViewsContribution } from 'vs/workbench/contrib/extensions/browser/extensionsViewlet'; +import { StatusUpdater, MaliciousExtensionChecker, ExtensionsViewletViewsContribution, ExtensionsViewlet } from 'vs/workbench/contrib/extensions/browser/extensionsViewlet'; import { IQuickOpenRegistry, Extensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import * as jsonContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 67e7ae28d45..3e4d0427d96 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -13,7 +13,7 @@ import * as json from 'vs/base/common/json'; import { ActionViewItem, Separator, IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionbar'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { dispose, Disposable } from 'vs/base/common/lifecycle'; -import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer, AutoUpdateConfigurationKey, IExtensionContainer, EXTENSIONS_CONFIG } from 'vs/workbench/contrib/extensions/common/extensions'; import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate'; import { ExtensionsLabel, IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, INSTALL_ERROR_NOT_SUPPORTED } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionTipsService, IExtensionRecommendation, IExtensionsConfigContent, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; @@ -1081,7 +1081,7 @@ export class CheckForUpdatesAction extends Action { } this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => viewlet.search('')); this.notificationService.info(msgAvailableExtensions); @@ -1486,7 +1486,7 @@ export class ShowEnabledExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@enabled '); viewlet.focus(); @@ -1509,7 +1509,7 @@ export class ShowInstalledExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@installed '); viewlet.focus(); @@ -1532,7 +1532,7 @@ export class ShowDisabledExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@disabled '); viewlet.focus(); @@ -1563,7 +1563,7 @@ export class ClearExtensionsInputAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(''); viewlet.focus(); @@ -1586,7 +1586,7 @@ export class ShowBuiltInExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@builtin '); viewlet.focus(); @@ -1609,7 +1609,7 @@ export class ShowOutdatedExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@outdated '); viewlet.focus(); @@ -1632,7 +1632,7 @@ export class ShowPopularExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@sort:installs '); viewlet.focus(); @@ -1655,7 +1655,7 @@ export class ShowRecommendedExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@recommended ', true); viewlet.focus(); @@ -1689,7 +1689,7 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@recommended '); viewlet.focus(); @@ -1745,7 +1745,7 @@ export class InstallRecommendedExtensionAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(`@id:${this.extensionId}`); viewlet.focus(); @@ -1827,7 +1827,7 @@ export class ShowRecommendedKeymapExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@recommended:keymaps '); viewlet.focus(); @@ -1850,7 +1850,7 @@ export class ShowLanguageExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@category:"programming languages" @sort:installs '); viewlet.focus(); @@ -1873,7 +1873,7 @@ export class ShowAzureExtensionsAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search('@sort:installs azure '); viewlet.focus(); @@ -1911,7 +1911,7 @@ export class ChangeSortAction extends Action { run(): Promise { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(this.query.toString()); viewlet.focus(); @@ -3166,7 +3166,7 @@ CommandsRegistry.registerCommand('workbench.extensions.action.showExtensionsForL const viewletService = accessor.get(IViewletService); return viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(`ext:${fileExtension.replace(/^\./, '')}`); viewlet.focus(); @@ -3177,7 +3177,7 @@ CommandsRegistry.registerCommand('workbench.extensions.action.showExtensionsWith const viewletService = accessor.get(IViewletService); return viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { const query = extensionIds .map(id => `@id:${id}`) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsQuickOpen.ts b/src/vs/workbench/contrib/extensions/browser/extensionsQuickOpen.ts index a5d47d5c8da..f6b1caa1900 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsQuickOpen.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsQuickOpen.ts @@ -7,7 +7,7 @@ import * as nls from 'vs/nls'; import { IAutoFocus, Mode, IModel } from 'vs/base/parts/quickopen/common/quickOpen'; import { QuickOpenEntry, QuickOpenModel } from 'vs/base/parts/quickopen/browser/quickOpenModel'; import { QuickOpenHandler } from 'vs/workbench/browser/quickopen'; -import { IExtensionsViewlet, VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsViewPaneContainer, VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IExtensionGalleryService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -50,7 +50,7 @@ export class ExtensionsHandler extends QuickOpenHandler { const label = nls.localize('manage', "Press Enter to manage your extensions."); const action = () => { this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(''); viewlet.focus(); @@ -97,7 +97,7 @@ export class GalleryExtensionsHandler extends QuickOpenHandler { const label = nls.localize('install', "Press Enter to install '{0}' from the Marketplace.", text); const action = () => { return this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => viewlet.search(`@id:${text}`)) .then(() => this.extensionsService.installFromGallery(galleryExtension)) .then(undefined, err => this.notificationService.error(err)); @@ -116,7 +116,7 @@ export class GalleryExtensionsHandler extends QuickOpenHandler { const label = nls.localize('searchFor', "Press Enter to search for '{0}' in the Marketplace.", text); const action = () => { this.viewletService.openViewlet(VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(text); viewlet.focus(); @@ -136,4 +136,4 @@ export class GalleryExtensionsHandler extends QuickOpenHandler { getAutoFocus(searchValue: string): IAutoFocus { return { autoFocusFirstEntry: true }; } -} \ No newline at end of file +} diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 4ac7d34337e..32944476223 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -18,7 +18,7 @@ import { append, $, addClass, toggleClass, Dimension } from 'vs/base/browser/dom import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, AutoUpdateConfigurationKey, ShowRecommendationsOnlyOnDemandKey, CloseExtensionDetailsOnViewChangeKey, VIEW_CONTAINER } from '../common/extensions'; +import { IExtensionsWorkbenchService, IExtensionsViewPaneContainer, VIEWLET_ID, AutoUpdateConfigurationKey, ShowRecommendationsOnlyOnDemandKey, CloseExtensionDetailsOnViewChangeKey, VIEW_CONTAINER } from '../common/extensions'; import { ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction, ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction, @@ -46,7 +46,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IAddedViewDescriptorRef } from 'vs/workbench/browser/parts/views/views'; -import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { Query } from 'vs/workbench/contrib/extensions/common/extensionQuery'; import { SuggestEnabledInput, attachSuggestEnabledInputBoxStyler } from 'vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput'; import { alert } from 'vs/base/browser/ui/aria/aria'; @@ -54,10 +54,10 @@ import { createErrorWithActions } from 'vs/base/common/errorsWithActions'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; import { Registry } from 'vs/platform/registry/common/platform'; -import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { RemoteNameContext } from 'vs/workbench/browser/contextkeys'; import { ILabelService } from 'vs/platform/label/common/label'; import { MementoObject } from 'vs/workbench/common/memento'; +import { Viewlet } from 'vs/workbench/browser/viewlet'; const NonEmptyWorkspaceContext = new RawContextKey('nonEmptyWorkspace', false); const DefaultViewsContext = new RawContextKey('defaultExtensionViews', true); @@ -314,7 +314,23 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio } -export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensionsViewlet { +export class ExtensionsViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(ExtensionsViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IExtensionsViewPaneContainer { private readonly _onSearchChange: Emitter = this._register(new Emitter()); private readonly onSearchChange: EventOf = this._onSearchChange.event; @@ -354,7 +370,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService, ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.searchDelayer = new Delayer(500); this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService); @@ -503,7 +519,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio return this.searchBox ? this.searchBox.getValue().replace(/@category/g, 'category').replace(/@tag:/g, 'tag:').replace(/@ext:/g, 'ext:') : ''; } - protected saveState(): void { + saveState(): void { const value = this.searchBox ? this.searchBox.getValue() : ''; if (ExtensionsListView.isLocalExtensionsQuery(value)) { this.searchViewletState['query.value'] = value; @@ -532,7 +548,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio ))).then(() => undefined); } - protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPane[] { + protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] { const addedViews = super.onDidAddViews(added); this.progress(Promise.all(addedViews.map(addedView => (addedView).show(this.normalizedQuery()) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts index 1c3e99c9a7e..5e9036f65b7 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts @@ -32,7 +32,7 @@ import { InstallWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRe import { WorkbenchPagedList } from 'vs/platform/list/browser/listService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { distinct, coalesce } from 'vs/base/common/arrays'; import { IExperimentService, IExperiment, ExperimentActionType } from 'vs/workbench/contrib/experiments/common/experimentService'; @@ -72,7 +72,7 @@ export interface ExtensionsListViewOptions extends IViewletViewOptions { class ExtensionListViewWarning extends Error { } -export class ExtensionsListView extends ViewletPane { +export class ExtensionsListView extends ViewPane { protected readonly server: IExtensionManagementServer | undefined; private bodyTemplate: { @@ -105,7 +105,7 @@ export class ExtensionsListView extends ViewletPane { @IProductService protected readonly productService: IProductService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService); this.server = options.server; } diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index 402f9e0a2fe..373ee7b0430 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -3,26 +3,26 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IViewlet } from 'vs/workbench/common/viewlet'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event } from 'vs/base/common/event'; import { IPager } from 'vs/base/common/paging'; import { IQueryOptions, ILocalExtension, IGalleryExtension, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement'; import { EnablementState, IExtensionManagementServer } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; -import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views'; -import { Registry } from 'vs/platform/registry/common/platform'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Disposable } from 'vs/base/common/lifecycle'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common/extensions'; import { URI } from 'vs/base/common/uri'; +import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; +import { Extensions as ViewContainerExtensions, ViewContainer, IViewContainersRegistry } from 'vs/workbench/common/views'; +import { Registry } from 'vs/platform/registry/common/platform'; export const VIEWLET_ID = 'workbench.view.extensions'; export const VIEW_CONTAINER: ViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID); export const EXTENSIONS_CONFIG = '.vscode/extensions.json'; -export interface IExtensionsViewlet extends IViewlet { +export interface IExtensionsViewPaneContainer extends IViewPaneContainer { search(text: string, refresh?: boolean): void; } diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index f55a3671aea..601ed0673d3 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -7,7 +7,7 @@ import 'vs/css!./media/explorerviewlet'; import { localize } from 'vs/nls'; import * as DOM from 'vs/base/browser/dom'; import { VIEWLET_ID, ExplorerViewletVisibleContext, IFilesConfiguration, OpenEditorsVisibleContext, VIEW_CONTAINER } from 'vs/workbench/contrib/files/common/files'; -import { ViewContainerViewlet, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; +import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; import { ExplorerView } from 'vs/workbench/contrib/files/browser/views/explorerView'; import { EmptyView } from 'vs/workbench/contrib/files/browser/views/emptyView'; @@ -29,11 +29,12 @@ import { DelegatingEditorService } from 'vs/workbench/services/editor/browser/ed import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditor } from 'vs/workbench/common/editor'; -import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { Registry } from 'vs/platform/registry/common/platform'; import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress'; import { withUndefinedAsNull } from 'vs/base/common/types'; +import { Viewlet } from 'vs/workbench/browser/viewlet'; export class ExplorerViewletViewsContribution extends Disposable implements IWorkbenchContribution { @@ -146,7 +147,23 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor } } -export class ExplorerViewlet extends ViewContainerViewlet { +export class ExplorerViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(ExplorerViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class ExplorerViewPaneContainer extends ViewPaneContainer { private static readonly EXPLORER_VIEWS_STATE = 'workbench.explorer.views.state'; @@ -165,7 +182,8 @@ export class ExplorerViewlet extends ViewContainerViewlet { @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService ) { - super(VIEWLET_ID, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + + super(VIEWLET_ID, ExplorerViewPaneContainer.EXPLORER_VIEWS_STATE, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.viewletVisibleContextKey = ExplorerViewletVisibleContext.bindTo(contextKeyService); @@ -177,7 +195,7 @@ export class ExplorerViewlet extends ViewContainerViewlet { DOM.addClass(parent, 'explorer-viewlet'); } - protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewletPane { + protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewPane { if (viewDescriptor.id === ExplorerView.ID) { // Create a delegating editor service for the explorer to be able to delay the refresh in the opened // editors view above. This is a workaround for being able to double click on a file to make it pinned diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 43beeb606fd..d682f3b8d69 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -18,7 +18,7 @@ import { VIEWLET_ID, IExplorerService, IFilesConfiguration } from 'vs/workbench/ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IFileService } from 'vs/platform/files/common/files'; import { toResource, SideBySideEditor } from 'vs/workbench/common/editor'; -import { ExplorerViewlet } from 'vs/workbench/contrib/files/browser/explorerViewlet'; +import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/explorerViewlet'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; @@ -652,7 +652,7 @@ export class CollapseExplorerView extends Action { } async run(): Promise { - const explorerViewlet = await this.viewletService.openViewlet(VIEWLET_ID) as ExplorerViewlet; + const explorerViewlet = (await this.viewletService.openViewlet(VIEWLET_ID))?.getViewPaneContainer() as ExplorerViewPaneContainer; const explorerView = explorerViewlet.getExplorerView(); if (explorerView) { explorerView.collapseAll(); diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index 3dcc31af8e9..b837f81fa5d 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -12,7 +12,7 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { ExplorerFocusCondition, TextFileContentProvider, VIEWLET_ID, IExplorerService, ExplorerCompressedFocusContext, ExplorerCompressedFirstFocusContext, ExplorerCompressedLastFocusContext, FilesExplorerFocusCondition } from 'vs/workbench/contrib/files/common/files'; -import { ExplorerViewlet } from 'vs/workbench/contrib/files/browser/explorerViewlet'; +import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/explorerViewlet'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { toErrorMessage } from 'vs/base/common/errorMessage'; import { IListService } from 'vs/platform/list/browser/listService'; @@ -294,7 +294,7 @@ CommandsRegistry.registerCommand({ const explorerService = accessor.get(IExplorerService); const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IEditorService)); - const viewlet = await viewletService.openViewlet(VIEWLET_ID, false) as ExplorerViewlet; + const viewlet = (await viewletService.openViewlet(VIEWLET_ID, false))?.getViewPaneContainer() as ExplorerViewPaneContainer; if (uri && contextService.isInsideWorkspace(uri)) { const explorerView = viewlet.getExplorerView(); @@ -514,7 +514,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ return; } - const explorer = viewlet as ExplorerViewlet; + const explorer = viewlet.getViewPaneContainer() as ExplorerViewPaneContainer; const view = explorer.getExplorerView(); view.previousCompressedStat(); } @@ -533,7 +533,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ return; } - const explorer = viewlet as ExplorerViewlet; + const explorer = viewlet.getViewPaneContainer() as ExplorerViewPaneContainer; const view = explorer.getExplorerView(); view.nextCompressedStat(); } @@ -552,7 +552,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ return; } - const explorer = viewlet as ExplorerViewlet; + const explorer = viewlet.getViewPaneContainer() as ExplorerViewPaneContainer; const view = explorer.getExplorerView(); view.firstCompressedStat(); } @@ -571,7 +571,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ return; } - const explorer = viewlet as ExplorerViewlet; + const explorer = viewlet.getViewPaneContainer() as ExplorerViewPaneContainer; const view = explorer.getExplorerView(); view.lastCompressedStat(); } diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index 73b686fa6d6..49e1d3a2ca1 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -25,7 +25,7 @@ import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry' import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import * as platform from 'vs/base/common/platform'; -import { ExplorerViewlet, ExplorerViewletViewsContribution } from 'vs/workbench/contrib/files/browser/explorerViewlet'; +import { ExplorerViewletViewsContribution, ExplorerViewlet } from 'vs/workbench/contrib/files/browser/explorerViewlet'; import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index d5d9984613c..a6b958ac5dc 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -16,7 +16,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { ResourcesDropHandler, DragAndDropObserver } from 'vs/workbench/browser/dnd'; import { listDropBackground } from 'vs/platform/theme/common/colorRegistry'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; @@ -26,7 +26,7 @@ import { Schemas } from 'vs/base/common/network'; import { isWeb } from 'vs/base/common/platform'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -export class EmptyView extends ViewletPane { +export class EmptyView extends ViewPane { static readonly ID: string = 'workbench.explorer.emptyView'; static readonly NAME = nls.localize('noWorkspace', "No Folder Opened"); @@ -46,7 +46,7 @@ export class EmptyView extends ViewletPane { @ILabelService private labelService: ILabelService, @IContextKeyService contextKeyService: IContextKeyService ) { - super({ ...(options as IViewletPaneOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this._register(this.contextService.onDidChangeWorkbenchState(() => this.setLabels())); this._register(this.labelService.onDidChangeFormatters(() => this.setLabels())); } diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 6a59c39f7d5..686c81d0a32 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -27,7 +27,7 @@ import { IDecorationsService } from 'vs/workbench/services/decorations/browser/d import { TreeResourceNavigator2, WorkbenchCompressibleAsyncDataTree } from 'vs/platform/list/browser/listService'; import { DelayedDragHandler } from 'vs/base/browser/dnd'; import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; -import { IViewletPaneOptions, ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { IViewPaneOptions, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { ILabelService } from 'vs/platform/label/common/label'; import { ExplorerDelegate, ExplorerDataSource, FilesRenderer, ICompressedNavigationController, FilesFilter, FileSorter, FileDragAndDrop, ExplorerCompressionDelegate, isCompressedFolderName } from 'vs/workbench/contrib/files/browser/views/explorerViewer'; import { IThemeService } from 'vs/platform/theme/common/themeService'; @@ -64,7 +64,7 @@ interface IExplorerViewStyles { listDropBackground?: Color; } -export class ExplorerView extends ViewletPane { +export class ExplorerView extends ViewPane { static readonly ID: string = 'workbench.explorer.fileView'; static readonly TREE_VIEW_STATE_STORAGE_KEY: string = 'workbench.explorer.treeViewState'; @@ -92,7 +92,7 @@ export class ExplorerView extends ViewletPane { private actions: IAction[] | undefined; constructor( - options: IViewletPaneOptions, + options: IViewPaneOptions, @IContextMenuService contextMenuService: IContextMenuService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @@ -112,7 +112,7 @@ export class ExplorerView extends ViewletPane { @IClipboardService private clipboardService: IClipboardService, @IFileService private readonly fileService: IFileService ) { - super({ ...(options as IViewletPaneOptions), id: ExplorerView.ID, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); + super({ ...(options as IViewPaneOptions), id: ExplorerView.ID, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService); this.resourceContext = instantiationService.createInstance(ResourceContextKey); this._register(this.resourceContext); diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index 246ab00ec39..bd770a91855 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -33,7 +33,7 @@ import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions' import { DirtyEditorContext, OpenEditorsGroupContext, ReadonlyEditorContext as ReadonlyEditorContext } from 'vs/workbench/contrib/files/browser/fileCommands'; import { ResourceContextKey } from 'vs/workbench/common/resources'; import { ResourcesDropHandler, fillResourceDataTransfers, CodeDataTransfers, containsDragType } from 'vs/workbench/browser/dnd'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IDragAndDropData, DataTransfers } from 'vs/base/browser/dnd'; import { memoize } from 'vs/base/common/decorators'; @@ -47,7 +47,7 @@ import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/ const $ = dom.$; -export class OpenEditorsView extends ViewletPane { +export class OpenEditorsView extends ViewPane { private static readonly DEFAULT_VISIBLE_OPEN_EDITORS = 9; static readonly ID = 'workbench.explorer.openEditorsView'; @@ -81,7 +81,7 @@ export class OpenEditorsView extends ViewletPane { @IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService ) { super({ - ...(options as IViewletPaneOptions), + ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize({ key: 'openEditosrSection', comment: ['Open is an adjective'] }, "Open Editors Section"), }, keybindingService, contextMenuService, configurationService, contextKeyService); diff --git a/src/vs/workbench/contrib/format/browser/showExtensionQuery.ts b/src/vs/workbench/contrib/format/browser/showExtensionQuery.ts index 65c9e3cc784..cfb1a4da14d 100644 --- a/src/vs/workbench/contrib/format/browser/showExtensionQuery.ts +++ b/src/vs/workbench/contrib/format/browser/showExtensionQuery.ts @@ -4,12 +4,12 @@ *--------------------------------------------------------------------------------------------*/ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { VIEWLET_ID, IExtensionsViewlet } from 'vs/workbench/contrib/extensions/common/extensions'; +import { VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions'; export function showExtensionQuery(viewletService: IViewletService, query: string) { return viewletService.openViewlet(VIEWLET_ID, true).then(viewlet => { if (viewlet) { - (viewlet as IExtensionsViewlet).search(query); + (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(query); } }); } diff --git a/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts b/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts index 798914273eb..a03705bc2d0 100644 --- a/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts +++ b/src/vs/workbench/contrib/localizations/browser/localizations.contribution.ts @@ -21,7 +21,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewlet } from 'vs/workbench/contrib/extensions/common/extensions'; +import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions'; import { minimumTranslatedStrings } from 'vs/workbench/contrib/localizations/browser/minimalTranslations'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -139,7 +139,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo run: () => { logUserReaction('search'); this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => { viewlet.search(`tag:lp-${locale}`); viewlet.focus(); @@ -199,7 +199,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo private installExtension(extension: IGalleryExtension): Promise { return this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID) - .then(viewlet => viewlet as IExtensionsViewlet) + .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) .then(viewlet => viewlet.search(`@id:${extension.identifier.id}`)) .then(() => this.extensionManagementService.installFromGallery(extension)) .then(() => undefined, err => this.notificationService.error(err)); diff --git a/src/vs/workbench/contrib/localizations/browser/localizationsActions.ts b/src/vs/workbench/contrib/localizations/browser/localizationsActions.ts index 928b73cd406..624d4b66839 100644 --- a/src/vs/workbench/contrib/localizations/browser/localizationsActions.ts +++ b/src/vs/workbench/contrib/localizations/browser/localizationsActions.ts @@ -13,7 +13,7 @@ import { IHostService } from 'vs/workbench/services/host/browser/host'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { language } from 'vs/base/common/platform'; import { firstIndex } from 'vs/base/common/arrays'; -import { IExtensionsViewlet, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IProductService } from 'vs/platform/product/common/productService'; @@ -60,7 +60,8 @@ export class ConfigureLocaleAction extends Action { if (selectedLanguage === languageOptions[languageOptions.length - 1]) { return this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true) - .then((viewlet: IExtensionsViewlet) => { + .then(viewlet => viewlet?.getViewPaneContainer()) + .then((viewlet: IExtensionsViewPaneContainer) => { viewlet.search('@category:"language packs"'); viewlet.focus(); }); diff --git a/src/vs/workbench/contrib/outline/browser/outlinePane.ts b/src/vs/workbench/contrib/outline/browser/outlinePane.ts index 9aa98e2743c..2ec63b0f788 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePane.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePane.ts @@ -34,7 +34,7 @@ import { WorkbenchDataTree } from 'vs/platform/list/browser/listService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { attachProgressBarStyler } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { CollapseAction } from 'vs/workbench/browser/viewlet'; import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; @@ -233,7 +233,7 @@ class OutlineViewState { } } -export class OutlinePane extends ViewletPane { +export class OutlinePane extends ViewPane { private _disposables = new Array(); diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index f8995407609..9832e4f21d0 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -15,7 +15,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { FilterViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet'; +import { FilterViewPaneContainer } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { VIEWLET_ID, VIEW_CONTAINER } from 'vs/workbench/contrib/remote/common/remote.contribution'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IViewDescriptor, IViewsRegistry, Extensions } from 'vs/workbench/common/views'; @@ -24,7 +24,7 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions' import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction } from 'vs/workbench/browser/viewlet'; +import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction, Viewlet } from 'vs/workbench/browser/viewlet'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions'; @@ -46,7 +46,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { startsWith } from 'vs/base/common/strings'; import { TunnelPanelDescriptor, TunnelViewModel } from 'vs/workbench/contrib/remote/browser/tunnelView'; import { IAddedViewDescriptorRef } from 'vs/workbench/browser/parts/views/views'; -import { ViewletPane } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; class HelpModel { items: IHelpItem[] | undefined; @@ -272,7 +272,23 @@ class HelpAction extends Action { } } -export class RemoteViewlet extends FilterViewContainerViewlet { +export class RemoteViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(RemoteViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class RemoteViewPaneContainer extends FilterViewPaneContainer { private actions: IAction[] | undefined; private tunnelPanelDescriptor: TunnelPanelDescriptor | undefined; @@ -323,9 +339,9 @@ export class RemoteViewlet extends FilterViewContainerViewlet { return title; } - onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPane[] { + onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] { // Call to super MUST be first, since registering the additional view will cause this to be called again. - const panels: ViewletPane[] = super.onDidAddViews(added); + const panels: ViewPane[] = super.onDidAddViews(added); if (this.environmentService.configuration.remoteAuthority && !this.tunnelPanelDescriptor && this.configurationService.getValue('remote.forwardedPortsView.visible')) { this.tunnelPanelDescriptor = new TunnelPanelDescriptor(new TunnelViewModel(this.remoteExplorerService), this.environmentService); const viewsRegistry = Registry.as(Extensions.ViewsRegistry); diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index fdcdde36b53..fefabdc2d70 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -21,7 +21,6 @@ import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { ITreeRenderer, ITreeNode, IAsyncDataSource, ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/tree'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { Disposable, IDisposable, toDisposable, MutableDisposable, dispose } from 'vs/base/common/lifecycle'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; import { ActionBar, ActionViewItem, IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel'; import { ActionRunner, IAction } from 'vs/base/common/actions'; @@ -36,6 +35,7 @@ import { once } from 'vs/base/common/functional'; import { KeyCode } from 'vs/base/common/keyCodes'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { URI } from 'vs/base/common/uri'; class TunnelTreeVirtualDelegate implements IListVirtualDelegate { @@ -376,7 +376,7 @@ class TunnelItem implements ITunnelItem { export const TunnelTypeContextKey = new RawContextKey('tunnelType', TunnelType.Add); export const TunnelCloseableContextKey = new RawContextKey('tunnelCloseable', false); -export class TunnelPanel extends ViewletPane { +export class TunnelPanel extends ViewPane { static readonly ID = '~remote.tunnelPanel'; static readonly TITLE = nls.localize('remote.tunnel', "Tunnels"); private tree!: WorkbenchAsyncDataTree; @@ -388,7 +388,7 @@ export class TunnelPanel extends ViewletPane { constructor( protected viewModel: ITunnelViewModel, - options: IViewletPaneOptions, + options: IViewPaneOptions, @IKeybindingService protected keybindingService: IKeybindingService, @IContextMenuService protected contextMenuService: IContextMenuService, @IContextKeyService protected contextKeyService: IContextKeyService, diff --git a/src/vs/workbench/contrib/scm/browser/mainPane.ts b/src/vs/workbench/contrib/scm/browser/mainPane.ts index 02a3e45afd2..bb822b61f1a 100644 --- a/src/vs/workbench/contrib/scm/browser/mainPane.ts +++ b/src/vs/workbench/contrib/scm/browser/mainPane.ts @@ -8,7 +8,7 @@ import { localize } from 'vs/nls'; import { Event, Emitter } from 'vs/base/common/event'; import { basename } from 'vs/base/common/resources'; import { IDisposable, dispose, Disposable, DisposableStore, combinedDisposable } from 'vs/base/common/lifecycle'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { append, $, toggleClass } from 'vs/base/browser/dom'; import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent, IListEvent } from 'vs/base/browser/ui/list/list'; import { ISCMService, ISCMRepository } from 'vs/workbench/contrib/scm/common/scm'; @@ -168,7 +168,7 @@ class ProviderRenderer implements IListRenderer { index: number; @@ -50,7 +51,23 @@ export interface IViewModel { readonly onDidChangeVisibility: Event; } -export class SCMViewlet extends ViewContainerViewlet implements IViewModel { +export class SCMViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(SCMViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class SCMViewPaneContainer extends ViewPaneContainer implements IViewModel { private static readonly STATE_KEY = 'workbench.scm.views.state'; @@ -99,7 +116,7 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel { @IWorkspaceContextService protected contextService: IWorkspaceContextService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super(VIEWLET_ID, SCMViewlet.STATE_KEY, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, SCMViewPaneContainer.STATE_KEY, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.menus = instantiationService.createInstance(SCMMenus, undefined); this._register(this.menus.onDidChangeTitle(this.updateTitleArea, this)); diff --git a/src/vs/workbench/contrib/scm/common/scm.ts b/src/vs/workbench/contrib/scm/common/scm.ts index 9b4a7f1d103..2a6b8d33430 100644 --- a/src/vs/workbench/contrib/scm/common/scm.ts +++ b/src/vs/workbench/contrib/scm/common/scm.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Registry } from 'vs/platform/registry/common/platform'; -import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views'; import { URI } from 'vs/base/common/uri'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { Event } from 'vs/base/common/event'; import { IDisposable } from 'vs/base/common/lifecycle'; import { Command } from 'vs/editor/common/modes'; import { ISequence } from 'vs/base/common/sequence'; +import { Extensions as ViewContainerExtensions, ViewContainer, IViewContainersRegistry } from 'vs/workbench/common/views'; +import { Registry } from 'vs/platform/registry/common/platform'; export const VIEWLET_ID = 'workbench.view.scm'; export const VIEW_CONTAINER: ViewContainer = Registry.as(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer(VIEWLET_ID); diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index 98a487a1695..6a1b5e3f6b9 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -52,10 +52,10 @@ import { ISearchHistoryService, SearchHistoryService } from 'vs/workbench/contri import { FileMatchOrMatch, ISearchWorkbenchService, RenderableMatch, SearchWorkbenchService, FileMatch, Match, FolderMatch } from 'vs/workbench/contrib/search/common/searchModel'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -import { ISearchConfiguration, ISearchConfigurationProperties, PANEL_ID, VIEWLET_ID, VIEW_CONTAINER, VIEW_ID } from 'vs/workbench/services/search/common/search'; +import { ISearchConfiguration, ISearchConfigurationProperties, PANEL_ID, VIEWLET_ID, VIEW_ID, VIEW_CONTAINER } from 'vs/workbench/services/search/common/search'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { ExplorerViewlet } from 'vs/workbench/contrib/files/browser/explorerViewlet'; +import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/explorerViewlet'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; registerSingleton(ISearchWorkbenchService, SearchWorkbenchService, true); @@ -320,9 +320,11 @@ CommandsRegistry.registerCommand({ const contextService = accessor.get(IWorkspaceContextService); const uri = fileMatch.resource; - viewletService.openViewlet(VIEWLET_ID_FILES, false).then((viewlet: ExplorerViewlet) => { + viewletService.openViewlet(VIEWLET_ID_FILES, false).then((viewlet) => { + const explorerViewContainer = viewlet?.getViewPaneContainer() as ExplorerViewPaneContainer; + if (uri && contextService.isInsideWorkspace(uri)) { - const explorerView = viewlet.getExplorerView(); + const explorerView = explorerViewContainer?.getExplorerView(); if (explorerView) { explorerView.setExpanded(true); explorerService.select(uri, true).then(() => explorerView.focus(), onUnexpectedError); diff --git a/src/vs/workbench/contrib/search/browser/searchActions.ts b/src/vs/workbench/contrib/search/browser/searchActions.ts index b8346873f74..4401018a966 100644 --- a/src/vs/workbench/contrib/search/browser/searchActions.ts +++ b/src/vs/workbench/contrib/search/browser/searchActions.ts @@ -26,7 +26,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { ISearchConfiguration, VIEWLET_ID, PANEL_ID, ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search'; import { ISearchHistoryService } from 'vs/workbench/contrib/search/common/searchHistoryService'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { SearchViewlet } from 'vs/workbench/contrib/search/browser/searchViewlet'; +import { SearchViewPaneContainer } from 'vs/workbench/contrib/search/browser/searchViewlet'; import { SearchPanel } from 'vs/workbench/contrib/search/browser/searchPanel'; import { ITreeNavigator } from 'vs/base/browser/ui/tree/tree'; import { createEditorFromSearchResult, refreshActiveEditorSearch } from 'vs/workbench/contrib/search/browser/searchEditor'; @@ -58,13 +58,13 @@ export function openSearchView(viewletService: IViewletService, panelService: IP return Promise.resolve((panelService.openPanel(PANEL_ID, focus) as SearchPanel).getSearchView()); } - return viewletService.openViewlet(VIEWLET_ID, focus).then(viewlet => (viewlet as SearchViewlet).getSearchView()); + return viewletService.openViewlet(VIEWLET_ID, focus).then(viewlet => (viewlet?.getViewPaneContainer() as SearchViewPaneContainer).getSearchView() as SearchView); } export function getSearchView(viewletService: IViewletService, panelService: IPanelService): SearchView | undefined { const activeViewlet = viewletService.getActiveViewlet(); if (activeViewlet && activeViewlet.getId() === VIEWLET_ID) { - return (activeViewlet as SearchViewlet).getSearchView(); + return (activeViewlet.getViewPaneContainer() as SearchViewPaneContainer).getSearchView(); } const activePanel = panelService.getActivePanel(); diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index d11471d7ff7..123329082c9 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -56,7 +56,7 @@ import { IPreferencesService, ISettingsEditorOptions } from 'vs/workbench/servic import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService'; import { relativePath } from 'vs/base/common/resources'; import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; -import { ViewletPane, IViewletPaneOptions } from 'vs/workbench/browser/parts/views/paneViewlet'; +import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { Memento, MementoObject } from 'vs/workbench/common/memento'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; @@ -82,7 +82,7 @@ export enum SearchViewPosition { } const SEARCH_CANCELLED_MESSAGE = nls.localize('searchCanceled', "Search was canceled before any results could be found - "); -export class SearchView extends ViewletPane { +export class SearchView extends ViewPane { private static readonly MAX_TEXT_RESULTS = 10000; @@ -145,7 +145,7 @@ export class SearchView extends ViewletPane { constructor( private position: SearchViewPosition, - options: IViewletPaneOptions, + options: IViewPaneOptions, @IFileService private readonly fileService: IFileService, @IEditorService private readonly editorService: IEditorService, @IProgressService private readonly progressService: IProgressService, diff --git a/src/vs/workbench/contrib/search/browser/searchViewlet.ts b/src/vs/workbench/contrib/search/browser/searchViewlet.ts index aa0fa15d1b9..a216091af0c 100644 --- a/src/vs/workbench/contrib/search/browser/searchViewlet.ts +++ b/src/vs/workbench/contrib/search/browser/searchViewlet.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -16,9 +15,27 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten import { VIEWLET_ID, VIEW_ID } from 'vs/workbench/services/search/common/search'; import { SearchView } from 'vs/workbench/contrib/search/browser/searchView'; import { Registry } from 'vs/platform/registry/common/platform'; -import { ViewletRegistry, Extensions } from 'vs/workbench/browser/viewlet'; +import { ViewletRegistry, Extensions, Viewlet } from 'vs/workbench/browser/viewlet'; +import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer'; -export class SearchViewlet extends ViewContainerViewlet { + +export class SearchViewlet extends Viewlet { + constructor( + @ITelemetryService telemetryService: ITelemetryService, + @IStorageService protected storageService: IStorageService, + @IInstantiationService protected instantiationService: IInstantiationService, + @IThemeService themeService: IThemeService, + @IContextMenuService protected contextMenuService: IContextMenuService, + @IExtensionService protected extensionService: IExtensionService, + @IWorkspaceContextService protected contextService: IWorkspaceContextService, + @IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService, + @IConfigurationService protected configurationService: IConfigurationService + ) { + super(VIEWLET_ID, instantiationService.createInstance(SearchViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService); + } +} + +export class SearchViewPaneContainer extends ViewPaneContainer { constructor( @IWorkbenchLayoutService layoutService: IWorkbenchLayoutService, @@ -29,9 +46,9 @@ export class SearchViewlet extends ViewContainerViewlet { @IInstantiationService protected instantiationService: IInstantiationService, @IThemeService themeService: IThemeService, @IContextMenuService contextMenuService: IContextMenuService, - @IExtensionService extensionService: IExtensionService + @IExtensionService extensionService: IExtensionService, ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); } getTitle(): string { @@ -42,4 +59,4 @@ export class SearchViewlet extends ViewContainerViewlet { const view = super.getView(VIEW_ID); return view ? view as SearchView : undefined; } -} \ No newline at end of file +} diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts index ac4567e81c4..eaee0e3cd4e 100644 --- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts +++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts @@ -11,7 +11,7 @@ import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/ import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions'; import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IColorTheme, IFileIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { VIEWLET_ID, IExtensionsViewlet } from 'vs/workbench/contrib/extensions/common/extensions'; +import { VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions'; import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IColorRegistry, Extensions as ColorRegistryExtensions } from 'vs/platform/theme/common/colorRegistry'; @@ -211,7 +211,7 @@ function configurationEntries(extensionGalleryService: IExtensionGalleryService, function openExtensionViewlet(viewletService: IViewletService, query: string) { return viewletService.openViewlet(VIEWLET_ID, true).then(viewlet => { if (viewlet) { - (viewlet as IExtensionsViewlet).search(query); + (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(query); viewlet.focus(); } }); diff --git a/src/vs/workbench/services/progress/test/progressIndicator.test.ts b/src/vs/workbench/services/progress/test/progressIndicator.test.ts index f50511e22d8..2573e8938ea 100644 --- a/src/vs/workbench/services/progress/test/progressIndicator.test.ts +++ b/src/vs/workbench/services/progress/test/progressIndicator.test.ts @@ -12,6 +12,8 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IViewlet } from 'vs/workbench/common/viewlet'; import { TestViewletService, TestPanelService } from 'vs/workbench/test/workbenchTestServices'; import { Event } from 'vs/base/common/event'; +import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; +import { IView } from 'vs/workbench/common/views'; class TestViewlet implements IViewlet { @@ -29,6 +31,9 @@ class TestViewlet implements IViewlet { getControl(): IEditorControl { return null!; } focus(): void { } getOptimalWidth(): number { return 10; } + openView(id: string, focus?: boolean): IView { return null!; } + getViewPaneContainer(): IViewPaneContainer { return null!; } + saveState(): void { } } class TestCompositeScope extends CompositeScope { diff --git a/src/vs/workbench/services/search/common/search.ts b/src/vs/workbench/services/search/common/search.ts index 9c842761a68..d02e1e53ece 100644 --- a/src/vs/workbench/services/search/common/search.ts +++ b/src/vs/workbench/services/search/common/search.ts @@ -15,9 +15,9 @@ import { IFilesConfiguration } from 'vs/platform/files/common/files'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry'; import { Event } from 'vs/base/common/event'; -import { ViewContainer, IViewContainersRegistry, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views'; -import { Registry } from 'vs/platform/registry/common/platform'; import { relative } from 'vs/base/common/path'; +import { Extensions as ViewContainerExtensions, ViewContainer, IViewContainersRegistry } from 'vs/workbench/common/views'; +import { Registry } from 'vs/platform/registry/common/platform'; export const VIEWLET_ID = 'workbench.view.search'; export const PANEL_ID = 'workbench.view.search'; diff --git a/src/vs/workbench/test/browser/viewlet.test.ts b/src/vs/workbench/test/browser/viewlet.test.ts index 2698de89738..7ca46667704 100644 --- a/src/vs/workbench/test/browser/viewlet.test.ts +++ b/src/vs/workbench/test/browser/viewlet.test.ts @@ -13,7 +13,7 @@ suite('Viewlets', () => { class TestViewlet extends Viewlet { constructor() { - super('id', null!, null!, null!, null!, null!); + super('id', null!, null!, null!, null!, null!, null!, null!, null!, null!, null!); } public layout(dimension: any): void { From 6395537b79e8fd80202c7a40b3b8ed26f60eac90 Mon Sep 17 00:00:00 2001 From: Gustavo Cassel Date: Mon, 9 Dec 2019 22:23:33 -0300 Subject: [PATCH 256/637] Changed 'shift + click' folding behavior to collapse only inner ranges when current range is unfolded --- src/vs/editor/contrib/folding/folding.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index 86f04e0db86..198a751ff01 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -32,6 +32,7 @@ import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/f import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { onUnexpectedError } from 'vs/base/common/errors'; import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IMouseEvent } from 'vs/base/browser/mouseEvent'; const CONTEXT_FOLDING_ENABLED = new RawContextKey('foldingEnabled', false); @@ -421,8 +422,12 @@ export class FoldingController extends Disposable implements IEditorContribution if (region && region.startLineNumber === lineNumber) { let isCollapsed = region.isCollapsed; if (iconClicked || isCollapsed) { - let toToggle = [region]; - if (e.event.middleButton || e.event.shiftKey) { + let toToggle = []; + let considerRegionsInside = this.shouldConsiderRegionsInside(e.event); + if (isCollapsed || (!isCollapsed && !considerRegionsInside)) { + toToggle.push(region); + } + if (considerRegionsInside) { toToggle.push(...foldingModel.getRegionsInside(region, (r: FoldingRegion) => r.isCollapsed === isCollapsed)); } foldingModel.toggleCollapseState(toToggle); @@ -433,6 +438,10 @@ export class FoldingController extends Disposable implements IEditorContribution }).then(undefined, onUnexpectedError); } + private shouldConsiderRegionsInside(event: IMouseEvent): boolean { + return event.middleButton || event.shiftKey; + } + public reveal(position: IPosition): void { this.editor.revealPositionInCenterIfOutsideViewport(position, ScrollType.Smooth); } From 35587bec9355b4fb3d262727f3d3dae24a8035c9 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 6 Dec 2019 11:59:30 -0800 Subject: [PATCH 257/637] Also log error when a fatal error happens --- .../src/typescriptServiceClient.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index b3385c4c393..ce01e4468e5 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -716,6 +716,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType */ this.logTelemetry('fatalError', { command, ...(error instanceof TypeScriptServerError ? error.telemetry : {}) }); console.error(`A non-recoverable error occured while executing tsserver command: ${command}`); + if (error instanceof TypeScriptServerError && error.serverErrorText) { + console.error(error.serverErrorText); + } if (this.serverState.type === ServerState.Type.Running) { this.info('Killing TS Server'); From 58d954737facf9478a8255965e5d365bc3d70f71 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 9 Dec 2019 17:27:03 -0800 Subject: [PATCH 258/637] Don't show references code lens on const members Fixes #86495 --- .../src/features/referencesCodeLens.ts | 27 +++-- .../src/test/index.ts | 3 +- .../src/test/referencesCodeLens.test.ts | 99 +++++++++++++++++++ 3 files changed, 119 insertions(+), 10 deletions(-) create mode 100644 extensions/typescript-language-features/src/test/referencesCodeLens.test.ts diff --git a/extensions/typescript-language-features/src/features/referencesCodeLens.ts b/extensions/typescript-language-features/src/features/referencesCodeLens.ts index 5504bb05d4a..106e13425d0 100644 --- a/extensions/typescript-language-features/src/features/referencesCodeLens.ts +++ b/extensions/typescript-language-features/src/features/referencesCodeLens.ts @@ -78,26 +78,35 @@ export class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLens case PConst.Kind.let: case PConst.Kind.variable: // Only show references for exported variables - if (!item.kindModifiers.match(/\bexport\b/)) { - break; + if (/\bexport\b/.test(item.kindModifiers)) { + return getSymbolRange(document, item); } - // fallthrough + break; case PConst.Kind.class: if (item.text === '') { break; } - // fallthrough + return getSymbolRange(document, item); - case PConst.Kind.memberFunction: - case PConst.Kind.memberVariable: - case PConst.Kind.memberGetAccessor: - case PConst.Kind.memberSetAccessor: - case PConst.Kind.constructorImplementation: case PConst.Kind.interface: case PConst.Kind.type: case PConst.Kind.enum: return getSymbolRange(document, item); + + case PConst.Kind.memberFunction: + case PConst.Kind.memberGetAccessor: + case PConst.Kind.memberSetAccessor: + case PConst.Kind.constructorImplementation: + case PConst.Kind.memberVariable: + // Only show if parent is a class type object (not a literal) + switch (parent?.kind) { + case PConst.Kind.class: + case PConst.Kind.interface: + case PConst.Kind.type: + return getSymbolRange(document, item); + } + break; } return null; diff --git a/extensions/typescript-language-features/src/test/index.ts b/extensions/typescript-language-features/src/test/index.ts index 4c3a74b15b8..ba0fd6d7663 100644 --- a/extensions/typescript-language-features/src/test/index.ts +++ b/extensions/typescript-language-features/src/test/index.ts @@ -22,7 +22,8 @@ const testRunner = require('vscode/lib/testrunner'); testRunner.configure({ ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle) - timeout: 60000 + timeout: 60000, + grep: 'References' }); export = testRunner; diff --git a/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts new file mode 100644 index 00000000000..7ca35ed89cc --- /dev/null +++ b/extensions/typescript-language-features/src/test/referencesCodeLens.test.ts @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import 'mocha'; +import * as vscode from 'vscode'; +import { disposeAll } from '../utils/dispose'; +import { createTestEditor, wait } from './testUtils'; + + +type VsCodeConfiguration = { [key: string]: any }; + +async function updateConfig(newConfig: VsCodeConfiguration): Promise { + const oldConfig: VsCodeConfiguration = {}; + const config = vscode.workspace.getConfiguration(undefined); + for (const configKey of Object.keys(newConfig)) { + oldConfig[configKey] = config.get(configKey); + await new Promise((resolve, reject) => + config.update(configKey, newConfig[configKey], vscode.ConfigurationTarget.Global) + .then(() => resolve(), reject)); + } + return oldConfig; +} + +namespace Config { + export const referencesCodeLens = 'typescript.referencesCodeLens.enabled'; +} + +suite('TypeScript References', () => { + const configDefaults: VsCodeConfiguration = Object.freeze({ + [Config.referencesCodeLens]: true, + }); + + const _disposables: vscode.Disposable[] = []; + let oldConfig: { [key: string]: any } = {}; + + setup(async () => { + await wait(100); + + // Save off config and apply defaults + oldConfig = await updateConfig(configDefaults); + }); + + teardown(async () => { + disposeAll(_disposables); + + // Restore config + await updateConfig(oldConfig); + + return vscode.commands.executeCommand('workbench.action.closeAllEditors'); + }); + + test('Should show on basic class', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test1.ts'); + await createTestEditor(testDocumentUri, + `class Foo {}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 1); + assert.strictEqual(codeLenses?.[0].range.start.line, 0); + }); + + test('Should show on basic class properties', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test2.ts'); + await createTestEditor(testDocumentUri, + `class Foo {`, + ` prop: number;`, + ` meth(): void {}`, + `}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 3); + assert.strictEqual(codeLenses?.[0].range.start.line, 0); + assert.strictEqual(codeLenses?.[1].range.start.line, 1); + assert.strictEqual(codeLenses?.[2].range.start.line, 2); + }); + + test('Should not show on const property', async () => { + const testDocumentUri = vscode.Uri.parse('untitled:test3.ts'); + await createTestEditor(testDocumentUri, + `const foo = {`, + ` prop: 1;`, + ` meth(): void {}`, + `}` + ); + + const codeLenses = await getCodeLenses(testDocumentUri); + assert.strictEqual(codeLenses?.length, 0); + }); +}); + +function getCodeLenses(document: vscode.Uri): Thenable { + return vscode.commands.executeCommand('vscode.executeCodeLensProvider', document, 100); +} + From fa948c2f1e84d1f1b2963067e7a3e2d46f2644f9 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 9 Dec 2019 14:50:46 -0800 Subject: [PATCH 259/637] Add initial "file is a block" syntax hilight --- .../syntaxes/searchResult.tmLanguage.json | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index 8f13bc5075a..f5ece17f4e2 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -6,6 +6,38 @@ "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", "name": "comment" }, + { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ts)(:)$", + "end": "(^$)|(^ (\\d+)(:| ))", + "name": "searchResult.resultLine.typescript", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "whileCaptures": { + "3": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "4": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "patterns": [ + { + "include": "source.ts" + } + ] + }, { "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", "name": "string path.searchResult", @@ -27,7 +59,7 @@ "1": { "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" }, - "2:": { + "2": { "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" } } From 889ce81f3d8cc05e0faba7035a7b28186afb0619 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 9 Dec 2019 15:20:20 -0800 Subject: [PATCH 260/637] Add single and multiline matching --- .../syntaxes/searchResult.tmLanguage.json | 56 +++++++++++++++---- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index f5ece17f4e2..921a7864418 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -8,8 +8,8 @@ }, { "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ts)(:)$", - "end": "(^$)|(^ (\\d+)(:| ))", - "name": "searchResult.resultLine.typescript", + "end": "^(?!\\s)", + "name": "searchResult.block.typescript", "beginCaptures": { "0": { "name": "string path.searchResult" @@ -24,17 +24,51 @@ "name": "endingColon.path.searchResult" } }, - "whileCaptures": { - "3": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "4": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, "patterns": [ { - "include": "source.ts" + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.typescript searchResult.multiline", + "patterns": [ + { + "include": "source.ts" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.typescript searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.ts" + } + ] + } + } } ] }, From 55307c2a39dfcb845605a2d597f23136e22e8d6d Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Mon, 9 Dec 2019 18:13:09 -0800 Subject: [PATCH 261/637] Add syntax highlighting to Search Results. Closes #86241. --- extensions/search-result/package.json | 1 + .../syntaxes/generateTMLanguage.js | 163 + .../syntaxes/searchResult.tmLanguage.json | 3037 ++++++++++++++++- 3 files changed, 3100 insertions(+), 101 deletions(-) create mode 100644 extensions/search-result/syntaxes/generateTMLanguage.js diff --git a/extensions/search-result/package.json b/extensions/search-result/package.json index 5e7482b6033..4129c6c7b63 100644 --- a/extensions/search-result/package.json +++ b/extensions/search-result/package.json @@ -16,6 +16,7 @@ "*" ], "scripts": { + "update-grammar": "node ./syntaxes/generateTMLanguage.js", "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:search-result ./tsconfig.json" }, "contributes": { diff --git a/extensions/search-result/syntaxes/generateTMLanguage.js b/extensions/search-result/syntaxes/generateTMLanguage.js new file mode 100644 index 00000000000..0f2fd115888 --- /dev/null +++ b/extensions/search-result/syntaxes/generateTMLanguage.js @@ -0,0 +1,163 @@ +// @ts-check + +const languages = [ + ['bat', 'source.batchfile'], + ['c', 'source.c'], + ['clj', 'source.clojure'], + ['coffee', 'source.coffee'], + ['cpp', 'source.cpp'], + ['cs', 'source.cs'], + ['css', 'source.css'], + ['dart', 'source.dart'], + ['diff', 'source.diff'], + ['dockerfile', 'source.dockerfile'], + ['fs', 'source.fsharp'], + ['go', 'source.go'], + ['groovy', 'source.groovy'], + ['h', 'source.objc'], + ['hpp', 'source.objcpp'], + ['html', 'source.html'], + ['java', 'source.java'], + ['js', 'source.js'], + ['json', 'source.json.comments'], + ['jsx', 'source.js.jsx'], + ['less', 'source.css.less'], + ['lua', 'source.lua'], + ['m', 'source.objc'], + ['make', 'source.makefile'], + ['mm', 'source.objcpp'], + ['p6', 'source.perl.6'], + ['perl', 'source.perl'], + ['php', 'source.php'], + ['pl', 'source.perl'], + ['ps1', 'source.powershell'], + ['py', 'source.python'], + ['r', 'source.r'], + ['rb', 'source.ruby'], + ['rs', 'source.rust'], + ['scala', 'source.scala'], + ['scss', 'source.css.scss'], + ['sh', 'source.shell'], + ['sql', 'source.sql'], + ['swift', 'source.swift'], + ['ts', 'source.ts'], + ['tsx', 'source.tsx'], + ['yaml', 'source.yaml'], +]; + +const repository = {}; +languages.forEach(([ext, scope]) => + repository[ext] = { + begin: `^(?!\\s)(.*?)([^\\\\\\/\\n]*.${ext})(:)$`, + end: "^(?!\\s)", + name: `searchResult.block.${ext}`, + beginCaptures: { + "0": { + name: "string path.searchResult" + }, + "1": { + name: "dirname.path.searchResult" + }, + "2": { + name: "basename.path.searchResult" + }, + "3": { + name: "endingColon.path.searchResult" + } + }, + patterns: [ + { + begin: "^ (\\d+)( )", + while: "^ (\\d+)(:| )", + beginCaptures: { + "1": { + name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + whileCaptures: { + "1": { + name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + name: `searchResult.resultLine.${ext} searchResult.multiline`, + patterns: [ + { + include: scope + } + ] + }, + { + match: "^ (\\d+)(:)(.*)", + name: `searchResult.resultLine.${ext} searchResult.singleline`, + captures: { + "1": { + name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + patterns: [ + { + include: scope + } + ] + } + } + } + ] + }); + +const header = { + "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", + "name": "comment" +}; + +const plainText = [{ + match: "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", + name: "string path.searchResult", + captures: { + "1": { + name: "dirname.path.searchResult" + }, + "2": { + name: "basename.path.searchResult" + }, + "3": { + name: "endingColon.path.searchResult" + } + } +}, +{ + match: "^ (\\d+)(:| )", + captures: { + "1": { + name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + } +}]; + +const tmLanguage = { + "information_for_contributors": "This file is generated from ./generateTMLanguage.js.", + name: "Search Results", + scopeName: "text.searchResult", + patterns: [ + header, + ...languages.map(([ext]) => ({ include: `#${ext}` })), + ...plainText + ], + repository +}; + + +require('fs') + .writeFileSync('./searchResult.tmLanguage.json', JSON.stringify(tmLanguage, null, 2)); diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index 921a7864418..bfd7504eef3 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -1,102 +1,2937 @@ { - "name": "Search Results", - "scopeName": "text.searchResult", - "patterns": [ - { - "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", - "name": "comment" - }, - { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ts)(:)$", - "end": "^(?!\\s)", - "name": "searchResult.block.typescript", - "beginCaptures": { - "0": { - "name": "string path.searchResult" - }, - "1": { - "name": "dirname.path.searchResult" - }, - "2": { - "name": "basename.path.searchResult" - }, - "3": { - "name": "endingColon.path.searchResult" - } - }, - "patterns": [ - { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", - "beginCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, - "whileCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, - "name": "searchResult.resultLine.typescript searchResult.multiline", - "patterns": [ - { - "include": "source.ts" - } - ] - }, - { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.typescript searchResult.singleline", - "captures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - }, - "3": { - "patterns": [ - { - "include": "source.ts" - } - ] - } - } - } - ] - }, - { - "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", - "name": "string path.searchResult", - "captures": { - "1": { - "name": "dirname.path.searchResult" - }, - "2": { - "name": "basename.path.searchResult" - }, - "3": { - "name": "endingColon.path.searchResult" - } - } - }, - { - "match": "^ (\\d+)(:| )", - "captures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - } - } - ] -} + "information_for_contributors": "This file is generated from ./generateTMLanguage.js.", + "name": "Search Results", + "scopeName": "text.searchResult", + "patterns": [ + { + "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", + "name": "comment" + }, + { + "include": "#bat" + }, + { + "include": "#c" + }, + { + "include": "#clj" + }, + { + "include": "#coffee" + }, + { + "include": "#cpp" + }, + { + "include": "#cs" + }, + { + "include": "#css" + }, + { + "include": "#dart" + }, + { + "include": "#diff" + }, + { + "include": "#dockerfile" + }, + { + "include": "#fs" + }, + { + "include": "#go" + }, + { + "include": "#groovy" + }, + { + "include": "#h" + }, + { + "include": "#hpp" + }, + { + "include": "#html" + }, + { + "include": "#java" + }, + { + "include": "#js" + }, + { + "include": "#json" + }, + { + "include": "#jsx" + }, + { + "include": "#less" + }, + { + "include": "#lua" + }, + { + "include": "#m" + }, + { + "include": "#make" + }, + { + "include": "#mm" + }, + { + "include": "#p6" + }, + { + "include": "#perl" + }, + { + "include": "#php" + }, + { + "include": "#pl" + }, + { + "include": "#ps1" + }, + { + "include": "#py" + }, + { + "include": "#r" + }, + { + "include": "#rb" + }, + { + "include": "#rs" + }, + { + "include": "#scala" + }, + { + "include": "#scss" + }, + { + "include": "#sh" + }, + { + "include": "#sql" + }, + { + "include": "#swift" + }, + { + "include": "#ts" + }, + { + "include": "#tsx" + }, + { + "include": "#yaml" + }, + { + "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", + "name": "string path.searchResult", + "captures": { + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + } + }, + { + "match": "^ (\\d+)(:| )", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + } + } + ], + "repository": { + "bat": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.bat)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.bat", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.bat searchResult.multiline", + "patterns": [ + { + "include": "source.batchfile" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.bat searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.batchfile" + } + ] + } + } + } + ] + }, + "c": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.c)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.c", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.c searchResult.multiline", + "patterns": [ + { + "include": "source.c" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.c searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.c" + } + ] + } + } + } + ] + }, + "clj": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.clj)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.clj", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.clj searchResult.multiline", + "patterns": [ + { + "include": "source.clojure" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.clj searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.clojure" + } + ] + } + } + } + ] + }, + "coffee": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.coffee)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.coffee", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.coffee searchResult.multiline", + "patterns": [ + { + "include": "source.coffee" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.coffee searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.coffee" + } + ] + } + } + } + ] + }, + "cpp": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.cpp)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.cpp", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.cpp searchResult.multiline", + "patterns": [ + { + "include": "source.cpp" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.cpp searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.cpp" + } + ] + } + } + } + ] + }, + "cs": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.cs)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.cs", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.cs searchResult.multiline", + "patterns": [ + { + "include": "source.cs" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.cs searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.cs" + } + ] + } + } + } + ] + }, + "css": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.css)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.css", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.css searchResult.multiline", + "patterns": [ + { + "include": "source.css" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.css searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.css" + } + ] + } + } + } + ] + }, + "dart": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.dart)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.dart", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.dart searchResult.multiline", + "patterns": [ + { + "include": "source.dart" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.dart searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.dart" + } + ] + } + } + } + ] + }, + "diff": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.diff)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.diff", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.diff searchResult.multiline", + "patterns": [ + { + "include": "source.diff" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.diff searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.diff" + } + ] + } + } + } + ] + }, + "dockerfile": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.dockerfile)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.dockerfile", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.dockerfile searchResult.multiline", + "patterns": [ + { + "include": "source.dockerfile" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.dockerfile searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.dockerfile" + } + ] + } + } + } + ] + }, + "fs": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.fs)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.fs", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.fs searchResult.multiline", + "patterns": [ + { + "include": "source.fsharp" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.fs searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.fsharp" + } + ] + } + } + } + ] + }, + "go": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.go)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.go", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.go searchResult.multiline", + "patterns": [ + { + "include": "source.go" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.go searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.go" + } + ] + } + } + } + ] + }, + "groovy": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.groovy)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.groovy", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.groovy searchResult.multiline", + "patterns": [ + { + "include": "source.groovy" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.groovy searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.groovy" + } + ] + } + } + } + ] + }, + "h": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.h)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.h", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.h searchResult.multiline", + "patterns": [ + { + "include": "source.objc" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.h searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.objc" + } + ] + } + } + } + ] + }, + "hpp": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.hpp)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.hpp", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.hpp searchResult.multiline", + "patterns": [ + { + "include": "source.objcpp" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.hpp searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.objcpp" + } + ] + } + } + } + ] + }, + "html": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.html)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.html", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.html searchResult.multiline", + "patterns": [ + { + "include": "source.html" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.html searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.html" + } + ] + } + } + } + ] + }, + "java": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.java)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.java", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.java searchResult.multiline", + "patterns": [ + { + "include": "source.java" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.java searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.java" + } + ] + } + } + } + ] + }, + "js": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.js)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.js", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.js searchResult.multiline", + "patterns": [ + { + "include": "source.js" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.js searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.js" + } + ] + } + } + } + ] + }, + "json": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.json)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.json", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.json searchResult.multiline", + "patterns": [ + { + "include": "source.json.comments" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.json searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.json.comments" + } + ] + } + } + } + ] + }, + "jsx": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.jsx)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.jsx", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.jsx searchResult.multiline", + "patterns": [ + { + "include": "source.js.jsx" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.jsx searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.js.jsx" + } + ] + } + } + } + ] + }, + "less": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.less)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.less", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.less searchResult.multiline", + "patterns": [ + { + "include": "source.css.less" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.less searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.css.less" + } + ] + } + } + } + ] + }, + "lua": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.lua)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.lua", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.lua searchResult.multiline", + "patterns": [ + { + "include": "source.lua" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.lua searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.lua" + } + ] + } + } + } + ] + }, + "m": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.m)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.m", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.m searchResult.multiline", + "patterns": [ + { + "include": "source.objc" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.m searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.objc" + } + ] + } + } + } + ] + }, + "make": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.make)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.make", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.make searchResult.multiline", + "patterns": [ + { + "include": "source.makefile" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.make searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.makefile" + } + ] + } + } + } + ] + }, + "mm": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.mm)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.mm", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.mm searchResult.multiline", + "patterns": [ + { + "include": "source.objcpp" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.mm searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.objcpp" + } + ] + } + } + } + ] + }, + "p6": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.p6)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.p6", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.p6 searchResult.multiline", + "patterns": [ + { + "include": "source.perl.6" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.p6 searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.perl.6" + } + ] + } + } + } + ] + }, + "perl": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.perl)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.perl", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.perl searchResult.multiline", + "patterns": [ + { + "include": "source.perl" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.perl searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.perl" + } + ] + } + } + } + ] + }, + "php": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.php)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.php", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.php searchResult.multiline", + "patterns": [ + { + "include": "source.php" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.php searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.php" + } + ] + } + } + } + ] + }, + "pl": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.pl)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.pl", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.pl searchResult.multiline", + "patterns": [ + { + "include": "source.perl" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.pl searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.perl" + } + ] + } + } + } + ] + }, + "ps1": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ps1)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.ps1", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.ps1 searchResult.multiline", + "patterns": [ + { + "include": "source.powershell" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.ps1 searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.powershell" + } + ] + } + } + } + ] + }, + "py": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.py)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.py", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.py searchResult.multiline", + "patterns": [ + { + "include": "source.python" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.py searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.python" + } + ] + } + } + } + ] + }, + "r": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.r)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.r", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.r searchResult.multiline", + "patterns": [ + { + "include": "source.r" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.r searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.r" + } + ] + } + } + } + ] + }, + "rb": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.rb)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.rb", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.rb searchResult.multiline", + "patterns": [ + { + "include": "source.ruby" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.rb searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.ruby" + } + ] + } + } + } + ] + }, + "rs": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.rs)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.rs", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.rs searchResult.multiline", + "patterns": [ + { + "include": "source.rust" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.rs searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.rust" + } + ] + } + } + } + ] + }, + "scala": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.scala)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.scala", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.scala searchResult.multiline", + "patterns": [ + { + "include": "source.scala" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.scala searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.scala" + } + ] + } + } + } + ] + }, + "scss": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.scss)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.scss", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.scss searchResult.multiline", + "patterns": [ + { + "include": "source.css.scss" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.scss searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.css.scss" + } + ] + } + } + } + ] + }, + "sh": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.sh)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.sh", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.sh searchResult.multiline", + "patterns": [ + { + "include": "source.shell" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.sh searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.shell" + } + ] + } + } + } + ] + }, + "sql": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.sql)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.sql", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.sql searchResult.multiline", + "patterns": [ + { + "include": "source.sql" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.sql searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.sql" + } + ] + } + } + } + ] + }, + "swift": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.swift)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.swift", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.swift searchResult.multiline", + "patterns": [ + { + "include": "source.swift" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.swift searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.swift" + } + ] + } + } + } + ] + }, + "ts": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ts)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.ts", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.ts searchResult.multiline", + "patterns": [ + { + "include": "source.ts" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.ts searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.ts" + } + ] + } + } + } + ] + }, + "tsx": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.tsx)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.tsx", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.tsx searchResult.multiline", + "patterns": [ + { + "include": "source.tsx" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.tsx searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.tsx" + } + ] + } + } + } + ] + }, + "yaml": { + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.yaml)(:)$", + "end": "^(?!\\s)", + "name": "searchResult.block.yaml", + "beginCaptures": { + "0": { + "name": "string path.searchResult" + }, + "1": { + "name": "dirname.path.searchResult" + }, + "2": { + "name": "basename.path.searchResult" + }, + "3": { + "name": "endingColon.path.searchResult" + } + }, + "patterns": [ + { + "begin": "^ (\\d+)( )", + "while": "^ (\\d+)(:| )", + "beginCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "whileCaptures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + } + }, + "name": "searchResult.resultLine.yaml searchResult.multiline", + "patterns": [ + { + "include": "source.yaml" + } + ] + }, + { + "match": "^ (\\d+)(:)(.*)", + "name": "searchResult.resultLine.yaml searchResult.singleline", + "captures": { + "1": { + "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + }, + "2": { + "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + }, + "3": { + "patterns": [ + { + "include": "source.yaml" + } + ] + } + } + } + ] + } + } +} \ No newline at end of file From 27437a21de5199e0e1c76cbd0804ceee55012254 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 07:57:21 +0100 Subject: [PATCH 262/637] fix #85617 --- .../browser/parts/notifications/media/notificationsList.css | 1 - .../browser/parts/notifications/notificationsViewer.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/notifications/media/notificationsList.css b/src/vs/workbench/browser/parts/notifications/media/notificationsList.css index 1037e6a0672..d5646d18f76 100644 --- a/src/vs/workbench/browser/parts/notifications/media/notificationsList.css +++ b/src/vs/workbench/browser/parts/notifications/media/notificationsList.css @@ -18,7 +18,6 @@ opacity: 0; position: absolute; line-height: 22px; - margin: 10px 0; /* 10px top and bottom */ word-wrap: break-word; /* never overflow long words, but break to next line */ } diff --git a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts index 191516711f7..a41db2f2ee1 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts @@ -85,7 +85,7 @@ export class NotificationsListDelegate implements IListVirtualDelegate Date: Tue, 10 Dec 2019 08:03:30 +0100 Subject: [PATCH 263/637] #84283 use log service to log --- src/vs/workbench/api/node/extHostOutputService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index fd194124907..4e6d32c4967 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -14,6 +14,7 @@ import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputSe import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { MutableDisposable } from 'vs/base/common/lifecycle'; +import { ILogService } from 'vs/platform/log/common/log'; export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel { @@ -55,6 +56,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService { constructor( @IExtHostRpcService extHostRpc: IExtHostRpcService, + @ILogService private readonly logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, ) { super(extHostRpc); @@ -90,7 +92,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService { return new ExtHostOutputChannelBackedByFile(name, appender, this._proxy); } catch (error) { // Do not crash if logger cannot be created - console.log(error); + this.logService.error(error); return new ExtHostPushOutputChannel(name, this._proxy); } } From 9288608bdb6f5eb42d059ff3c620adff033ce6e6 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 08:10:58 +0100 Subject: [PATCH 264/637] debt - move text save error handler --- .../files/browser/editors/fileEditorTracker.ts | 17 ++++++++--------- .../{ => editors}/textFileSaveErrorHandler.ts | 0 .../files/browser/fileActions.contribution.ts | 2 +- .../contrib/files/browser/files.contribution.ts | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) rename src/vs/workbench/contrib/files/browser/{ => editors}/textFileSaveErrorHandler.ts (100%) diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index bcc39a73b37..38c3af8239f 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -30,10 +30,9 @@ import { withNullAsUndefined } from 'vs/base/common/types'; import { EditorActivation, ITextEditorOptions } from 'vs/platform/editor/common/editor'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { - private closeOnFileDelete: boolean | undefined; - private modelLoadQueue = new ResourceQueue(); - private activeOutOfWorkspaceWatchers = new ResourceMap(); + private readonly modelLoadQueue = new ResourceQueue(); + private readonly activeOutOfWorkspaceWatchers = new ResourceMap(); constructor( @IEditorService private readonly editorService: IEditorService, @@ -64,17 +63,17 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // Open editors from dirty text file models this._register(this.textFileService.models.onModelsDirty(e => this.onTextFilesDirty(e))); - // Editor changing + // Out of workspace file watchers this._register(this.editorService.onDidVisibleEditorsChange(() => this.handleOutOfWorkspaceWatchers())); // Update visible editors when focus is gained this._register(this.hostService.onDidChangeFocus(e => this.onWindowFocusChange(e))); - // Lifecycle - this.lifecycleService.onShutdown(this.dispose, this); - // Configuration this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue()))); + + // Lifecycle + this.lifecycleService.onShutdown(this.dispose, this); } private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void { @@ -98,7 +97,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut return resource ? this.textFileService.models.get(resource) : undefined; })) .filter(model => !model.isDirty()), - m => m.resource.toString() + model => model.resource.toString() ).forEach(model => this.queueModelLoad(model)); } } @@ -311,7 +310,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // and updated right after. distinct(coalesce([...e.getUpdated(), ...e.getAdded()] .map(u => this.textFileService.models.get(u.resource))) - .filter(model => model && !model.isDirty()), m => m.resource.toString()) + .filter(model => model && !model.isDirty()), model => model.resource.toString()) .forEach(model => this.queueModelLoad(model)); } diff --git a/src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts similarity index 100% rename from src/vs/workbench/contrib/files/browser/textFileSaveErrorHandler.ts rename to src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts diff --git a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts index 11377bf749b..ddc912794d0 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; import { ToggleAutoSaveAction, GlobalNewUntitledFileAction, FocusFilesExplorer, GlobalCompareResourcesAction, SaveAllAction, ShowActiveFileInExplorer, CollapseExplorerView, RefreshExplorerView, CompareWithClipboardAction, NEW_FILE_COMMAND_ID, NEW_FILE_LABEL, NEW_FOLDER_COMMAND_ID, NEW_FOLDER_LABEL, TRIGGER_RENAME_LABEL, MOVE_FILE_TO_TRASH_LABEL, COPY_FILE_LABEL, PASTE_FILE_LABEL, FileCopiedContext, renameHandler, moveFileToTrashHandler, copyFileHandler, pasteFileHandler, deleteFileHandler, cutFileHandler, DOWNLOAD_COMMAND_ID, openFilePreserveFocusHandler, DOWNLOAD_LABEL } from 'vs/workbench/contrib/files/browser/fileActions'; -import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/contrib/files/browser/textFileSaveErrorHandler'; +import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler'; import { SyncActionDescriptor, MenuId, MenuRegistry, ILocalizedString } from 'vs/platform/actions/common/actions'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index 49e1d3a2ca1..dfca325affb 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -16,7 +16,7 @@ import { IEditorInputFactory, EditorInput, IFileEditorInput, IEditorInputFactory import { AutoSaveConfiguration, HotExitConfiguration } from 'vs/platform/files/common/files'; import { VIEWLET_ID, SortOrderConfiguration, FILE_EDITOR_INPUT_ID, IExplorerService } from 'vs/workbench/contrib/files/common/files'; import { FileEditorTracker } from 'vs/workbench/contrib/files/browser/editors/fileEditorTracker'; -import { TextFileSaveErrorHandler } from 'vs/workbench/contrib/files/browser/textFileSaveErrorHandler'; +import { TextFileSaveErrorHandler } from 'vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler'; import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { BinaryFileEditor } from 'vs/workbench/contrib/files/browser/editors/binaryFileEditor'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; From 44a7203e4a969071e675fb0ab3fc82095f31b715 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 08:21:45 +0100 Subject: [PATCH 265/637] Revert "#84283 use log service to log" This reverts commit 26e9cf4fa097b37b0a944be55aa280195fb6b40d. --- src/vs/workbench/api/node/extHostOutputService.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index 4e6d32c4967..fd194124907 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -14,7 +14,6 @@ import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputSe import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { MutableDisposable } from 'vs/base/common/lifecycle'; -import { ILogService } from 'vs/platform/log/common/log'; export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel { @@ -56,7 +55,6 @@ export class ExtHostOutputService2 extends ExtHostOutputService { constructor( @IExtHostRpcService extHostRpc: IExtHostRpcService, - @ILogService private readonly logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, ) { super(extHostRpc); @@ -92,7 +90,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService { return new ExtHostOutputChannelBackedByFile(name, appender, this._proxy); } catch (error) { // Do not crash if logger cannot be created - this.logService.error(error); + console.log(error); return new ExtHostPushOutputChannel(name, this._proxy); } } From 5775c519afe2b51b4758e8de8259833597037696 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 08:28:55 +0100 Subject: [PATCH 266/637] debt - reload any text model that is opened in any editor on window focus --- .../browser/editors/fileEditorTracker.ts | 328 ++++++++++-------- 1 file changed, 183 insertions(+), 145 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 38c3af8239f..1d5b1ce6e89 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -28,9 +28,10 @@ import { ResourceQueue, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; import { withNullAsUndefined } from 'vs/base/common/types'; import { EditorActivation, ITextEditorOptions } from 'vs/platform/editor/common/editor'; +import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { - private closeOnFileDelete: boolean | undefined; + private closeOnFileDelete: boolean = false; private readonly modelLoadQueue = new ResourceQueue(); private readonly activeOutOfWorkspaceWatchers = new ResourceMap(); @@ -43,7 +44,8 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut @IEnvironmentService private readonly environmentService: IEnvironmentService, @IConfigurationService private readonly configurationService: IConfigurationService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, - @IHostService private readonly hostService: IHostService + @IHostService private readonly hostService: IHostService, + @ICodeEditorService private readonly codeEditorService: ICodeEditorService ) { super(); @@ -64,7 +66,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut this._register(this.textFileService.models.onModelsDirty(e => this.onTextFilesDirty(e))); // Out of workspace file watchers - this._register(this.editorService.onDidVisibleEditorsChange(() => this.handleOutOfWorkspaceWatchers())); + this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidVisibleEditorsChange())); // Update visible editors when focus is gained this._register(this.hostService.onDidChangeFocus(e => this.onWindowFocusChange(e))); @@ -76,31 +78,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut this.lifecycleService.onShutdown(this.dispose, this); } - private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void { - if (typeof configuration.workbench?.editor?.closeOnFileDelete === 'boolean') { - this.closeOnFileDelete = configuration.workbench.editor.closeOnFileDelete; - } else { - this.closeOnFileDelete = false; // default - } - } - - private onWindowFocusChange(focused: boolean): void { - if (focused) { - // the window got focus and we use this as a hint that files might have been changed outside - // of this window. since file events can be unreliable, we queue a load for models that - // are visible in any editor. since this is a fast operation in the case nothing has changed, - // we tolerate the additional work. - distinct( - coalesce(this.editorService.visibleEditors - .map(editorInput => { - const resource = toResource(editorInput, { supportSideBySide: SideBySideEditorChoice.MASTER }); - return resource ? this.textFileService.models.get(resource) : undefined; - })) - .filter(model => !model.isDirty()), - model => model.resource.toString() - ).forEach(model => this.queueModelLoad(model)); - } - } + //#region Handle deletes and moves in opened editors // Note: there is some duplication with the other file event handler below. Since we cannot always rely on the disk events // carrying all necessary data in all environments, we also use the file operation events to make sure operations are handled. @@ -119,98 +97,6 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut } } - private onFileChanges(e: FileChangesEvent): void { - - // Handle updates - if (e.gotAdded() || e.gotUpdated()) { - this.handleUpdates(e); - } - - // Handle deletes - if (e.gotDeleted()) { - this.handleDeletes(e, true); - } - } - - private handleDeletes(arg1: URI | FileChangesEvent, isExternal: boolean, movedTo?: URI): void { - const nonDirtyFileEditors = this.getOpenedFileEditors(false /* non-dirty only */); - nonDirtyFileEditors.forEach(async editor => { - const resource = editor.getResource(); - - // Handle deletes in opened editors depending on: - // - the user has not disabled the setting closeOnFileDelete - // - the file change is local or external - // - the input is not resolved (we need to dispose because we cannot restore otherwise since we do not have the contents) - if (this.closeOnFileDelete || !isExternal || !editor.isResolved()) { - - // Do NOT close any opened editor that matches the resource path (either equal or being parent) of the - // resource we move to (movedTo). Otherwise we would close a resource that has been renamed to the same - // path but different casing. - if (movedTo && resources.isEqualOrParent(resource, movedTo)) { - return; - } - - let matches = false; - if (arg1 instanceof FileChangesEvent) { - matches = arg1.contains(resource, FileChangeType.DELETED); - } else { - matches = resources.isEqualOrParent(resource, arg1); - } - - if (!matches) { - return; - } - - // We have received reports of users seeing delete events even though the file still - // exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665). - // Since we do not want to close an editor without reason, we have to check if the - // file is really gone and not just a faulty file event. - // This only applies to external file events, so we need to check for the isExternal - // flag. - let exists = false; - if (isExternal) { - await timeout(100); - exists = await this.fileService.exists(resource); - } - - if (!exists && !editor.isDisposed()) { - editor.dispose(); - } else if (this.environmentService.verbose) { - console.warn(`File exists even though we received a delete event: ${resource.toString()}`); - } - } - }); - } - - private getOpenedFileEditors(dirtyState: boolean): FileEditorInput[] { - const editors: FileEditorInput[] = []; - - this.editorService.editors.forEach(editor => { - if (editor instanceof FileEditorInput) { - if (!!editor.isDirty() === dirtyState) { - editors.push(editor); - } - } else if (editor instanceof SideBySideEditorInput) { - const master = editor.master; - const details = editor.details; - - if (master instanceof FileEditorInput) { - if (!!master.isDirty() === dirtyState) { - editors.push(master); - } - } - - if (details instanceof FileEditorInput) { - if (!!details.isDirty() === dirtyState) { - editors.push(details); - } - } - } - }); - - return editors; - } - private handleMovedFileInOpenedEditors(oldResource: URI, newResource: URI): void { this.editorGroupService.groups.forEach(group => { group.editors.forEach(editor => { @@ -293,6 +179,102 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut return undefined; } + private handleDeletes(arg1: URI | FileChangesEvent, isExternal: boolean, movedTo?: URI): void { + const nonDirtyFileEditors = this.getOpenedFileEditors(false /* non-dirty only */); + nonDirtyFileEditors.forEach(async editor => { + const resource = editor.getResource(); + + // Handle deletes in opened editors depending on: + // - the user has not disabled the setting closeOnFileDelete + // - the file change is local or external + // - the input is not resolved (we need to dispose because we cannot restore otherwise since we do not have the contents) + if (this.closeOnFileDelete || !isExternal || !editor.isResolved()) { + + // Do NOT close any opened editor that matches the resource path (either equal or being parent) of the + // resource we move to (movedTo). Otherwise we would close a resource that has been renamed to the same + // path but different casing. + if (movedTo && resources.isEqualOrParent(resource, movedTo)) { + return; + } + + let matches = false; + if (arg1 instanceof FileChangesEvent) { + matches = arg1.contains(resource, FileChangeType.DELETED); + } else { + matches = resources.isEqualOrParent(resource, arg1); + } + + if (!matches) { + return; + } + + // We have received reports of users seeing delete events even though the file still + // exists (network shares issue: https://github.com/Microsoft/vscode/issues/13665). + // Since we do not want to close an editor without reason, we have to check if the + // file is really gone and not just a faulty file event. + // This only applies to external file events, so we need to check for the isExternal + // flag. + let exists = false; + if (isExternal) { + await timeout(100); + exists = await this.fileService.exists(resource); + } + + if (!exists && !editor.isDisposed()) { + editor.dispose(); + } else if (this.environmentService.verbose) { + console.warn(`File exists even though we received a delete event: ${resource.toString()}`); + } + } + }); + } + + private getOpenedFileEditors(dirtyState: boolean): FileEditorInput[] { + const editors: FileEditorInput[] = []; + + this.editorService.editors.forEach(editor => { + if (editor instanceof FileEditorInput) { + if (!!editor.isDirty() === dirtyState) { + editors.push(editor); + } + } else if (editor instanceof SideBySideEditorInput) { + const master = editor.master; + const details = editor.details; + + if (master instanceof FileEditorInput) { + if (!!master.isDirty() === dirtyState) { + editors.push(master); + } + } + + if (details instanceof FileEditorInput) { + if (!!details.isDirty() === dirtyState) { + editors.push(details); + } + } + } + }); + + return editors; + } + + //#endregion + + //#region Update text models and binary editors on external changes + + private onFileChanges(e: FileChangesEvent): void { + + // Handle updates + if (e.gotAdded() || e.gotUpdated()) { + this.handleUpdates(e); + } + + // Handle deletes + if (e.gotDeleted()) { + this.handleDeletes(e, true); + } + } + private handleUpdates(e: FileChangesEvent): void { // Handle updates to text models @@ -346,32 +328,9 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut }); } - private handleOutOfWorkspaceWatchers(): void { - const visibleOutOfWorkspacePaths = new ResourceMap(); - coalesce(this.editorService.visibleEditors.map(editorInput => { - return toResource(editorInput, { supportSideBySide: SideBySideEditorChoice.MASTER }); - })).filter(resource => { - return this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource); - }).forEach(resource => { - visibleOutOfWorkspacePaths.set(resource, resource); - }); + //#endregion - // Handle no longer visible out of workspace resources - this.activeOutOfWorkspaceWatchers.keys().forEach(resource => { - if (!visibleOutOfWorkspacePaths.get(resource)) { - dispose(this.activeOutOfWorkspaceWatchers.get(resource)); - this.activeOutOfWorkspaceWatchers.delete(resource); - } - }); - - // Handle newly visible out of workspace resources - visibleOutOfWorkspacePaths.forEach(resource => { - if (!this.activeOutOfWorkspaceWatchers.get(resource)) { - const disposable = this.fileService.watch(resource); - this.activeOutOfWorkspaceWatchers.set(resource, disposable); - } - }); - } + //#region Open dirty text files if not opened already private onTextFilesDirty(e: readonly TextFileModelChangeEvent[]): void { @@ -398,6 +357,85 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut })); } + //#endregion + + //#region Out of workspace file watchers + + private onDidVisibleEditorsChange(): void { + const visibleOutOfWorkspacePaths = new ResourceMap(); + coalesce(this.editorService.visibleEditors.map(editorInput => { + return toResource(editorInput, { supportSideBySide: SideBySideEditorChoice.MASTER }); + })).filter(resource => { + return this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource); + }).forEach(resource => { + visibleOutOfWorkspacePaths.set(resource, resource); + }); + + // Handle no longer visible out of workspace resources + this.activeOutOfWorkspaceWatchers.keys().forEach(resource => { + if (!visibleOutOfWorkspacePaths.get(resource)) { + dispose(this.activeOutOfWorkspaceWatchers.get(resource)); + this.activeOutOfWorkspaceWatchers.delete(resource); + } + }); + + // Handle newly visible out of workspace resources + visibleOutOfWorkspacePaths.forEach(resource => { + if (!this.activeOutOfWorkspaceWatchers.get(resource)) { + const disposable = this.fileService.watch(resource); + this.activeOutOfWorkspaceWatchers.set(resource, disposable); + } + }); + } + + //#endregion + + //#region Window Focus Change: Update visible code editors when focus is gained + + private onWindowFocusChange(focused: boolean): void { + if (focused) { + // the window got focus and we use this as a hint that files might have been changed outside + // of this window. since file events can be unreliable, we queue a load for models that + // are visible in any editor. since this is a fast operation in the case nothing has changed, + // we tolerate the additional work. + distinct( + coalesce(this.codeEditorService.listCodeEditors() + .map(codeEditor => { + const resource = codeEditor.getModel()?.uri; + if (!resource) { + return undefined; + } + + const model = this.textFileService.models.get(resource); + if (!model) { + return undefined; + } + + if (model.isDirty()) { + return undefined; + } + + return model; + })), + model => model.resource.toString() + ).forEach(model => this.queueModelLoad(model)); + } + } + + //#endregion + + //#region Configuration Change + + private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void { + if (typeof configuration.workbench?.editor?.closeOnFileDelete === 'boolean') { + this.closeOnFileDelete = configuration.workbench.editor.closeOnFileDelete; + } else { + this.closeOnFileDelete = false; // default + } + } + + //#endregion + dispose(): void { super.dispose(); From fc8777550a90e176a72cd895a993581ab53c0e0b Mon Sep 17 00:00:00 2001 From: Marvin Heilemann Date: Tue, 10 Dec 2019 08:44:53 +0100 Subject: [PATCH 267/637] Rolled back changes to better see my changes (thanks to wrong configured prettier) --- .../themes/browser/workbenchThemeService.ts | 402 ++++-------------- .../themes/common/workbenchThemeService.ts | 38 +- 2 files changed, 94 insertions(+), 346 deletions(-) diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index b567c70281f..c6c906e5cb0 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -6,41 +6,13 @@ import * as nls from 'vs/nls'; import * as types from 'vs/base/common/types'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { - IWorkbenchThemeService, - IColorTheme, - ITokenColorCustomizations, - IFileIconTheme, - ExtensionData, - VS_LIGHT_THEME, - VS_DARK_THEME, - VS_HC_THEME, - COLOR_THEME_SETTING, - ICON_THEME_SETTING, - CUSTOM_WORKBENCH_COLORS_SETTING, - CUSTOM_EDITOR_COLORS_SETTING, - DETECT_HC_SETTING, - HC_THEME_ID, - IColorCustomizations, - CUSTOM_EDITOR_TOKENSTYLES_SETTING, - IExperimentalTokenStyleCustomizations, - COLOR_THEME_DARK_SETTING, - COLOR_THEME_LIGHT_SETTING, - DETECT_AS_SETTING, - ColorScheme, - WINDOW_MATCH_PREFERS_COLOR_SCHEME -} from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { IWorkbenchThemeService, IColorTheme, ITokenColorCustomizations, IFileIconTheme, ExtensionData, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME, COLOR_THEME_SETTING, ICON_THEME_SETTING, CUSTOM_WORKBENCH_COLORS_SETTING, CUSTOM_EDITOR_COLORS_SETTING, DETECT_HC_SETTING, HC_THEME_ID, IColorCustomizations, CUSTOM_EDITOR_TOKENSTYLES_SETTING, IExperimentalTokenStyleCustomizations } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Registry } from 'vs/platform/registry/common/platform'; import * as errors from 'vs/base/common/errors'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; -import { - IConfigurationRegistry, - Extensions as ConfigurationExtensions, - IConfigurationPropertySchema, - IConfigurationNode -} from 'vs/platform/configuration/common/configurationRegistry'; +import { IConfigurationRegistry, Extensions as ConfigurationExtensions, IConfigurationPropertySchema, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry'; import { ColorThemeData } from 'vs/workbench/services/themes/common/colorThemeData'; import { ITheme, Extensions as ThemingExtensions, IThemingRegistry } from 'vs/platform/theme/common/themeService'; import { Event, Emitter } from 'vs/base/common/event'; @@ -55,11 +27,7 @@ import { IFileService, FileChangeType } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import * as resources from 'vs/base/common/resources'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; -import { - textmateColorsSchemaId, - registerColorThemeSchemas, - textmateColorSettingsSchemaId -} from 'vs/workbench/services/themes/common/colorThemeSchema'; +import { textmateColorsSchemaId, registerColorThemeSchemas, textmateColorSettingsSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'; import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; @@ -71,9 +39,6 @@ import { IExtensionResourceLoaderService } from 'vs/workbench/services/extension const DEFAULT_THEME_ID = 'vs-dark vscode-theme-defaults-themes-dark_plus-json'; const DEFAULT_THEME_SETTING_VALUE = 'Default Dark+'; -const DEFAULT_THEME_DARK_SETTING_VALUE = 'Default Dark+'; -const DEFAULT_THEME_LIGHT_SETTING_VALUE = 'Default Light+'; -const DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE = true; const PERSISTED_THEME_STORAGE_KEY = 'colorThemeData'; const PERSISTED_ICON_THEME_STORAGE_KEY = 'iconThemeData'; @@ -93,16 +58,11 @@ const themingRegistry = Registry.as(ThemingExtensions.ThemingC function validateThemeId(theme: string): string { // migrations switch (theme) { - case VS_LIGHT_THEME: - return `vs ${defaultThemeExtensionId}-themes-light_vs-json`; - case VS_DARK_THEME: - return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`; - case VS_HC_THEME: - return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`; - case `vs ${oldDefaultThemeExtensionId}-themes-light_plus-tmTheme`: - return `vs ${defaultThemeExtensionId}-themes-light_plus-json`; - case `vs-dark ${oldDefaultThemeExtensionId}-themes-dark_plus-tmTheme`: - return `vs-dark ${defaultThemeExtensionId}-themes-dark_plus-json`; + case VS_LIGHT_THEME: return `vs ${defaultThemeExtensionId}-themes-light_vs-json`; + case VS_DARK_THEME: return `vs-dark ${defaultThemeExtensionId}-themes-dark_vs-json`; + case VS_HC_THEME: return `hc-black ${defaultThemeExtensionId}-themes-hc_black-json`; + case `vs ${oldDefaultThemeExtensionId}-themes-light_plus-tmTheme`: return `vs ${defaultThemeExtensionId}-themes-light_plus-json`; + case `vs-dark ${oldDefaultThemeExtensionId}-themes-dark_plus-tmTheme`: return `vs-dark ${defaultThemeExtensionId}-themes-dark_plus-json`; } return theme; } @@ -111,8 +71,6 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { _serviceBrand: undefined; private colorThemeStore: ColorThemeStore; - private autoSwitchColorTheme = DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE; - private autoSwitchColorThemeListener: MediaQueryList | undefined = undefined; private currentColorTheme: ColorThemeData; private container: HTMLElement; private readonly onColorThemeChange: Emitter; @@ -136,9 +94,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } private get tokenStylesCustomizations(): IExperimentalTokenStyleCustomizations { - return ( - this.configurationService.getValue(CUSTOM_EDITOR_TOKENSTYLES_SETTING) || {} - ); + return this.configurationService.getValue(CUSTOM_EDITOR_TOKENSTYLES_SETTING) || {}; } constructor( @@ -151,13 +107,13 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { @IExtensionResourceLoaderService private readonly extensionResourceLoaderService: IExtensionResourceLoaderService, @IWorkbenchLayoutService readonly layoutService: IWorkbenchLayoutService ) { + this.container = layoutService.getWorkbenchContainer(); this.colorThemeStore = new ColorThemeStore(extensionService); this.onFileIconThemeChange = new Emitter(); this.iconThemeStore = new FileIconThemeStore(extensionService); this.onColorThemeChange = new Emitter({ leakWarningThreshold: 400 }); - this.onPreferColorSchemeChange = this.onPreferColorSchemeChange.bind(this); this.currentColorTheme = ColorThemeData.createUnloadedTheme(''); this.currentIconTheme = FileIconThemeData.createUnloadedTheme(''); @@ -190,12 +146,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } } - this.initialize() - .then(undefined, errors.onUnexpectedError) - .then(_ => { - this.installConfigurationListener(); - this.installColorThemeSwitch(); - }); + this.initialize().then(undefined, errors.onUnexpectedError).then(_ => { + this.installConfigurationListener(); + }); let prevColorId: string | undefined = undefined; @@ -224,10 +177,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { tokenColorCustomizationSchema.allOf![1] = themeSpecificTokenColors; experimentalTokenStylingCustomizationSchema.allOf![1] = themeSpecificTokenStyling; - configurationRegistry.notifyConfigurationSchemaUpdated( - themeSettingsConfiguration, - tokenColorCustomizationConfiguration - ); + configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration, tokenColorCustomizationConfiguration); if (this.currentColorTheme.isLoaded) { const themeData = await this.colorThemeStore.findThemeData(this.currentColorTheme.id); @@ -236,11 +186,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { prevColorId = this.currentColorTheme.id; this.setColorTheme(DEFAULT_THEME_ID, 'auto'); } else { - if ( - this.currentColorTheme.id === DEFAULT_THEME_ID && - !types.isUndefined(prevColorId) && - (await this.colorThemeStore.findThemeData(prevColorId)) - ) { + if (this.currentColorTheme.id === DEFAULT_THEME_ID && !types.isUndefined(prevColorId) && await this.colorThemeStore.findThemeData(prevColorId)) { // restore color this.setColorTheme(prevColorId, 'auto'); prevColorId = undefined; @@ -254,10 +200,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { let prevFileIconId: string | undefined = undefined; this.iconThemeStore.onDidChange(async event => { iconThemeSettingSchema.enum = [null, ...event.themes.map(t => t.settingsId)]; - iconThemeSettingSchema.enumDescriptions = [ - iconThemeSettingSchema.enumDescriptions![0], - ...event.themes.map(t => t.description || '') - ]; + iconThemeSettingSchema.enumDescriptions = [iconThemeSettingSchema.enumDescriptions![0], ...event.themes.map(t => t.description || '')]; configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration); if (this.currentIconTheme.isLoaded) { @@ -268,11 +211,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.setFileIconTheme(DEFAULT_ICON_THEME_ID, 'auto'); } else { // restore color - if ( - this.currentIconTheme.id === DEFAULT_ICON_THEME_ID && - !types.isUndefined(prevFileIconId) && - (await this.iconThemeStore.findThemeData(prevFileIconId)) - ) { + if (this.currentIconTheme.id === DEFAULT_ICON_THEME_ID && !types.isUndefined(prevFileIconId) && await this.iconThemeStore.findThemeData(prevFileIconId)) { this.setFileIconTheme(prevFileIconId, 'auto'); prevFileIconId = undefined; } else { @@ -283,18 +222,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { }); this.fileService.onFileChanges(async e => { - if ( - this.watchedColorThemeLocation && - this.currentColorTheme && - e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED) - ) { + if (this.watchedColorThemeLocation && this.currentColorTheme && e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED)) { this.reloadCurrentColorTheme(); } - if ( - this.watchedIconThemeLocation && - this.currentIconTheme && - e.contains(this.watchedIconThemeLocation, FileChangeType.UPDATED) - ) { + if (this.watchedIconThemeLocation && this.currentIconTheme && e.contains(this.watchedIconThemeLocation, FileChangeType.UPDATED)) { this.reloadCurrentFileIconTheme(); } }); @@ -317,20 +248,17 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } private initialize(): Promise<[IColorTheme | null, IFileIconTheme | null]> { - let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); - let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); - - let detectThemeAutoSwitch = this.configurationService.getValue(DETECT_AS_SETTING); - this.autoSwitchColorTheme = detectThemeAutoSwitch; - if (detectThemeAutoSwitch) { - colorThemeSetting = this.getPreferredTheme(); - } - let detectHCThemeSetting = this.configurationService.getValue(DETECT_HC_SETTING); + + let colorThemeSetting: string; if (this.environmentService.configuration.highContrast && detectHCThemeSetting) { colorThemeSetting = HC_THEME_ID; + } else { + colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); } + let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); + const extDevLocs = this.environmentService.extensionDevelopmentLocationURI; let uri: URI | undefined; if (extDevLocs && extDevLocs.length > 0) { @@ -339,7 +267,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } return Promise.all([ - this.getColorThemeData(colorThemeSetting).then(theme => { + this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { return this.colorThemeStore.findThemeDataByParentLocation(uri).then(devThemes => { if (devThemes.length) { return this.setColorTheme(devThemes[0].id, ConfigurationTarget.MEMORY); @@ -356,76 +284,20 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.setFileIconTheme(theme ? theme.id : DEFAULT_ICON_THEME_ID, undefined); } }); - }) + }), ]); } - private installColorThemeSwitch() { - console.log('INSTALL'); - this.autoSwitchColorThemeListener = window.matchMedia(WINDOW_MATCH_PREFERS_COLOR_SCHEME); - this.autoSwitchColorThemeListener.addListener(this.onPreferColorSchemeChange); - console.log('INSTALLED'); - } - - private deinstallColorThemeSwitch() { - console.log('DEINSTALL'); - if (this.autoSwitchColorThemeListener) { - this.autoSwitchColorThemeListener.removeListener(this.onPreferColorSchemeChange); - this.configurationService.updateValue(DETECT_AS_SETTING, false); - console.log('DEINSTALLED'); - } - } - - private onPreferColorSchemeChange({ matches }: MediaQueryListEvent) { - console.log('onPreferColorSchemeChange', matches); - let themeName = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); - if (matches) { - // prefers dark mode - themeName = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); - } - this.setTheme(themeName); - } - - private getPreferredTheme(): string { - let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); - const darkMode = this.getPreferredColorScheme() === ColorScheme.DARK; - if (darkMode) { - colorThemeSetting = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); - } - return colorThemeSetting; - } - - private setTheme(themeName: string) { - this.getColorThemeData(themeName).then(theme => { - if (theme) { - this.setColorTheme(theme.id, undefined); - this.configurationService.updateValue(COLOR_THEME_SETTING, themeName); - } - }); - } - private installConfigurationListener() { this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(COLOR_THEME_SETTING)) { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.setTheme(colorThemeSetting); - this.deinstallColorThemeSwitch(); - } - } - if (e.affectsConfiguration(DETECT_AS_SETTING)) { - let autoSwitchColorTheme = this.configurationService.getValue(DETECT_AS_SETTING); - console.log(autoSwitchColorTheme); - if (this.autoSwitchColorTheme !== autoSwitchColorTheme) { - this.autoSwitchColorTheme = autoSwitchColorTheme; - console.log('HAS CHANGED'); - if (autoSwitchColorTheme) { - this.installColorThemeSwitch(); - let themeName = this.getPreferredTheme(); - this.setTheme(themeName); - } else { - this.deinstallColorThemeSwitch(); - } + this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { + if (theme) { + this.setColorTheme(theme.id, undefined); + } + }); } } if (e.affectsConfiguration(ICON_THEME_SETTING)) { @@ -466,33 +338,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.colorThemeStore.getColorThemes(); } - public getColorThemeData(colorThemeSetting: string): Promise { - return new Promise(resolve => { - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { - resolve(theme); - }); - }); - } - - public getPreferredColorScheme(): ColorScheme { - const noPreference = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.NO_PREFERENCE})`).matches; - const prefersDark = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.DARK})`).matches; - if (noPreference) { - return ColorScheme.NO_PREFERENCE; - } else if (prefersDark) { - return ColorScheme.DARK; - } - return ColorScheme.LIGHT; - } - public getTheme(): ITheme { return this.getColorTheme(); } - public setColorTheme( - themeId: string | undefined, - settingsTarget: ConfigurationTarget | undefined | 'auto' - ): Promise { + public setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { if (!themeId) { return Promise.resolve(null); } @@ -507,40 +357,24 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return null; } const themeData = data; - return themeData.ensureLoaded(this.extensionResourceLoaderService).then( - _ => { - if ( - themeId === this.currentColorTheme.id && - !this.currentColorTheme.isLoaded && - this.currentColorTheme.hasEqualData(themeData) - ) { - this.currentColorTheme.clearCaches(); - // the loaded theme is identical to the perisisted theme. Don't need to send an event. - this.currentColorTheme = themeData; - themeData.setCustomColors(this.colorCustomizations); - themeData.setCustomTokenColors(this.tokenColorCustomizations); - themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); - return Promise.resolve(themeData); - } + return themeData.ensureLoaded(this.extensionResourceLoaderService).then(_ => { + if (themeId === this.currentColorTheme.id && !this.currentColorTheme.isLoaded && this.currentColorTheme.hasEqualData(themeData)) { + this.currentColorTheme.clearCaches(); + // the loaded theme is identical to the perisisted theme. Don't need to send an event. + this.currentColorTheme = themeData; themeData.setCustomColors(this.colorCustomizations); themeData.setCustomTokenColors(this.tokenColorCustomizations); themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); - this.updateDynamicCSSRules(themeData); - return this.applyTheme(themeData, settingsTarget); - }, - error => { - return Promise.reject( - new Error( - nls.localize( - 'error.cannotloadtheme', - 'Unable to load {0}: {1}', - themeData.location!.toString(), - error.message - ) - ) - ); + return Promise.resolve(themeData); } - ); + themeData.setCustomColors(this.colorCustomizations); + themeData.setCustomTokenColors(this.tokenColorCustomizations); + themeData.setCustomTokenStyleRules(this.tokenStylesCustomizations); + this.updateDynamicCSSRules(themeData); + return this.applyTheme(themeData, settingsTarget); + }, error => { + return Promise.reject(new Error(nls.localize('error.cannotloadtheme', "Unable to load {0}: {1}", themeData.location!.toString(), error.message))); + }); }); } @@ -556,7 +390,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { public restoreColorTheme() { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.setTheme(colorThemeSetting); + this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { + if (theme) { + this.setColorTheme(theme.id, undefined); + } + }); } } @@ -573,11 +411,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { _applyRules([...cssRules].join('\n'), colorThemeRulesClassName); } - private applyTheme( - newTheme: ColorThemeData, - settingsTarget: ConfigurationTarget | undefined | 'auto', - silent = false - ): Promise { + private applyTheme(newTheme: ColorThemeData, settingsTarget: ConfigurationTarget | undefined | 'auto', silent = false): Promise { if (this.currentColorTheme.id) { removeClasses(this.container, this.currentColorTheme.id); } else { @@ -588,9 +422,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.currentColorTheme.clearCaches(); this.currentColorTheme = newTheme; if (!this.themingParticipantChangeListener) { - this.themingParticipantChangeListener = themingRegistry.onThemingParticipantAdded(_ => - this.updateDynamicCSSRules(this.currentColorTheme) - ); + this.themingParticipantChangeListener = themingRegistry.onThemingParticipantAdded(_ => this.updateDynamicCSSRules(this.currentColorTheme)); } if (this.fileService && !resources.isEqual(newTheme.location, this.watchedColorThemeLocation)) { @@ -621,9 +453,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { private writeColorThemeConfiguration(settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { if (!types.isUndefinedOrNull(settingsTarget)) { - return this.writeConfiguration(COLOR_THEME_SETTING, this.currentColorTheme.settingsId, settingsTarget).then( - _ => this.currentColorTheme - ); + return this.writeConfiguration(COLOR_THEME_SETTING, this.currentColorTheme.settingsId, settingsTarget).then(_ => this.currentColorTheme); } return Promise.resolve(this.currentColorTheme); } @@ -634,11 +464,11 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { let key = themeType + themeData.extensionId; if (!this.themeExtensionsActivated.get(key)) { type ActivatePluginClassification = { - id: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; - name: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; - isBuiltin: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true }; - publisherDisplayName: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' }; - themeId: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight' }; + id: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; + name: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; + isBuiltin: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }; + publisherDisplayName: { classification: 'SystemMetaData', purpose: 'FeatureInsight' }; + themeId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' }; }; type ActivatePluginEvent = { id: string; @@ -671,10 +501,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.currentIconTheme; } - public setFileIconTheme( - iconTheme: string | undefined, - settingsTarget: ConfigurationTarget | undefined | 'auto' - ): Promise { + public setFileIconTheme(iconTheme: string | undefined, settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { iconTheme = iconTheme || ''; if (iconTheme === this.currentIconTheme.id && this.currentIconTheme.isLoaded) { return this.writeFileIconConfiguration(settingsTarget); @@ -730,10 +557,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { dispose(this.watchedIconThemeDisposable); this.watchedIconThemeLocation = undefined; - if ( - iconThemeData.location && - (iconThemeData.watch || !!this.environmentService.extensionDevelopmentLocationURI) - ) { + if (iconThemeData.location && (iconThemeData.watch || !!this.environmentService.extensionDevelopmentLocationURI)) { this.watchedIconThemeLocation = iconThemeData.location; this.watchedIconThemeDisposable = this.fileService.watch(iconThemeData.location); } @@ -743,15 +567,12 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.sendTelemetry(iconThemeData.id, iconThemeData.extensionData, 'fileIcon'); } this.onFileIconThemeChange.fire(this.currentIconTheme); + } - private writeFileIconConfiguration( - settingsTarget: ConfigurationTarget | undefined | 'auto' - ): Promise { + private writeFileIconConfiguration(settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { if (!types.isUndefinedOrNull(settingsTarget)) { - return this.writeConfiguration(ICON_THEME_SETTING, this.currentIconTheme.settingsId, settingsTarget).then( - _ => this.currentIconTheme - ); + return this.writeConfiguration(ICON_THEME_SETTING, this.currentIconTheme.settingsId, settingsTarget).then(_ => this.currentIconTheme); } return Promise.resolve(this.currentIconTheme); } @@ -777,10 +598,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } value = undefined; // remove configuration from user settings } - } else if ( - settingsTarget === ConfigurationTarget.WORKSPACE || - settingsTarget === ConfigurationTarget.WORKSPACE_FOLDER - ) { + } else if (settingsTarget === ConfigurationTarget.WORKSPACE || settingsTarget === ConfigurationTarget.WORKSPACE_FOLDER) { if (value === settings.value) { return Promise.resolve(undefined); // nothing to do } @@ -799,10 +617,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } } -function _applyIconTheme( - data: FileIconThemeData, - onApply: (theme: FileIconThemeData) => Promise -): Promise { +function _applyIconTheme(data: FileIconThemeData, onApply: (theme: FileIconThemeData) => Promise): Promise { _applyRules(data.styleSheetContent!, iconThemeRulesClassName); return onApply(data); } @@ -828,49 +643,30 @@ const configurationRegistry = Registry.as(ConfigurationE const colorThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', - description: nls.localize('colorTheme', 'Specifies the color theme used in the workbench.'), + description: nls.localize('colorTheme', "Specifies the color theme used in the workbench."), default: DEFAULT_THEME_SETTING_VALUE, - errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') -}; -const colorThemeDarkSettingSchema: IConfigurationPropertySchema = { - type: 'string', - description: nls.localize('colorThemeDark', 'Specifies the color theme used for a dark OS appearance.'), - default: DEFAULT_THEME_DARK_SETTING_VALUE, - errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') -}; -const colorThemeLightSettingSchema: IConfigurationPropertySchema = { - type: 'string', - description: nls.localize('colorThemeLight', 'Specifies the color theme used for a light OS appearance.'), - default: DEFAULT_THEME_LIGHT_SETTING_VALUE, - errorMessage: nls.localize('colorThemeError', 'Theme is unknown or not installed.') -}; -const colorThemeAutoSwitchSettingSchema: IConfigurationPropertySchema = { - type: 'boolean', - description: nls.localize('colorThemeAutoSwitch', 'Changes the color theme based on the OS appearance.'), - default: DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE + enum: [], + enumDescriptions: [], + errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."), }; const iconThemeSettingSchema: IConfigurationPropertySchema = { type: ['string', 'null'], default: DEFAULT_ICON_THEME_SETTING_VALUE, - description: nls.localize( - 'iconTheme', - "Specifies the icon theme used in the workbench or 'null' to not show any file icons." - ), + description: nls.localize('iconTheme', "Specifies the icon theme used in the workbench or 'null' to not show any file icons."), enum: [null], enumDescriptions: [nls.localize('noIconThemeDesc', 'No file icons')], - errorMessage: nls.localize('iconThemeError', 'File icon theme is unknown or not installed.') + errorMessage: nls.localize('iconThemeError', "File icon theme is unknown or not installed.") }; const colorCustomizationsSchema: IConfigurationPropertySchema = { type: 'object', - description: nls.localize('workbenchColors', 'Overrides colors from the currently selected color theme.'), + description: nls.localize('workbenchColors', "Overrides colors from the currently selected color theme."), allOf: [{ $ref: workbenchColorsSchemaId }], default: {}, - defaultSnippets: [ - { - body: {} + defaultSnippets: [{ + body: { } - ] + }] }; const themeSettingsConfiguration: IConfigurationNode = { @@ -879,9 +675,6 @@ const themeSettingsConfiguration: IConfigurationNode = { type: 'object', properties: { [COLOR_THEME_SETTING]: colorThemeSettingSchema, - [COLOR_THEME_DARK_SETTING]: colorThemeDarkSettingSchema, - [COLOR_THEME_LIGHT_SETTING]: colorThemeLightSettingSchema, - [DETECT_AS_SETTING]: colorThemeAutoSwitchSettingSchema, [ICON_THEME_SETTING]: iconThemeSettingSchema, [CUSTOM_WORKBENCH_COLORS_SETTING]: colorCustomizationsSchema } @@ -906,45 +699,26 @@ function tokenGroupSettings(description: string): IJSONSchema { const tokenColorSchema: IJSONSchema = { properties: { - comments: tokenGroupSettings(nls.localize('editorColors.comments', 'Sets the colors and styles for comments')), - strings: tokenGroupSettings( - nls.localize('editorColors.strings', 'Sets the colors and styles for strings literals.') - ), - keywords: tokenGroupSettings(nls.localize('editorColors.keywords', 'Sets the colors and styles for keywords.')), - numbers: tokenGroupSettings( - nls.localize('editorColors.numbers', 'Sets the colors and styles for number literals.') - ), - types: tokenGroupSettings( - nls.localize('editorColors.types', 'Sets the colors and styles for type declarations and references.') - ), - functions: tokenGroupSettings( - nls.localize('editorColors.functions', 'Sets the colors and styles for functions declarations and references.') - ), - variables: tokenGroupSettings( - nls.localize('editorColors.variables', 'Sets the colors and styles for variables declarations and references.') - ), + comments: tokenGroupSettings(nls.localize('editorColors.comments', "Sets the colors and styles for comments")), + strings: tokenGroupSettings(nls.localize('editorColors.strings', "Sets the colors and styles for strings literals.")), + keywords: tokenGroupSettings(nls.localize('editorColors.keywords', "Sets the colors and styles for keywords.")), + numbers: tokenGroupSettings(nls.localize('editorColors.numbers', "Sets the colors and styles for number literals.")), + types: tokenGroupSettings(nls.localize('editorColors.types', "Sets the colors and styles for type declarations and references.")), + functions: tokenGroupSettings(nls.localize('editorColors.functions', "Sets the colors and styles for functions declarations and references.")), + variables: tokenGroupSettings(nls.localize('editorColors.variables', "Sets the colors and styles for variables declarations and references.")), textMateRules: { - description: nls.localize( - 'editorColors.textMateRules', - 'Sets colors and styles using textmate theming rules (advanced).' - ), + description: nls.localize('editorColors.textMateRules', 'Sets colors and styles using textmate theming rules (advanced).'), $ref: textmateColorsSchemaId } } }; const tokenColorCustomizationSchema: IConfigurationPropertySchema = { - description: nls.localize( - 'editorColors', - 'Overrides editor colors and font style from the currently selected color theme.' - ), + description: nls.localize('editorColors', "Overrides editor colors and font style from the currently selected color theme."), default: {}, allOf: [tokenColorSchema] }; const experimentalTokenStylingCustomizationSchema: IConfigurationPropertySchema = { - description: nls.localize( - 'editorColorsTokenStyles', - 'Overrides token color and styles from the currently selected color theme.' - ), + description: nls.localize('editorColorsTokenStyles', "Overrides token color and styles from the currently selected color theme."), default: {}, allOf: [{ $ref: tokenStylingSchemaId }] }; @@ -959,4 +733,4 @@ const tokenColorCustomizationConfiguration: IConfigurationNode = { }; configurationRegistry.registerConfiguration(tokenColorCustomizationConfiguration); -registerSingleton(IWorkbenchThemeService, WorkbenchThemeService); +registerSingleton(IWorkbenchThemeService, WorkbenchThemeService); \ No newline at end of file diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index 6577eb4a1d9..9fc33ebab82 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -18,22 +18,12 @@ export const VS_HC_THEME = 'hc-black'; export const HC_THEME_ID = 'Default High Contrast'; export const COLOR_THEME_SETTING = 'workbench.colorTheme'; -export const COLOR_THEME_DARK_SETTING = 'workbench.colorThemeDark'; -export const COLOR_THEME_LIGHT_SETTING = 'workbench.colorThemeLight'; -export const DETECT_AS_SETTING = 'workbench.colorThemeAutoSwitch'; -export const WINDOW_MATCH_PREFERS_COLOR_SCHEME = '(prefers-color-scheme: dark)'; export const DETECT_HC_SETTING = 'window.autoDetectHighContrast'; export const ICON_THEME_SETTING = 'workbench.iconTheme'; export const CUSTOM_WORKBENCH_COLORS_SETTING = 'workbench.colorCustomizations'; export const CUSTOM_EDITOR_COLORS_SETTING = 'editor.tokenColorCustomizations'; export const CUSTOM_EDITOR_TOKENSTYLES_SETTING = 'editor.tokenColorCustomizationsExperimental'; -export enum ColorScheme { - LIGHT = 'light', - DARK = 'dark', - NO_PREFERENCE = 'no-preference' -} - export interface IColorTheme extends ITheme { readonly id: string; readonly label: string; @@ -63,20 +53,13 @@ export interface IFileIconTheme extends IIconTheme { export interface IWorkbenchThemeService extends IThemeService { _serviceBrand: undefined; - setColorTheme( - themeId: string | undefined, - settingsTarget: ConfigurationTarget | undefined - ): Promise; + setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; getColorTheme(): IColorTheme; getColorThemes(): Promise; - getColorThemeData(colorThemeSetting: string): Promise; onDidColorThemeChange: Event; restoreColorTheme(): void; - setFileIconTheme( - iconThemeId: string | undefined, - settingsTarget: ConfigurationTarget | undefined - ): Promise; + setFileIconTheme(iconThemeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; getFileIconTheme(): IFileIconTheme; getFileIconThemes(): Promise; onDidFileIconThemeChange: Event; @@ -87,12 +70,7 @@ export interface IColorCustomizations { } export interface ITokenColorCustomizations { - [groupIdOrThemeSettingsId: string]: - | string - | ITokenColorizationSetting - | ITokenColorCustomizations - | undefined - | ITextMateThemingRule[]; + [groupIdOrThemeSettingsId: string]: string | ITokenColorizationSetting | ITokenColorCustomizations | undefined | ITextMateThemingRule[]; comments?: string | ITokenColorizationSetting; strings?: string | ITokenColorizationSetting; numbers?: string | ITokenColorizationSetting; @@ -104,11 +82,7 @@ export interface ITokenColorCustomizations { } export interface IExperimentalTokenStyleCustomizations { - [styleRuleOrThemeSettingsId: string]: - | string - | ITokenColorizationSetting - | IExperimentalTokenStyleCustomizations - | undefined; + [styleRuleOrThemeSettingsId: string]: string | ITokenColorizationSetting | IExperimentalTokenStyleCustomizations | undefined; } export interface ITextMateThemingRule { @@ -120,7 +94,7 @@ export interface ITextMateThemingRule { export interface ITokenColorizationSetting { foreground?: string; background?: string; - fontStyle?: string /* [italic|underline|bold] */; + fontStyle?: string; /* [italic|underline|bold] */ } export interface ExtensionData { @@ -137,4 +111,4 @@ export interface IThemeExtensionPoint { path: string; uiTheme?: typeof VS_LIGHT_THEME | typeof VS_DARK_THEME | typeof VS_HC_THEME; _watch: boolean; // unsupported options to watch location -} +} \ No newline at end of file From 247860eb56dd02265548bb8a96eaa5f2f594042e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 08:48:02 +0100 Subject: [PATCH 268/637] debt - watch for all out of workspace resources (support diffs) --- .../browser/editors/fileEditorTracker.ts | 28 +++++++++++-------- .../contrib/files/common/workspaceWatcher.ts | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 1d5b1ce6e89..cf9ceb02b40 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -359,28 +359,34 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut //#endregion - //#region Out of workspace file watchers + //#region Visible Editors Change: Install file watchers for out of workspace resources that became visible private onDidVisibleEditorsChange(): void { - const visibleOutOfWorkspacePaths = new ResourceMap(); - coalesce(this.editorService.visibleEditors.map(editorInput => { - return toResource(editorInput, { supportSideBySide: SideBySideEditorChoice.MASTER }); - })).filter(resource => { - return this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource); - }).forEach(resource => { - visibleOutOfWorkspacePaths.set(resource, resource); - }); + const visibleOutOfWorkspaceResources = new ResourceMap(); + + for (const editor of this.editorService.visibleEditors) { + const resources = distinct(coalesce([ + toResource(editor, { supportSideBySide: SideBySideEditorChoice.MASTER }), + toResource(editor, { supportSideBySide: SideBySideEditorChoice.DETAILS }) + ]), resource => resource.toString()); + + for (const resource of resources) { + if (this.fileService.canHandleResource(resource) && !this.contextService.isInsideWorkspace(resource)) { + visibleOutOfWorkspaceResources.set(resource, resource); + } + } + } // Handle no longer visible out of workspace resources this.activeOutOfWorkspaceWatchers.keys().forEach(resource => { - if (!visibleOutOfWorkspacePaths.get(resource)) { + if (!visibleOutOfWorkspaceResources.get(resource)) { dispose(this.activeOutOfWorkspaceWatchers.get(resource)); this.activeOutOfWorkspaceWatchers.delete(resource); } }); // Handle newly visible out of workspace resources - visibleOutOfWorkspacePaths.forEach(resource => { + visibleOutOfWorkspaceResources.forEach(resource => { if (!this.activeOutOfWorkspaceWatchers.get(resource)) { const disposable = this.fileService.watch(resource); this.activeOutOfWorkspaceWatchers.set(resource, disposable); diff --git a/src/vs/workbench/contrib/files/common/workspaceWatcher.ts b/src/vs/workbench/contrib/files/common/workspaceWatcher.ts index 661963d524a..04bfd96daba 100644 --- a/src/vs/workbench/contrib/files/common/workspaceWatcher.ts +++ b/src/vs/workbench/contrib/files/common/workspaceWatcher.ts @@ -17,7 +17,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; export class WorkspaceWatcher extends Disposable { - private watches = new ResourceMap(); + private readonly watches = new ResourceMap(); constructor( @IFileService private readonly fileService: FileService, From 6099ca39676d4ca225b035d62f3426568d4a70a1 Mon Sep 17 00:00:00 2001 From: Marvin Heilemann Date: Tue, 10 Dec 2019 09:02:16 +0100 Subject: [PATCH 269/637] Applied changes again --- .../themes/browser/workbenchThemeService.ts | 139 +++++++++++++++--- .../themes/common/workbenchThemeService.ts | 11 ++ 2 files changed, 131 insertions(+), 19 deletions(-) diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index c6c906e5cb0..59d2b9df791 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import * as types from 'vs/base/common/types'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -import { IWorkbenchThemeService, IColorTheme, ITokenColorCustomizations, IFileIconTheme, ExtensionData, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME, COLOR_THEME_SETTING, ICON_THEME_SETTING, CUSTOM_WORKBENCH_COLORS_SETTING, CUSTOM_EDITOR_COLORS_SETTING, DETECT_HC_SETTING, HC_THEME_ID, IColorCustomizations, CUSTOM_EDITOR_TOKENSTYLES_SETTING, IExperimentalTokenStyleCustomizations } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { IWorkbenchThemeService, IColorTheme, ITokenColorCustomizations, IFileIconTheme, ExtensionData, VS_LIGHT_THEME, VS_DARK_THEME, VS_HC_THEME, COLOR_THEME_SETTING, ICON_THEME_SETTING, CUSTOM_WORKBENCH_COLORS_SETTING, CUSTOM_EDITOR_COLORS_SETTING, DETECT_HC_SETTING, HC_THEME_ID, IColorCustomizations, CUSTOM_EDITOR_TOKENSTYLES_SETTING, IExperimentalTokenStyleCustomizations, DETECT_AS_SETTING, COLOR_THEME_DARK_SETTING, WINDOW_MATCH_PREFERS_COLOR_SCHEME, COLOR_THEME_LIGHT_SETTING, ColorScheme } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -39,6 +39,9 @@ import { IExtensionResourceLoaderService } from 'vs/workbench/services/extension const DEFAULT_THEME_ID = 'vs-dark vscode-theme-defaults-themes-dark_plus-json'; const DEFAULT_THEME_SETTING_VALUE = 'Default Dark+'; +const DEFAULT_THEME_DARK_SETTING_VALUE = 'Default Dark+'; +const DEFAULT_THEME_LIGHT_SETTING_VALUE = 'Default Light+'; +const DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE = true; const PERSISTED_THEME_STORAGE_KEY = 'colorThemeData'; const PERSISTED_ICON_THEME_STORAGE_KEY = 'iconThemeData'; @@ -72,6 +75,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { private colorThemeStore: ColorThemeStore; private currentColorTheme: ColorThemeData; + private autoSwitchColorTheme = DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE; + private autoSwitchColorThemeListener: MediaQueryList | undefined = undefined; private container: HTMLElement; private readonly onColorThemeChange: Emitter; private watchedColorThemeLocation: URI | undefined; @@ -114,6 +119,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.iconThemeStore = new FileIconThemeStore(extensionService); this.onColorThemeChange = new Emitter({ leakWarningThreshold: 400 }); + this.onPreferColorSchemeChange = this.onPreferColorSchemeChange.bind(this); this.currentColorTheme = ColorThemeData.createUnloadedTheme(''); this.currentIconTheme = FileIconThemeData.createUnloadedTheme(''); @@ -148,6 +154,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.initialize().then(undefined, errors.onUnexpectedError).then(_ => { this.installConfigurationListener(); + this.installColorThemeSwitch(); }); let prevColorId: string | undefined = undefined; @@ -248,16 +255,19 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } private initialize(): Promise<[IColorTheme | null, IFileIconTheme | null]> { - let detectHCThemeSetting = this.configurationService.getValue(DETECT_HC_SETTING); + let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); + let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); - let colorThemeSetting: string; - if (this.environmentService.configuration.highContrast && detectHCThemeSetting) { - colorThemeSetting = HC_THEME_ID; - } else { - colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); + let detectThemeAutoSwitch = this.configurationService.getValue(DETECT_AS_SETTING); + this.autoSwitchColorTheme = detectThemeAutoSwitch; + if (detectThemeAutoSwitch) { + colorThemeSetting = this.getPreferredTheme(); } - let iconThemeSetting = this.configurationService.getValue(ICON_THEME_SETTING); + let detectHCThemeSetting = this.configurationService.getValue(DETECT_HC_SETTING); + if (this.environmentService.configuration.highContrast && detectHCThemeSetting) { + colorThemeSetting = HC_THEME_ID; + } const extDevLocs = this.environmentService.extensionDevelopmentLocationURI; let uri: URI | undefined; @@ -267,7 +277,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } return Promise.all([ - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { + this.getColorThemeData(colorThemeSetting).then(theme => { return this.colorThemeStore.findThemeDataByParentLocation(uri).then(devThemes => { if (devThemes.length) { return this.setColorTheme(devThemes[0].id, ConfigurationTarget.MEMORY); @@ -288,16 +298,54 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { ]); } + private installColorThemeSwitch() { + console.log('INSTALL'); + this.autoSwitchColorThemeListener = window.matchMedia(WINDOW_MATCH_PREFERS_COLOR_SCHEME); + this.autoSwitchColorThemeListener.addListener(this.onPreferColorSchemeChange); + console.log('INSTALLED'); + } + + private deinstallColorThemeSwitch() { + console.log('DEINSTALL'); + if (this.autoSwitchColorThemeListener) { + this.autoSwitchColorThemeListener.removeListener(this.onPreferColorSchemeChange); + this.configurationService.updateValue(DETECT_AS_SETTING, false); + console.log('DEINSTALLED'); + } + } + + private onPreferColorSchemeChange({ matches }: MediaQueryListEvent) { + console.log('onPreferColorSchemeChange', matches); + let themeName = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); + if (matches) { + // prefers dark mode + themeName = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); + } + this.setTheme(themeName); + } + private installConfigurationListener() { this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration(COLOR_THEME_SETTING)) { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { - if (theme) { - this.setColorTheme(theme.id, undefined); - } - }); + this.setTheme(colorThemeSetting); + this.deinstallColorThemeSwitch(); + } + } + if (e.affectsConfiguration(DETECT_AS_SETTING)) { + let autoSwitchColorTheme = this.configurationService.getValue(DETECT_AS_SETTING); + console.log(autoSwitchColorTheme); + if (this.autoSwitchColorTheme !== autoSwitchColorTheme) { + this.autoSwitchColorTheme = autoSwitchColorTheme; + console.log('HAS CHANGED'); + if (autoSwitchColorTheme) { + this.installColorThemeSwitch(); + let themeName = this.getPreferredTheme(); + this.setTheme(themeName); + } else { + this.deinstallColorThemeSwitch(); + } } } if (e.affectsConfiguration(ICON_THEME_SETTING)) { @@ -330,6 +378,34 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { }); } + private getPreferredTheme(): string { + let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_LIGHT_SETTING); + const darkMode = this.getPreferredColorScheme() === ColorScheme.DARK; + if (darkMode) { + colorThemeSetting = this.configurationService.getValue(COLOR_THEME_DARK_SETTING); + } + return colorThemeSetting; + } + + public getPreferredColorScheme(): ColorScheme { + const noPreference = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.NO_PREFERENCE})`).matches; + const prefersDark = window.matchMedia(`(prefers-color-scheme: ${ColorScheme.DARK})`).matches; + if (noPreference) { + return ColorScheme.NO_PREFERENCE; + } else if (prefersDark) { + return ColorScheme.DARK; + } + return ColorScheme.LIGHT; + } + + public getColorThemeData(colorThemeSetting: string): Promise { + return new Promise(resolve => { + this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, DEFAULT_THEME_ID).then(theme => { + resolve(theme); + }); + }); + } + public getColorTheme(): IColorTheme { return this.currentColorTheme; } @@ -342,6 +418,15 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return this.getColorTheme(); } + public setTheme(themeName: string) { + this.getColorThemeData(themeName).then(theme => { + if (theme) { + this.setColorTheme(theme.id, undefined); + this.configurationService.updateValue(COLOR_THEME_SETTING, themeName); + } + }); + } + public setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined | 'auto'): Promise { if (!themeId) { return Promise.resolve(null); @@ -390,11 +475,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { public restoreColorTheme() { let colorThemeSetting = this.configurationService.getValue(COLOR_THEME_SETTING); if (colorThemeSetting !== this.currentColorTheme.settingsId) { - this.colorThemeStore.findThemeDataBySettingsId(colorThemeSetting, undefined).then(theme => { - if (theme) { - this.setColorTheme(theme.id, undefined); - } - }); + this.setTheme(colorThemeSetting); } } @@ -649,6 +730,23 @@ const colorThemeSettingSchema: IConfigurationPropertySchema = { enumDescriptions: [], errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."), }; +const colorThemeDarkSettingSchema: IConfigurationPropertySchema = { + type: 'string', + description: nls.localize('colorThemeDark', 'Specifies the color theme used for a dark OS appearance.'), + default: DEFAULT_THEME_DARK_SETTING_VALUE, + errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."), +}; +const colorThemeLightSettingSchema: IConfigurationPropertySchema = { + type: 'string', + description: nls.localize('colorThemeLight', 'Specifies the color theme used for a light OS appearance.'), + default: DEFAULT_THEME_LIGHT_SETTING_VALUE, + errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."), +}; +const colorThemeAutoSwitchSettingSchema: IConfigurationPropertySchema = { + type: 'boolean', + description: nls.localize('colorThemeAutoSwitch', 'Changes the color theme based on the OS appearance.'), + default: DEFAULT_THEME_AUTO_SWITCH_SETTING_VALUE +}; const iconThemeSettingSchema: IConfigurationPropertySchema = { type: ['string', 'null'], @@ -675,6 +773,9 @@ const themeSettingsConfiguration: IConfigurationNode = { type: 'object', properties: { [COLOR_THEME_SETTING]: colorThemeSettingSchema, + [COLOR_THEME_DARK_SETTING]: colorThemeDarkSettingSchema, + [COLOR_THEME_LIGHT_SETTING]: colorThemeLightSettingSchema, + [DETECT_AS_SETTING]: colorThemeAutoSwitchSettingSchema, [ICON_THEME_SETTING]: iconThemeSettingSchema, [CUSTOM_WORKBENCH_COLORS_SETTING]: colorCustomizationsSchema } diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index 9fc33ebab82..faa27f7966d 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -18,12 +18,22 @@ export const VS_HC_THEME = 'hc-black'; export const HC_THEME_ID = 'Default High Contrast'; export const COLOR_THEME_SETTING = 'workbench.colorTheme'; +export const COLOR_THEME_DARK_SETTING = 'workbench.colorThemeDark'; +export const COLOR_THEME_LIGHT_SETTING = 'workbench.colorThemeLight'; +export const DETECT_AS_SETTING = 'workbench.colorThemeAutoSwitch'; +export const WINDOW_MATCH_PREFERS_COLOR_SCHEME = '(prefers-color-scheme: dark)'; export const DETECT_HC_SETTING = 'window.autoDetectHighContrast'; export const ICON_THEME_SETTING = 'workbench.iconTheme'; export const CUSTOM_WORKBENCH_COLORS_SETTING = 'workbench.colorCustomizations'; export const CUSTOM_EDITOR_COLORS_SETTING = 'editor.tokenColorCustomizations'; export const CUSTOM_EDITOR_TOKENSTYLES_SETTING = 'editor.tokenColorCustomizationsExperimental'; +export enum ColorScheme { + LIGHT = 'light', + DARK = 'dark', + NO_PREFERENCE = 'no-preference' +} + export interface IColorTheme extends ITheme { readonly id: string; readonly label: string; @@ -56,6 +66,7 @@ export interface IWorkbenchThemeService extends IThemeService { setColorTheme(themeId: string | undefined, settingsTarget: ConfigurationTarget | undefined): Promise; getColorTheme(): IColorTheme; getColorThemes(): Promise; + getColorThemeData(colorThemeSetting: string): Promise; onDidColorThemeChange: Event; restoreColorTheme(): void; From 3c06d9d008cb2b69b7aa970f1839579c5412ee88 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 09:08:57 +0100 Subject: [PATCH 270/637] #83421 remove semver-umd.d.ts from src/typings --- package.json | 2 +- remote/package.json | 2 +- remote/web/package.json | 2 +- remote/web/yarn.lock | 8 ++++---- remote/yarn.lock | 8 ++++---- src/typings/semver-umd.d.ts | 10 ---------- yarn.lock | 8 ++++---- 7 files changed, 15 insertions(+), 25 deletions(-) delete mode 100644 src/typings/semver-umd.d.ts diff --git a/package.json b/package.json index 0fcecaa745a..bd28babf11f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.3", + "semver-umd": "^5.5.4", "spdlog": "^0.11.1", "sudo-prompt": "9.1.1", "v8-inspect-profiler": "^0.0.20", diff --git a/remote/package.json b/remote/package.json index 891ae131f63..0a70b75f105 100644 --- a/remote/package.json +++ b/remote/package.json @@ -13,7 +13,7 @@ "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.3", + "semver-umd": "^5.5.4", "spdlog": "^0.11.1", "vscode-minimist": "^1.2.2", "vscode-nsfw": "1.2.8", diff --git a/remote/web/package.json b/remote/web/package.json index 0aed404aaba..0f75c254b64 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "dependencies": { "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.3", + "semver-umd": "^5.5.4", "vscode-textmate": "4.4.0", "xterm": "4.3.0-beta.28.vscode.1", "xterm-addon-search": "0.4.0-beta4", diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index 18078da8d19..ee5c1cf7879 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -19,10 +19,10 @@ oniguruma@^7.2.0: dependencies: nan "^2.14.0" -semver-umd@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e" - integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw== +semver-umd@^5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" + integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== vscode-textmate@4.4.0: version "4.4.0" diff --git a/remote/yarn.lock b/remote/yarn.lock index a45c4d94ff5..ea3675efb3c 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -317,10 +317,10 @@ readdirp@~3.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver-umd@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e" - integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw== +semver-umd@^5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" + integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== semver@^5.3.0: version "5.6.0" diff --git a/src/typings/semver-umd.d.ts b/src/typings/semver-umd.d.ts deleted file mode 100644 index 372f000c617..00000000000 --- a/src/typings/semver-umd.d.ts +++ /dev/null @@ -1,10 +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 'semver-umd' { - - export * from "semver"; - -} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index edbbc9743d0..6bf12932c2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7572,10 +7572,10 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -semver-umd@^5.5.3: - version "5.5.3" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.3.tgz#b64d7a2d4f5a717b369d56e31940a38e47e34d1e" - integrity sha512-HOnQrn2iKnVe/xlqCTzMXQdvSz3rPbD0DmQXYuQ+oK1dpptGFfPghonQrx5JHl2O7EJwDqtQnjhE7ME23q6ngw== +semver-umd@^5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" + integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== "semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: version "5.4.1" From fb80de97e6b1b0ed2e175aff71f509786fb08e54 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 09:21:26 +0100 Subject: [PATCH 271/637] debt - clean up binary editor and event handling --- .../browser/parts/editor/binaryEditor.ts | 135 +++++++++++++++- .../{resourceviewer.css => binaryeditor.css} | 8 +- .../browser/parts/editor/resourceViewer.ts | 144 ------------------ .../files/browser/editors/binaryFileEditor.ts | 4 +- .../browser/editors/fileEditorTracker.ts | 46 ++---- 5 files changed, 142 insertions(+), 195 deletions(-) rename src/vs/workbench/browser/parts/editor/media/{resourceviewer.css => binaryeditor.css} (74%) delete mode 100644 src/vs/workbench/browser/parts/editor/resourceViewer.ts diff --git a/src/vs/workbench/browser/parts/editor/binaryEditor.ts b/src/vs/workbench/browser/parts/editor/binaryEditor.ts index 017b60833b6..722efdf0105 100644 --- a/src/vs/workbench/browser/parts/editor/binaryEditor.ts +++ b/src/vs/workbench/browser/parts/editor/binaryEditor.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import 'vs/css!./media/binaryeditor'; import * as nls from 'vs/nls'; -import { Event, Emitter } from 'vs/base/common/event'; +import { Emitter } from 'vs/base/common/event'; import { EditorInput, EditorOptions } from 'vs/workbench/common/editor'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel'; @@ -12,11 +13,10 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { ResourceViewerContext, ResourceViewer } from 'vs/workbench/browser/parts/editor/resourceViewer'; import { URI } from 'vs/base/common/uri'; -import { Dimension, size, clearNode } from 'vs/base/browser/dom'; +import { Dimension, size, clearNode, append, addDisposableListener, EventType, $ } from 'vs/base/browser/dom'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { dispose } from 'vs/base/common/lifecycle'; +import { dispose, IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { assertIsDefined, assertAllDefined } from 'vs/base/common/types'; @@ -31,11 +31,11 @@ export interface IOpenCallbacks { */ export abstract class BaseBinaryResourceEditor extends BaseEditor { - private readonly _onMetadataChanged: Emitter = this._register(new Emitter()); - readonly onMetadataChanged: Event = this._onMetadataChanged.event; + private readonly _onMetadataChanged = this._register(new Emitter()); + readonly onMetadataChanged = this._onMetadataChanged.event; - private readonly _onDidOpenInPlace: Emitter = this._register(new Emitter()); - readonly onDidOpenInPlace: Event = this._onDidOpenInPlace.event; + private readonly _onDidOpenInPlace = this._register(new Emitter()); + readonly onDidOpenInPlace = this._onDidOpenInPlace.event; private callbacks: IOpenCallbacks; private metadata: string | undefined; @@ -160,3 +160,122 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { super.dispose(); } } +export interface IResourceDescriptor { + readonly resource: URI; + readonly name: string; + readonly size?: number; + readonly etag?: string; + readonly mime: string; +} + +class BinarySize { + static readonly KB = 1024; + static readonly MB = BinarySize.KB * BinarySize.KB; + static readonly GB = BinarySize.MB * BinarySize.KB; + static readonly TB = BinarySize.GB * BinarySize.KB; + + static formatSize(size: number): string { + if (size < BinarySize.KB) { + return nls.localize('sizeB', "{0}B", size); + } + + if (size < BinarySize.MB) { + return nls.localize('sizeKB', "{0}KB", (size / BinarySize.KB).toFixed(2)); + } + + if (size < BinarySize.GB) { + return nls.localize('sizeMB', "{0}MB", (size / BinarySize.MB).toFixed(2)); + } + + if (size < BinarySize.TB) { + return nls.localize('sizeGB', "{0}GB", (size / BinarySize.GB).toFixed(2)); + } + + return nls.localize('sizeTB', "{0}TB", (size / BinarySize.TB).toFixed(2)); + } +} + +interface ResourceViewerContext extends IDisposable { + layout?(dimension: Dimension): void; +} + +interface ResourceViewerDelegate { + openInternalClb(uri: URI): void; + openExternalClb?(uri: URI): void; + metadataClb(meta: string): void; +} + +class ResourceViewer { + + private static readonly MAX_OPEN_INTERNAL_SIZE = BinarySize.MB * 200; // max size until we offer an action to open internally + + static show( + descriptor: IResourceDescriptor, + container: HTMLElement, + scrollbar: DomScrollableElement, + delegate: ResourceViewerDelegate, + ): ResourceViewerContext { + + // Ensure CSS class + container.className = 'monaco-binary-resource-editor'; + + // Large Files + if (typeof descriptor.size === 'number' && descriptor.size > ResourceViewer.MAX_OPEN_INTERNAL_SIZE) { + return FileTooLargeFileView.create(container, descriptor.size, scrollbar, delegate); + } + + // Seemingly Binary Files + return FileSeemsBinaryFileView.create(container, descriptor, scrollbar, delegate); + } +} + +class FileTooLargeFileView { + static create( + container: HTMLElement, + descriptorSize: number, + scrollbar: DomScrollableElement, + delegate: ResourceViewerDelegate + ) { + const size = BinarySize.formatSize(descriptorSize); + delegate.metadataClb(size); + + clearNode(container); + + const label = document.createElement('span'); + label.textContent = nls.localize('nativeFileTooLargeError', "The file is not displayed in the editor because it is too large ({0}).", size); + container.appendChild(label); + + scrollbar.scanDomNode(); + + return Disposable.None; + } +} + +class FileSeemsBinaryFileView { + static create( + container: HTMLElement, + descriptor: IResourceDescriptor, + scrollbar: DomScrollableElement, + delegate: ResourceViewerDelegate + ) { + delegate.metadataClb(typeof descriptor.size === 'number' ? BinarySize.formatSize(descriptor.size) : ''); + + clearNode(container); + + const disposables = new DisposableStore(); + + const label = document.createElement('p'); + label.textContent = nls.localize('nativeBinaryError', "The file is not displayed in the editor because it is either binary or uses an unsupported text encoding."); + container.appendChild(label); + + const link = append(label, $('a.embedded-link')); + link.setAttribute('role', 'button'); + link.textContent = nls.localize('openAsText', "Do you want to open it anyway?"); + + disposables.add(addDisposableListener(link, EventType.CLICK, () => delegate.openInternalClb(descriptor.resource))); + + scrollbar.scanDomNode(); + + return disposables; + } +} diff --git a/src/vs/workbench/browser/parts/editor/media/resourceviewer.css b/src/vs/workbench/browser/parts/editor/media/binaryeditor.css similarity index 74% rename from src/vs/workbench/browser/parts/editor/media/resourceviewer.css rename to src/vs/workbench/browser/parts/editor/media/binaryeditor.css index 705c27036ab..062b4091fd4 100644 --- a/src/vs/workbench/browser/parts/editor/media/resourceviewer.css +++ b/src/vs/workbench/browser/parts/editor/media/binaryeditor.css @@ -3,17 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -.monaco-resource-viewer:focus { +.monaco-binary-resource-editor:focus { outline: none !important; } -.monaco-resource-viewer { +.monaco-binary-resource-editor { padding: 5px 0 0 10px; box-sizing: border-box; } -.monaco-resource-viewer .embedded-link, -.monaco-resource-viewer .embedded-link:hover { +.monaco-binary-resource-editor .embedded-link, +.monaco-binary-resource-editor .embedded-link:hover { cursor: pointer; text-decoration: underline; margin-left: 5px; diff --git a/src/vs/workbench/browser/parts/editor/resourceViewer.ts b/src/vs/workbench/browser/parts/editor/resourceViewer.ts deleted file mode 100644 index 1879da12053..00000000000 --- a/src/vs/workbench/browser/parts/editor/resourceViewer.ts +++ /dev/null @@ -1,144 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as DOM from 'vs/base/browser/dom'; -import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; -import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; -import { URI } from 'vs/base/common/uri'; -import 'vs/css!./media/resourceviewer'; -import * as nls from 'vs/nls'; -import { ICssStyleCollector, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { IMAGE_PREVIEW_BORDER } from 'vs/workbench/common/theme'; - -export interface IResourceDescriptor { - readonly resource: URI; - readonly name: string; - readonly size?: number; - readonly etag?: string; - readonly mime: string; -} - -class BinarySize { - static readonly KB = 1024; - static readonly MB = BinarySize.KB * BinarySize.KB; - static readonly GB = BinarySize.MB * BinarySize.KB; - static readonly TB = BinarySize.GB * BinarySize.KB; - - static formatSize(size: number): string { - if (size < BinarySize.KB) { - return nls.localize('sizeB', "{0}B", size); - } - - if (size < BinarySize.MB) { - return nls.localize('sizeKB', "{0}KB", (size / BinarySize.KB).toFixed(2)); - } - - if (size < BinarySize.GB) { - return nls.localize('sizeMB', "{0}MB", (size / BinarySize.MB).toFixed(2)); - } - - if (size < BinarySize.TB) { - return nls.localize('sizeGB', "{0}GB", (size / BinarySize.GB).toFixed(2)); - } - - return nls.localize('sizeTB', "{0}TB", (size / BinarySize.TB).toFixed(2)); - } -} - -export interface ResourceViewerContext extends IDisposable { - layout?(dimension: DOM.Dimension): void; -} - -interface ResourceViewerDelegate { - openInternalClb(uri: URI): void; - openExternalClb?(uri: URI): void; - metadataClb(meta: string): void; -} - -registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { - const borderColor = theme.getColor(IMAGE_PREVIEW_BORDER); - collector.addRule(`.monaco-resource-viewer.image img { border : 1px solid ${borderColor ? borderColor.toString() : ''}; }`); -}); - -/** - * Helper to actually render the given resource into the provided container. Will adjust scrollbar (if provided) automatically based on loading - * progress of the binary resource. - */ -export class ResourceViewer { - - private static readonly MAX_OPEN_INTERNAL_SIZE = BinarySize.MB * 200; // max size until we offer an action to open internally - - static show( - descriptor: IResourceDescriptor, - container: HTMLElement, - scrollbar: DomScrollableElement, - delegate: ResourceViewerDelegate, - ): ResourceViewerContext { - - // Ensure CSS class - container.className = 'monaco-resource-viewer'; - - // Large Files - if (typeof descriptor.size === 'number' && descriptor.size > ResourceViewer.MAX_OPEN_INTERNAL_SIZE) { - return FileTooLargeFileView.create(container, descriptor.size, scrollbar, delegate); - } - - // Seemingly Binary Files - else { - return FileSeemsBinaryFileView.create(container, descriptor, scrollbar, delegate); - } - } -} - -class FileTooLargeFileView { - static create( - container: HTMLElement, - descriptorSize: number, - scrollbar: DomScrollableElement, - delegate: ResourceViewerDelegate - ) { - const size = BinarySize.formatSize(descriptorSize); - delegate.metadataClb(size); - - DOM.clearNode(container); - - const label = document.createElement('span'); - label.textContent = nls.localize('nativeFileTooLargeError', "The file is not displayed in the editor because it is too large ({0}).", size); - container.appendChild(label); - - scrollbar.scanDomNode(); - - return Disposable.None; - } -} - -class FileSeemsBinaryFileView { - static create( - container: HTMLElement, - descriptor: IResourceDescriptor, - scrollbar: DomScrollableElement, - delegate: ResourceViewerDelegate - ) { - delegate.metadataClb(typeof descriptor.size === 'number' ? BinarySize.formatSize(descriptor.size) : ''); - - DOM.clearNode(container); - - const disposables = new DisposableStore(); - - const label = document.createElement('p'); - label.textContent = nls.localize('nativeBinaryError', "The file is not displayed in the editor because it is either binary or uses an unsupported text encoding."); - container.appendChild(label); - - const link = DOM.append(label, DOM.$('a.embedded-link')); - link.setAttribute('role', 'button'); - link.textContent = nls.localize('openAsText', "Do you want to open it anyway?"); - - disposables.add(DOM.addDisposableListener(link, DOM.EventType.CLICK, () => delegate.openInternalClb(descriptor.resource))); - - scrollbar.scanDomNode(); - - return disposables; - } -} diff --git a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts index 618920a6e28..389bcae9802 100644 --- a/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts @@ -16,7 +16,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { IOpenerService } from 'vs/platform/opener/common/opener'; /** - * An implementation of editor for binary files like images. + * An implementation of editor for binary files that cannot be displayed. */ export class BinaryFileEditor extends BaseBinaryResourceEditor { @@ -39,7 +39,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor { telemetryService, themeService, environmentService, - storageService, + storageService ); } diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index cf9ceb02b40..854c0b686c6 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -19,15 +19,13 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { ResourceMap } from 'vs/base/common/map'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor'; import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { BINARY_FILE_EDITOR_ID } from 'vs/workbench/contrib/files/common/files'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; import { ResourceQueue, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; import { withNullAsUndefined } from 'vs/base/common/types'; -import { EditorActivation, ITextEditorOptions } from 'vs/platform/editor/common/editor'; +import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { @@ -260,7 +258,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut //#endregion - //#region Update text models and binary editors on external changes + //#region File Changes: Update text models and binary editors private onFileChanges(e: FileChangesEvent): void { @@ -279,9 +277,6 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // Handle updates to text models this.handleUpdatesToTextModels(e); - - // Handle updates to visible binary editors - this.handleUpdatesToVisibleBinaryEditors(e); } private handleUpdatesToTextModels(e: FileChangesEvent): void { @@ -307,48 +302,25 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut } } - private handleUpdatesToVisibleBinaryEditors(e: FileChangesEvent): void { - const editors = this.editorService.visibleControls; - editors.forEach(editor => { - const resource = editor.input ? toResource(editor.input, { supportSideBySide: SideBySideEditorChoice.MASTER }) : undefined; - - // Support side-by-side binary editors too - let isBinaryEditor = false; - if (editor instanceof SideBySideEditor) { - const masterEditor = editor.getMasterEditor(); - isBinaryEditor = masterEditor?.getId() === BINARY_FILE_EDITOR_ID; - } else { - isBinaryEditor = editor.getId() === BINARY_FILE_EDITOR_ID; - } - - // Binary editor that should reload from event - if (resource && editor.input && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) { - this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true, activation: EditorActivation.PRESERVE }, editor.group); - } - }); - } - //#endregion - //#region Open dirty text files if not opened already + //#region Text File Dirty: Ensure every dirty text file is opened in an editor - private onTextFilesDirty(e: readonly TextFileModelChangeEvent[]): void { + private onTextFilesDirty(events: ReadonlyArray): void { // If files become dirty but are not opened, we open it in the background unless there are pending to be saved - this.doOpenDirtyResources(distinct(e.filter(e => { + this.doOpenDirtyResourcesInBackground(distinct(events.filter(({ resource }) => { // Only dirty models that are not PENDING_SAVE - const model = this.textFileService.models.get(e.resource); + const model = this.textFileService.models.get(resource); const shouldOpen = model?.isDirty() && !model.hasState(ModelState.PENDING_SAVE); // Only if not open already - return shouldOpen && !this.editorService.isOpen({ resource: e.resource }); - }).map(e => e.resource), r => r.toString())); + return shouldOpen && !this.editorService.isOpen({ resource }); + }).map(event => event.resource), resource => resource.toString())); } - private doOpenDirtyResources(resources: URI[]): void { - - // Open + private doOpenDirtyResourcesInBackground(resources: URI[]): void { this.editorService.openEditors(resources.map(resource => { return { resource, From d01e111fb0e6e27378fcd049bbc9b36d0833d78e Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 09:46:04 +0100 Subject: [PATCH 272/637] debt - model reload should happen from model manager --- .../files/node/diskFileSystemProvider.ts | 8 +- .../browser/editors/fileEditorTracker.ts | 78 ++++----------- .../textfile/common/textFileEditorModel.ts | 1 + .../common/textFileEditorModelManager.ts | 95 +++++++++++++------ 4 files changed, 90 insertions(+), 92 deletions(-) diff --git a/src/vs/platform/files/node/diskFileSystemProvider.ts b/src/vs/platform/files/node/diskFileSystemProvider.ts index 0187b5d9bcc..08b595a6bd4 100644 --- a/src/vs/platform/files/node/diskFileSystemProvider.ts +++ b/src/vs/platform/files/node/diskFileSystemProvider.ts @@ -484,15 +484,15 @@ export class DiskFileSystemProvider extends Disposable implements //#region File Watching - private _onDidWatchErrorOccur: Emitter = this._register(new Emitter()); - readonly onDidErrorOccur: Event = this._onDidWatchErrorOccur.event; + private _onDidWatchErrorOccur = this._register(new Emitter()); + readonly onDidErrorOccur = this._onDidWatchErrorOccur.event; private _onDidChangeFile = this._register(new Emitter()); - get onDidChangeFile(): Event { return this._onDidChangeFile.event; } + readonly onDidChangeFile = this._onDidChangeFile.event; private recursiveWatcher: WindowsWatcherService | UnixWatcherService | NsfwWatcherService | undefined; private recursiveFoldersToWatch: { path: string, excludes: string[] }[] = []; - private recursiveWatchRequestDelayer: ThrottledDelayer = this._register(new ThrottledDelayer(0)); + private recursiveWatchRequestDelayer = this._register(new ThrottledDelayer(0)); private recursiveWatcherLogLevelListener: IDisposable | undefined; diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 854c0b686c6..2a1f0860a39 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri'; import * as resources from 'vs/base/common/resources'; import { IEditorViewState } from 'vs/editor/common/editorCommon'; import { toResource, SideBySideEditorInput, IWorkbenchEditorConfiguration, SideBySideEditor as SideBySideEditorChoice } from 'vs/workbench/common/editor'; -import { ITextFileService, ITextFileEditorModel, TextFileModelChangeEvent, ModelState } from 'vs/workbench/services/textfile/common/textfiles'; +import { ITextFileService, TextFileModelChangeEvent, ModelState } from 'vs/workbench/services/textfile/common/textfiles'; import { FileOperationEvent, FileOperation, IFileService, FileChangeType, FileChangesEvent } from 'vs/platform/files/common/files'; import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; @@ -22,17 +22,17 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { ResourceQueue, timeout } from 'vs/base/common/async'; -import { onUnexpectedError } from 'vs/base/common/errors'; +import { timeout } from 'vs/base/common/async'; import { withNullAsUndefined } from 'vs/base/common/types'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { - private closeOnFileDelete: boolean = false; - private readonly modelLoadQueue = new ResourceQueue(); + private readonly activeOutOfWorkspaceWatchers = new ResourceMap(); + private closeOnFileDelete: boolean = false; + constructor( @IEditorService private readonly editorService: IEditorService, @ITextFileService private readonly textFileService: ITextFileService, @@ -177,8 +177,18 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut return undefined; } + //#endregion + + //#region File Changes: Close editors of deleted files + + private onFileChanges(e: FileChangesEvent): void { + if (e.gotDeleted()) { + this.handleDeletes(e, true); + } + } + private handleDeletes(arg1: URI | FileChangesEvent, isExternal: boolean, movedTo?: URI): void { - const nonDirtyFileEditors = this.getOpenedFileEditors(false /* non-dirty only */); + const nonDirtyFileEditors = this.getNonDirtyFileEditors(); nonDirtyFileEditors.forEach(async editor => { const resource = editor.getResource(); @@ -227,12 +237,12 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut }); } - private getOpenedFileEditors(dirtyState: boolean): FileEditorInput[] { + private getNonDirtyFileEditors(): FileEditorInput[] { const editors: FileEditorInput[] = []; this.editorService.editors.forEach(editor => { if (editor instanceof FileEditorInput) { - if (!!editor.isDirty() === dirtyState) { + if (!editor.isDirty()) { editors.push(editor); } } else if (editor instanceof SideBySideEditorInput) { @@ -240,13 +250,13 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut const details = editor.details; if (master instanceof FileEditorInput) { - if (!!master.isDirty() === dirtyState) { + if (!master.isDirty()) { editors.push(master); } } if (details instanceof FileEditorInput) { - if (!!details.isDirty() === dirtyState) { + if (!details.isDirty()) { editors.push(details); } } @@ -258,52 +268,6 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut //#endregion - //#region File Changes: Update text models and binary editors - - private onFileChanges(e: FileChangesEvent): void { - - // Handle updates - if (e.gotAdded() || e.gotUpdated()) { - this.handleUpdates(e); - } - - // Handle deletes - if (e.gotDeleted()) { - this.handleDeletes(e, true); - } - } - - private handleUpdates(e: FileChangesEvent): void { - - // Handle updates to text models - this.handleUpdatesToTextModels(e); - } - - private handleUpdatesToTextModels(e: FileChangesEvent): void { - - // Collect distinct (saved) models to update. - // - // Note: we also consider the added event because it could be that a file was added - // and updated right after. - distinct(coalesce([...e.getUpdated(), ...e.getAdded()] - .map(u => this.textFileService.models.get(u.resource))) - .filter(model => model && !model.isDirty()), model => model.resource.toString()) - .forEach(model => this.queueModelLoad(model)); - } - - private queueModelLoad(model: ITextFileEditorModel): void { - - // Load model to update (use a queue to prevent accumulation of loads - // when the load actually takes long. At most we only want the queue - // to have a size of 2 (1 running load and 1 queued load). - const queue = this.modelLoadQueue.queueFor(model.resource); - if (queue.size <= 1) { - queue.queue(() => model.load().then(undefined, onUnexpectedError)); - } - } - - //#endregion - //#region Text File Dirty: Ensure every dirty text file is opened in an editor private onTextFilesDirty(events: ReadonlyArray): void { @@ -396,7 +360,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut return model; })), model => model.resource.toString() - ).forEach(model => this.queueModelLoad(model)); + ).forEach(model => model.load()); } } diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index 1ab5da03cf5..fb8822c7f3c 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -63,6 +63,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil static DEFAULT_CONTENT_CHANGE_BUFFER_DELAY = CONTENT_CHANGE_EVENT_BUFFER_DELAY; static DEFAULT_ORPHANED_CHANGE_BUFFER_DELAY = 100; + static WHITELIST_JSON = ['package.json', 'package-lock.json', 'tsconfig.json', 'jsconfig.json', 'bower.json', '.eslintrc.json', 'tslint.json', 'composer.json']; static WHITELIST_WORKSPACE_JSON = ['settings.json', 'extensions.json', 'tasks.json', 'launch.json']; diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts index 13ff5e0fa77..6a8d170d6e5 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts @@ -11,35 +11,39 @@ import { ITextFileEditorModel, ITextFileEditorModelManager, TextFileModelChangeE import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ResourceMap } from 'vs/base/common/map'; +import { IFileService, FileChangesEvent } from 'vs/platform/files/common/files'; +import { distinct, coalesce } from 'vs/base/common/arrays'; +import { ResourceQueue } from 'vs/base/common/async'; +import { onUnexpectedError } from 'vs/base/common/errors'; export class TextFileEditorModelManager extends Disposable implements ITextFileEditorModelManager { - private readonly _onModelDisposed: Emitter = this._register(new Emitter()); - readonly onModelDisposed: Event = this._onModelDisposed.event; + private readonly _onModelDisposed = this._register(new Emitter()); + readonly onModelDisposed = this._onModelDisposed.event; - private readonly _onModelContentChanged: Emitter = this._register(new Emitter()); - readonly onModelContentChanged: Event = this._onModelContentChanged.event; + private readonly _onModelContentChanged = this._register(new Emitter()); + readonly onModelContentChanged = this._onModelContentChanged.event; - private readonly _onModelDirty: Emitter = this._register(new Emitter()); - readonly onModelDirty: Event = this._onModelDirty.event; + private readonly _onModelDirty = this._register(new Emitter()); + readonly onModelDirty = this._onModelDirty.event; - private readonly _onModelSaveError: Emitter = this._register(new Emitter()); - readonly onModelSaveError: Event = this._onModelSaveError.event; + private readonly _onModelSaveError = this._register(new Emitter()); + readonly onModelSaveError = this._onModelSaveError.event; - private readonly _onModelSaved: Emitter = this._register(new Emitter()); - readonly onModelSaved: Event = this._onModelSaved.event; + private readonly _onModelSaved = this._register(new Emitter()); + readonly onModelSaved = this._onModelSaved.event; - private readonly _onModelReverted: Emitter = this._register(new Emitter()); - readonly onModelReverted: Event = this._onModelReverted.event; + private readonly _onModelReverted = this._register(new Emitter()); + readonly onModelReverted = this._onModelReverted.event; - private readonly _onModelEncodingChanged: Emitter = this._register(new Emitter()); - readonly onModelEncodingChanged: Event = this._onModelEncodingChanged.event; + private readonly _onModelEncodingChanged = this._register(new Emitter()); + readonly onModelEncodingChanged = this._onModelEncodingChanged.event; - private readonly _onModelOrphanedChanged: Emitter = this._register(new Emitter()); - readonly onModelOrphanedChanged: Event = this._onModelOrphanedChanged.event; + private readonly _onModelOrphanedChanged = this._register(new Emitter()); + readonly onModelOrphanedChanged = this._onModelOrphanedChanged.event; - private _onModelsDirty: Event | undefined; - get onModelsDirty(): Event { + private _onModelsDirty: Event> | undefined; + get onModelsDirty(): Event> { if (!this._onModelsDirty) { this._onModelsDirty = this.debounce(this.onModelDirty); } @@ -47,8 +51,8 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE return this._onModelsDirty; } - private _onModelsSaveError: Event | undefined; - get onModelsSaveError(): Event { + private _onModelsSaveError: Event> | undefined; + get onModelsSaveError(): Event> { if (!this._onModelsSaveError) { this._onModelsSaveError = this.debounce(this.onModelSaveError); } @@ -56,8 +60,8 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE return this._onModelsSaveError; } - private _onModelsSaved: Event | undefined; - get onModelsSaved(): Event { + private _onModelsSaved: Event> | undefined; + get onModelsSaved(): Event> { if (!this._onModelsSaved) { this._onModelsSaved = this.debounce(this.onModelSaved); } @@ -65,8 +69,8 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE return this._onModelsSaved; } - private _onModelsReverted: Event | undefined; - get onModelsReverted(): Event { + private _onModelsReverted: Event> | undefined; + get onModelsReverted(): Event> { if (!this._onModelsReverted) { this._onModelsReverted = this.debounce(this.onModelReverted); } @@ -74,15 +78,18 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE return this._onModelsReverted; } - private mapResourceToDisposeListener = new ResourceMap(); - private mapResourceToStateChangeListener = new ResourceMap(); - private mapResourceToModelContentChangeListener = new ResourceMap(); - private mapResourceToModel = new ResourceMap(); - private mapResourceToPendingModelLoaders = new ResourceMap>(); + private readonly mapResourceToDisposeListener = new ResourceMap(); + private readonly mapResourceToStateChangeListener = new ResourceMap(); + private readonly mapResourceToModelContentChangeListener = new ResourceMap(); + private readonly mapResourceToModel = new ResourceMap(); + private readonly mapResourceToPendingModelLoaders = new ResourceMap>(); + + private readonly modelLoadQueue = new ResourceQueue(); constructor( @ILifecycleService private readonly lifecycleService: ILifecycleService, - @IInstantiationService private readonly instantiationService: IInstantiationService + @IInstantiationService private readonly instantiationService: IInstantiationService, + @IFileService private readonly fileService: IFileService ) { super(); @@ -91,11 +98,37 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE private registerListeners(): void { + // Update models from file change events + this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); + // Lifecycle this.lifecycleService.onShutdown(this.dispose, this); } - private debounce(event: Event): Event { + private onFileChanges(e: FileChangesEvent): void { + + // Collect distinct (saved) models to update. + // + // Note: we also consider the added event because it could be that a file was added + // and updated right after. + distinct(coalesce([...e.getUpdated(), ...e.getAdded()] + .map(({ resource }) => this.get(resource))) + .filter(model => model && !model.isDirty()), model => model.resource.toString()) + .forEach(model => this.queueModelLoad(model)); + } + + private queueModelLoad(model: ITextFileEditorModel): void { + + // Load model to update (use a queue to prevent accumulation of loads + // when the load actually takes long. At most we only want the queue + // to have a size of 2 (1 running load and 1 queued load). + const queue = this.modelLoadQueue.queueFor(model.resource); + if (queue.size <= 1) { + queue.queue(() => model.load().then(undefined, onUnexpectedError)); + } + } + + private debounce(event: Event): Event> { return Event.debounce(event, (prev: TextFileModelChangeEvent[], cur: TextFileModelChangeEvent) => { if (!prev) { prev = [cur]; From 1578e92150fde17d4880fb42423e1bd88a46e4cb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 10:28:21 +0100 Subject: [PATCH 273/637] debt - preserve encoding & mode when saving models to different paths --- .../browser/editors/fileEditorTracker.ts | 34 +++++++++---------- .../textfile/browser/textFileService.ts | 8 ++--- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 2a1f0860a39..92699a26fa3 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -24,7 +24,6 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService'; import { timeout } from 'vs/base/common/async'; import { withNullAsUndefined } from 'vs/base/common/types'; -import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; export class FileEditorTracker extends Disposable implements IWorkbenchContribution { @@ -86,7 +85,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // Handle moves specially when file is opened if (e.isOperation(FileOperation.MOVE)) { - this.handleMovedFileInOpenedEditors(e.resource, e.target.resource); + this.handleMovedFileInOpenedFileEditors(e.resource, e.target.resource); } // Handle deletes @@ -95,13 +94,13 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut } } - private handleMovedFileInOpenedEditors(oldResource: URI, newResource: URI): void { + private handleMovedFileInOpenedFileEditors(oldResource: URI, newResource: URI): void { this.editorGroupService.groups.forEach(group => { group.editors.forEach(editor => { - const resource = editor.getResource(); - if (resource && (editor instanceof FileEditorInput || editor.handleMove)) { + if (editor instanceof FileEditorInput) { // Update Editor if file (or any parent of the input) got renamed or moved + const resource = editor.getResource(); if (resources.isEqualOrParent(resource, oldResource)) { let reopenFileResource: URI; if (oldResource.toString() === resource.toString()) { @@ -111,27 +110,26 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut reopenFileResource = resources.joinPath(newResource, resource.path.substr(index + oldResource.path.length + 1)); // parent folder got moved } - const options: ITextEditorOptions = { - preserveFocus: true, - pinned: group.isPinned(editor), - index: group.getIndexOfEditor(editor), - inactive: !group.isActive(editor), - }; + let encoding: string | undefined = undefined; + let mode: string | undefined = undefined; - if (editor.handleMove) { - const replacement = editor.handleMove(group.id, reopenFileResource, options); - if (replacement) { - this.editorService.replaceEditors([{ editor, replacement }], group); - return; - } + const model = this.textFileService.models.get(resource); + if (model) { + encoding = model.getEncoding(); + mode = model.textEditorModel?.getModeId(); } this.editorService.replaceEditors([{ editor: { resource }, replacement: { resource: reopenFileResource, + encoding, + mode, options: { - ...options, + preserveFocus: true, + pinned: group.isPinned(editor), + index: group.getIndexOfEditor(editor), + inactive: !group.isActive(editor), viewState: this.getViewStateFor(oldResource, group) } }, diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index 964a10d2411..c32362f56af 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -416,7 +416,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex // remember each source model to load again after move is done // with optional content to restore if it was dirty - type ModelToRestore = { resource: URI; snapshot?: ITextSnapshot }; + type ModelToRestore = { resource: URI; snapshot?: ITextSnapshot; encoding?: string; mode?: string }; const modelsToRestore: ModelToRestore[] = []; for (const sourceModel of sourceModels) { const sourceModelResource = sourceModel.resource; @@ -433,7 +433,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex modelToRestoreResource = joinPath(target, sourceModelResource.path.substr(source.path.length + 1)); } - const modelToRestore: ModelToRestore = { resource: modelToRestoreResource }; + const modelToRestore: ModelToRestore = { resource: modelToRestoreResource, encoding: sourceModel.getEncoding(), mode: sourceModel.textEditorModel?.getModeId() }; if (sourceModel.isDirty()) { modelToRestore.snapshot = sourceModel.createSnapshot(); } @@ -469,7 +469,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex // we know the file has changed on disk after the move and the // model might have still existed with the previous state. this // ensures we are not tracking a stale state. - const restoredModel = await this.models.loadOrCreate(modelToRestore.resource, { reload: { async: false } }); + const restoredModel = await this.models.loadOrCreate(modelToRestore.resource, { reload: { async: false }, encoding: modelToRestore.encoding, mode: modelToRestore.mode }); // restore previous dirty content if any and ensure to mark // the model as dirty @@ -766,7 +766,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex await this.create(target, ''); } - targetModel = await this.models.loadOrCreate(target); + targetModel = await this.models.loadOrCreate(target, { encoding: sourceModel.getEncoding(), mode: sourceModel.textEditorModel?.getModeId() }); } try { From 333961d3c37090b4ff2d066327d64a96acc9824c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 10:58:07 +0100 Subject: [PATCH 274/637] :lipstick: --- src/vs/workbench/common/editor.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 3dc49dad765..3c2db2d8ace 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -412,11 +412,6 @@ export interface IEditorInput extends IDisposable { */ saveAs(groupId: GroupIdentifier, options?: ISaveOptions): Promise; - /** - * Handles when the input is replaced, such as by renaming its backing resource. - */ - handleMove?(groupId: GroupIdentifier, uri: URI, options?: ITextEditorOptions): IEditorInput | undefined; - /** * Reverts this input. */ From 6c6ef0c43ef52772a260601e15bc11ce34ab2220 Mon Sep 17 00:00:00 2001 From: Konstantin Solomatov Date: Tue, 10 Dec 2019 02:06:52 -0800 Subject: [PATCH 275/637] Fix error printing (#86617) * Fix error printing * :lipstick: --- src/vs/base/common/errorMessage.ts | 12 ++++-------- src/vs/base/test/common/errors.test.ts | 11 ++++++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/vs/base/common/errorMessage.ts b/src/vs/base/common/errorMessage.ts index e3fc44bacd3..f686dd28bd7 100644 --- a/src/vs/base/common/errorMessage.ts +++ b/src/vs/base/common/errorMessage.ts @@ -8,15 +8,11 @@ import * as types from 'vs/base/common/types'; import * as arrays from 'vs/base/common/arrays'; function exceptionToErrorMessage(exception: any, verbose: boolean): string { - if (exception.message) { - if (verbose && (exception.stack || exception.stacktrace)) { - return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace)); - } - - return detectSystemErrorMessage(exception); + if (verbose && (exception.stack || exception.stacktrace)) { + return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace)); } - return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); + return detectSystemErrorMessage(exception); } function stackToString(stack: string[] | string | undefined): string | undefined { @@ -34,7 +30,7 @@ function detectSystemErrorMessage(exception: any): string { return nls.localize('nodeExceptionMessage', "A system error occurred ({0})", exception.message); } - return exception.message; + return exception.message || nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details."); } /** diff --git a/src/vs/base/test/common/errors.test.ts b/src/vs/base/test/common/errors.test.ts index d2dc4bfcb57..a5e79162361 100644 --- a/src/vs/base/test/common/errors.test.ts +++ b/src/vs/base/test/common/errors.test.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import * as assert from 'assert'; import { toErrorMessage } from 'vs/base/common/errorMessage'; @@ -16,9 +17,17 @@ suite('Errors', () => { error.detail.exception = {}; error.detail.exception.message = 'Foo Bar'; assert.strictEqual(toErrorMessage(error), 'Foo Bar'); + assert.strictEqual(toErrorMessage(error, true), 'Foo Bar'); assert(toErrorMessage()); assert(toErrorMessage(null)); assert(toErrorMessage({})); + + try { + throw new Error(); + } catch (error) { + assert.strictEqual(toErrorMessage(error), 'An unknown error occurred. Please consult the log for more details.'); + assert.ok(toErrorMessage(error, true).length > 'An unknown error occurred. Please consult the log for more details.'.length); + } }); -}); \ No newline at end of file +}); From f7879f3ff65df656400a95ef9bd80ac334bb82fd Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 11:39:03 +0100 Subject: [PATCH 276/637] Remove unintentional multi-select from ports view Fixes https://github.com/microsoft/vscode/issues/86071 --- src/vs/workbench/contrib/remote/browser/tunnelView.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index fefabdc2d70..9ad2bfce5f9 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -450,6 +450,7 @@ export class TunnelPanel extends ViewPane { return item.label; } }, + multipleSelectionSupport: false } ); const actionRunner: ActionRunner = new ActionRunner(); From 90e7939dfa31c4c8b57dcd13c2577f1d7d0ad206 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 11:51:32 +0100 Subject: [PATCH 277/637] Focus on Tunnels View command Fixes #86076 --- src/vs/workbench/contrib/remote/browser/tunnelView.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 9ad2bfce5f9..e2772b304ac 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -498,6 +498,11 @@ export class TunnelPanel extends ViewPane { return this.titleActions; } + focus(): void { + super.focus(); + this.tree.domFocus(); + } + private onContextMenu(treeEvent: ITreeContextMenuEvent, actionRunner: ActionRunner): void { if (!(treeEvent.element instanceof TunnelItem)) { return; From 6e94c2dd168064a8736880f51cb9a19b5d7bcc78 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 12:00:33 +0100 Subject: [PATCH 278/637] Port Rename -> Set Label and select value Fixes #86070 --- .../contrib/remote/browser/tunnelView.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index e2772b304ac..9f9f6612801 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -255,6 +255,7 @@ class TunnelTreeRenderer extends Disposable implements ITreeRenderer { inputBox.element.style.display = 'none'; @@ -565,9 +566,9 @@ export class TunnelPanelDescriptor implements IViewDescriptor { } } -namespace NameTunnelAction { - export const ID = 'remote.tunnel.name'; - export const LABEL = nls.localize('remote.tunnel.name', "Rename"); +namespace LabelTunnelAction { + export const ID = 'remote.tunnel.label'; + export const LABEL = nls.localize('remote.tunnel.label', "Set Label"); export function handler(): ICommandHandler { return async (accessor, arg) => { @@ -581,7 +582,7 @@ namespace NameTunnelAction { remoteExplorerService.setEditable(arg.remote, null); }, validationMessage: () => null, - placeholder: nls.localize('remote.tunnelsView.namePlaceholder', "Port name"), + placeholder: nls.localize('remote.tunnelsView.labelPlaceholder', "Port label"), startingValue: arg.name }); } @@ -673,7 +674,7 @@ namespace CopyAddressAction { } } -CommandsRegistry.registerCommand(NameTunnelAction.ID, NameTunnelAction.handler()); +CommandsRegistry.registerCommand(LabelTunnelAction.ID, LabelTunnelAction.handler()); CommandsRegistry.registerCommand(ForwardPortAction.ID, ForwardPortAction.handler()); CommandsRegistry.registerCommand(ClosePortAction.ID, ClosePortAction.handler()); CommandsRegistry.registerCommand(OpenPortInBrowserAction.ID, OpenPortInBrowserAction.handler()); @@ -710,8 +711,8 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({ group: '0_manage', order: 2, command: { - id: NameTunnelAction.ID, - title: NameTunnelAction.LABEL, + id: LabelTunnelAction.ID, + title: LabelTunnelAction.LABEL, }, when: TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded) })); From f3594908799e1f605b5bab32a42d378c5522fb0b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 10 Dec 2019 12:34:46 +0100 Subject: [PATCH 279/637] adopt latest version, https://github.com/microsoft/vscode/issues/86327 --- build/builtInExtensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/builtInExtensions.json b/build/builtInExtensions.json index 68d891d09d4..25358ac2b84 100644 --- a/build/builtInExtensions.json +++ b/build/builtInExtensions.json @@ -31,7 +31,7 @@ }, { "name": "ms-vscode.references-view", - "version": "0.0.42", + "version": "0.0.43", "repo": "https://github.com/Microsoft/vscode-reference-view", "metadata": { "id": "dc489f46-520d-4556-ae85-1f9eab3c412d", From e9671e46ebeddada0baf1d2e64df761af8b8431d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 10 Dec 2019 12:18:13 +0100 Subject: [PATCH 280/637] make sure to use a URI when looking up nodes --- .../extensions/electron-browser/extensionHostProfiler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts index bbc743030cb..07ea1e8b2c6 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHostProfiler.ts @@ -60,7 +60,12 @@ export class ExtensionHostProfiler { break; } } else if (segmentId === 'self' && node.callFrame.url) { - let extension = searchTree.findSubstr(node.callFrame.url); + let extension: IExtensionDescription | undefined; + try { + extension = searchTree.findSubstr(URI.parse(node.callFrame.url).toString()); + } catch { + // ignore + } if (extension) { segmentId = extension.identifier.value; } From c45e6cc623a372118f533358adfc5be0941f26e3 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 12:34:44 +0100 Subject: [PATCH 281/637] Update grammars --- extensions/cpp/cgmanifest.json | 4 +- extensions/cpp/syntaxes/c.tmLanguage.json | 12 +- .../cpp.embedded.macro.tmLanguage.json | 244 +++++++++--------- extensions/cpp/syntaxes/cpp.tmLanguage.json | 244 +++++++++--------- extensions/csharp/cgmanifest.json | 2 +- .../csharp/syntaxes/csharp.tmLanguage.json | 4 +- extensions/java/cgmanifest.json | 4 +- extensions/java/syntaxes/java.tmLanguage.json | 123 +++++---- .../syntaxes/JavaScript.tmLanguage.json | 14 +- .../syntaxes/JavaScriptReact.tmLanguage.json | 14 +- .../syntaxes/markdown.tmLanguage.json | 4 +- extensions/typescript-basics/cgmanifest.json | 2 +- .../syntaxes/TypeScript.tmLanguage.json | 14 +- .../syntaxes/TypeScriptReact.tmLanguage.json | 14 +- 14 files changed, 363 insertions(+), 336 deletions(-) diff --git a/extensions/cpp/cgmanifest.json b/extensions/cpp/cgmanifest.json index 4fba38d93ad..c216c10420b 100644 --- a/extensions/cpp/cgmanifest.json +++ b/extensions/cpp/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", - "commitHash": "fedd206d1b2803f31a278e9b5f098ce4bc76e532" + "commitHash": "666808cab3907fc91ed4d3901060ee6b045cca58" } }, "license": "MIT", - "version": "1.14.13", + "version": "1.14.15", "description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle." }, { diff --git a/extensions/cpp/syntaxes/c.tmLanguage.json b/extensions/cpp/syntaxes/c.tmLanguage.json index 916371903fb..bb037f684a5 100644 --- a/extensions/cpp/syntaxes/c.tmLanguage.json +++ b/extensions/cpp/syntaxes/c.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/fedd206d1b2803f31a278e9b5f098ce4bc76e532", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/72b309aabb63bf14a3cdf0280149121db005d616", "name": "C", "scopeName": "source.c", "patterns": [ @@ -583,7 +583,7 @@ }, "case_statement": { "name": "meta.conditional.case.c", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3051,7 +3051,7 @@ }, "switch_conditional_parentheses": { "name": "meta.conditional.switch.c", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3099,7 +3099,7 @@ }, "switch_statement": { "name": "meta.block.switch.c", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?:protected|private|public))\\s*(:))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(((?:protected|private|public))\\s*(:))", "captures": { "1": { "patterns": [ @@ -194,7 +194,7 @@ }, "alignas_operator": { "contentName": "meta.arguments.operator.alignas.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignas.cpp" @@ -242,7 +242,7 @@ }, "alignof_operator": { "contentName": "meta.arguments.operator.alignof.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignof.cpp" @@ -442,7 +442,7 @@ } }, "builtin_storage_type_initilizer": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -624,7 +624,7 @@ }, "case_statement": { "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.class.cpp" @@ -966,7 +966,7 @@ ] }, "class_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.class.declare.cpp" @@ -1006,7 +1006,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -1425,7 +1425,7 @@ }, "constructor_inline": { "name": "meta.function.definition.special.constructor.cpp", - "begin": "(^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -1733,7 +1733,7 @@ }, "constructor_root": { "name": "meta.function.definition.special.constructor.cpp", - "begin": "(\\s*+((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "(\\s*+((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))::((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\16((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\()))", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.constructor.cpp" @@ -1924,7 +1924,7 @@ { "patterns": [ { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -2094,7 +2094,7 @@ ] }, "control_flow_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\{)", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\{)", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -2403,7 +2403,7 @@ }, "decltype": { "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" @@ -2451,7 +2451,7 @@ }, "decltype_specifier": { "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" @@ -2499,7 +2499,7 @@ }, "default_statement": { "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(~(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)(~(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -2773,7 +2773,7 @@ }, "destructor_root": { "name": "meta.function.definition.special.member.destructor.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))~\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))::((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))~\\16((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\()))", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.member.destructor.cpp" @@ -2964,7 +2964,7 @@ { "patterns": [ { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -3053,7 +3053,7 @@ }, "diagnostic": { "name": "meta.preprocessor.diagnostic.$reference(directive).cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:error|warning)))\\b\\s*", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?:error|warning)))\\b\\s*", "beginCaptures": { "1": { "name": "keyword.control.directive.diagnostic.$7.cpp" @@ -3307,7 +3307,7 @@ ] }, "enum_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.enum.declare.cpp" @@ -3347,7 +3347,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -3662,7 +3662,7 @@ ] }, "exception_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(extern)(?=\\s*\\\"))", + "begin": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(extern)(?=\\s*\\\"))", "beginCaptures": { "1": { "name": "meta.head.extern.cpp" @@ -3859,7 +3859,7 @@ ] }, "function_call": { - "begin": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", + "begin": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3933,7 +3933,7 @@ }, "function_definition": { "name": "meta.function.definition.cpp", - "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\())", + "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\())", "beginCaptures": { "1": { "name": "meta.head.function.definition.cpp" @@ -3994,7 +3994,7 @@ "11": { "patterns": [ { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))", "captures": { "1": { "name": "storage.modifier.$1.cpp" @@ -4228,7 +4228,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -4529,7 +4529,7 @@ ] }, "function_pointer": { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -4703,7 +4703,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -4843,7 +4843,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -5055,7 +5055,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -5195,7 +5195,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", "captures": { "1": { "name": "keyword.control.goto.cpp" @@ -5335,7 +5335,7 @@ } }, "include": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", + "match": "(?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/))))|(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", "captures": { "1": { "patterns": [ @@ -5535,7 +5535,7 @@ "name": "storage.type.modifier.virtual.cpp" }, { - "match": "(?<=protected|virtual|private|public|,|:)\\s*(?!(?:(?:protected|private|public)|virtual))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(?<=protected|virtual|private|public|,|:)\\s*(?!(?:(?:protected|private|public)|virtual))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", "captures": { "1": { "name": "meta.qualified_type.cpp", @@ -5734,7 +5734,7 @@ "name": "invalid.illegal.unexpected.punctuation.definition.comment.end.cpp" }, "label": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)", "captures": { "1": { "patterns": [ @@ -5795,7 +5795,7 @@ } }, "lambdas": { - "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[))((?:[^\\]\\[]*\\[.*?\\](?!\\s*\\[)[^\\]\\[]*?)*[^\\]\\[]*?)(\\](?!\\[)))", + "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[| *+\"| *+\\d))((?>(?:[^\\[\\]]|((?(?:(?>[^\\[\\]]*)\\g<4>?)+)\\]))*))(\\](?!\\[)))", "beginCaptures": { "2": { "name": "punctuation.definition.capture.begin.lambda.cpp" @@ -5807,7 +5807,7 @@ "include": "#the_this_keyword" }, { - "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", + "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", "captures": { "1": { "name": "variable.parameter.capture.cpp" @@ -5850,7 +5850,7 @@ } ] }, - "4": { + "5": { "name": "punctuation.definition.capture.end.lambda.cpp" } }, @@ -5919,7 +5919,7 @@ }, "line": { "name": "meta.preprocessor.line.cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*line\\b)", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*line\\b)", "beginCaptures": { "1": { "name": "keyword.control.directive.line.cpp" @@ -5987,7 +5987,7 @@ }, "macro": { "name": "meta.preprocessor.macro.cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*define\\b)\\s*((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*define\\b)\\s*((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", "captures": { "1": { "patterns": [ @@ -6124,7 +6124,7 @@ "9": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6166,7 +6166,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6221,7 +6221,7 @@ } }, "memory_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", "captures": { "1": { "patterns": [ @@ -6266,7 +6266,7 @@ } }, "method_access": { - "begin": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", + "begin": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", "beginCaptures": { "1": { "patterns": [ @@ -6308,7 +6308,7 @@ "9": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6350,7 +6350,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6423,7 +6423,7 @@ "name": "storage.modifier.$0.cpp" }, "module_import": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", + "match": "(?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/))))|(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", "captures": { "1": { "patterns": [ @@ -6801,7 +6801,7 @@ }, "noexcept_operator": { "contentName": "meta.arguments.operator.noexcept.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.noexcept.cpp" @@ -6848,7 +6848,7 @@ ] }, "non_primitive_types": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\<|\\())", + "begin": "((?:(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:\\[\\])?)))|(\"\")((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\<|\\())", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.operator-overload.cpp" @@ -7330,7 +7330,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7606,7 +7606,7 @@ "name": "entity.name.operator.type.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7935,7 +7935,7 @@ }, "parameter": { "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\w)", "beginCaptures": { "1": { "patterns": [ @@ -7983,7 +7983,7 @@ "include": "#vararg_ellipses" }, { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", + "match": "((?:((?:volatile|register|restrict|static|extern|const))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))+)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=,|\\)|=)", "captures": { "1": { "patterns": [ @@ -8240,7 +8240,7 @@ "include": "#assignment_operator" }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\)|,|\\[|=|\\n)", + "match": "(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\)|,|\\[|=|\\n)", "captures": { "1": { "patterns": [ @@ -8328,7 +8328,7 @@ "include": "#template_call_range" }, { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*)", "captures": { "0": { "patterns": [ @@ -8337,7 +8337,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8428,7 +8428,7 @@ ] }, "parameter_class": { - "match": "(class)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(class)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.class.parameter.cpp" @@ -8493,7 +8493,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8685,7 +8685,7 @@ } }, "parameter_enum": { - "match": "(enum)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(enum)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.enum.parameter.cpp" @@ -8750,7 +8750,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8943,7 +8943,7 @@ }, "parameter_or_maybe_value": { "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\w)", "beginCaptures": { "1": { "patterns": [ @@ -9000,7 +9000,7 @@ "include": "#vararg_ellipses" }, { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", + "match": "((?:((?:volatile|register|restrict|static|extern|const))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))+)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=,|\\)|=)", "captures": { "1": { "patterns": [ @@ -9257,7 +9257,7 @@ ] }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", + "match": "(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", "captures": { "1": { "patterns": [ @@ -9345,7 +9345,7 @@ "include": "#template_call_range" }, { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*)", "captures": { "0": { "patterns": [ @@ -9354,7 +9354,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9448,7 +9448,7 @@ ] }, "parameter_struct": { - "match": "(struct)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(struct)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.struct.parameter.cpp" @@ -9513,7 +9513,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9705,7 +9705,7 @@ } }, "parameter_union": { - "match": "(union)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(union)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.union.parameter.cpp" @@ -9770,7 +9770,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9989,7 +9989,7 @@ ] }, "posix_reserved_types": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\b)", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*pragma\\b)", "beginCaptures": { "1": { "name": "keyword.control.directive.pragma.cpp" @@ -10078,7 +10078,7 @@ ] }, "pragma_mark": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\s+mark)\\s+(.*)", + "match": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*pragma\\s+mark)\\s+(.*)", "captures": { "1": { "name": "keyword.control.directive.pragma.pragma-mark.cpp" @@ -10202,7 +10202,7 @@ } }, "preprocessor_conditional_range": { - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:(?:ifndef|ifdef)|if)))", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?:(?:ifndef|ifdef)|if)))", "beginCaptures": { "1": { "name": "keyword.control.directive.conditional.$7.cpp" @@ -10254,7 +10254,7 @@ ] }, "preprocessor_conditional_standalone": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", + "match": "\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", "captures": { "0": { "name": "meta.qualified_type.cpp", @@ -10777,7 +10777,7 @@ } }, "qualifiers_and_specifiers_post_parameters": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?", + "match": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?", "captures": { "1": { "name": "meta.qualified_type.cpp", @@ -11588,7 +11588,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -11677,7 +11677,7 @@ } }, "single_line_macro": { - "match": "^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))#define.*(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))#define.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" @@ -11766,7 +11766,7 @@ }, "sizeof_variadic_operator": { "contentName": "meta.arguments.operator.sizeof.variadic.cpp", - "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "(\\bsizeof\\.\\.\\.)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" @@ -11852,7 +11852,7 @@ ] }, "static_assert": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -11939,7 +11939,7 @@ ] }, "storage_specifiers": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.struct.cpp" @@ -12450,7 +12450,7 @@ ] }, "struct_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.struct.declare.cpp" @@ -12490,7 +12490,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -12633,7 +12633,7 @@ }, "switch_conditional_parentheses": { "name": "meta.conditional.switch.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -12681,7 +12681,7 @@ }, "switch_statement": { "name": "meta.block.switch.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", "captures": { "1": { "patterns": [ @@ -13093,7 +13093,7 @@ ] }, "the_this_keyword": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?:(?:(?>\\s+)|(?:\\/\\*)(?:(?>(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", + "match": "(using)\\s*(?!namespace)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", "captures": { "1": { "name": "keyword.other.using.directive.cpp" @@ -13489,7 +13489,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -13620,7 +13620,7 @@ "name": "meta.declaration.type.alias.cpp" }, "type_casting_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.class.cpp" @@ -13950,7 +13950,7 @@ "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14094,7 +14094,7 @@ "end": "(?<=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -14268,7 +14268,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14408,7 +14408,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()|(?=(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.struct.cpp" @@ -14778,7 +14778,7 @@ "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14923,7 +14923,7 @@ "patterns": [ { "name": "meta.block.union.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.union.cpp" @@ -15210,7 +15210,7 @@ "end": "[\\s\\n]*(?=;)|(?=(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -15346,7 +15346,7 @@ }, "typeid_operator": { "contentName": "meta.arguments.operator.typeid.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.typeid.cpp" @@ -15393,7 +15393,7 @@ ] }, "typename": { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", "captures": { "1": { "name": "storage.modifier.cpp" @@ -15616,7 +15616,7 @@ } }, "undef": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*undef\\b)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*undef\\b)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.union.cpp" @@ -15976,7 +15976,7 @@ ] }, "union_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.union.declare.cpp" @@ -16016,7 +16016,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ diff --git a/extensions/cpp/syntaxes/cpp.tmLanguage.json b/extensions/cpp/syntaxes/cpp.tmLanguage.json index 1a51b65d86c..f013cbb8732 100644 --- a/extensions/cpp/syntaxes/cpp.tmLanguage.json +++ b/extensions/cpp/syntaxes/cpp.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/fedd206d1b2803f31a278e9b5f098ce4bc76e532", + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/666808cab3907fc91ed4d3901060ee6b045cca58", "name": "C++", "scopeName": "source.cpp", "patterns": [ @@ -95,7 +95,7 @@ ], "repository": { "access_control_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?:protected|private|public))\\s*(:))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(((?:protected|private|public))\\s*(:))", "captures": { "1": { "patterns": [ @@ -194,7 +194,7 @@ }, "alignas_operator": { "contentName": "meta.arguments.operator.alignas.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignas.cpp" @@ -242,7 +242,7 @@ }, "alignof_operator": { "contentName": "meta.arguments.operator.alignof.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.alignof.cpp" @@ -442,7 +442,7 @@ } }, "builtin_storage_type_initilizer": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -624,7 +624,7 @@ }, "case_statement": { "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.class.cpp" @@ -966,7 +966,7 @@ ] }, "class_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.class.declare.cpp" @@ -1006,7 +1006,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -1425,7 +1425,7 @@ }, "constructor_inline": { "name": "meta.function.definition.special.constructor.cpp", - "begin": "(^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -1733,7 +1733,7 @@ }, "constructor_root": { "name": "meta.function.definition.special.constructor.cpp", - "begin": "(\\s*+((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "(\\s*+((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))::((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\16((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\()))", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.constructor.cpp" @@ -1924,7 +1924,7 @@ { "patterns": [ { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -2094,7 +2094,7 @@ ] }, "control_flow_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\{)", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\{)", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -2403,7 +2403,7 @@ }, "decltype": { "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" @@ -2451,7 +2451,7 @@ }, "decltype_specifier": { "contentName": "meta.arguments.decltype.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.other.decltype.cpp storage.type.decltype.cpp" @@ -2499,7 +2499,7 @@ }, "default_statement": { "name": "meta.conditional.case.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(~(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:constexpr|explicit|mutable|virtual|inline|friend)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)(~(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -2773,7 +2773,7 @@ }, "destructor_root": { "name": "meta.function.definition.special.member.destructor.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))::((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))~\\16((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\()))", + "begin": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<14>?)+)>)\\s*)?::)*)(((?>(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))::((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))~\\16((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\()))", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.member.destructor.cpp" @@ -2964,7 +2964,7 @@ { "patterns": [ { - "match": "(\\=)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(default)|(delete))", + "match": "(\\=)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(default)|(delete))", "captures": { "1": { "name": "keyword.operator.assignment.cpp" @@ -3053,7 +3053,7 @@ }, "diagnostic": { "name": "meta.preprocessor.diagnostic.$reference(directive).cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:error|warning)))\\b\\s*", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?:error|warning)))\\b\\s*", "beginCaptures": { "1": { "name": "keyword.control.directive.diagnostic.$7.cpp" @@ -3307,7 +3307,7 @@ ] }, "enum_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.enum.declare.cpp" @@ -3347,7 +3347,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -3662,7 +3662,7 @@ ] }, "exception_keywords": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(extern)(?=\\s*\\\"))", + "begin": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(extern)(?=\\s*\\\"))", "beginCaptures": { "1": { "name": "meta.head.extern.cpp" @@ -3859,7 +3859,7 @@ ] }, "function_call": { - "begin": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", + "begin": "((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(((?(?:(?>[^<>]*)\\g<12>?)+)>)\\s*)?(\\()", "beginCaptures": { "1": { "patterns": [ @@ -3933,7 +3933,7 @@ }, "function_definition": { "name": "meta.function.definition.cpp", - "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\())", + "begin": "((?:(?:^|\\G|(?<=;|\\}))|(?<=>))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<70>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\())", "beginCaptures": { "1": { "name": "meta.head.function.definition.cpp" @@ -3994,7 +3994,7 @@ "11": { "patterns": [ { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))", "captures": { "1": { "name": "storage.modifier.$1.cpp" @@ -4228,7 +4228,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -4529,7 +4529,7 @@ ] }, "function_pointer": { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -4703,7 +4703,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -4843,7 +4843,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", + "end": "(\\))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -4881,7 +4881,7 @@ ] }, "function_pointer_parameter": { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -5055,7 +5055,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -5195,7 +5195,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", + "end": "(\\))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -5299,7 +5299,7 @@ ] }, "goto_statement": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)", "captures": { "1": { "name": "keyword.control.goto.cpp" @@ -5335,7 +5335,7 @@ } }, "include": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", + "match": "(?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((#)\\s*((?:include|include_next))\\b)\\s*(?:(?:(?:((<)[^>]*(>?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/))))|(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))", "captures": { "1": { "patterns": [ @@ -5535,7 +5535,7 @@ "name": "storage.type.modifier.virtual.cpp" }, { - "match": "(?<=protected|virtual|private|public|,|:)\\s*(?!(?:(?:protected|private|public)|virtual))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(?<=protected|virtual|private|public|,|:)\\s*(?!(?:(?:protected|private|public)|virtual))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))", "captures": { "1": { "name": "meta.qualified_type.cpp", @@ -5734,7 +5734,7 @@ "name": "invalid.illegal.unexpected.punctuation.definition.comment.end.cpp" }, "label": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)", "captures": { "1": { "patterns": [ @@ -5795,7 +5795,7 @@ } }, "lambdas": { - "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[))((?:[^\\]\\[]*\\[.*?\\](?!\\s*\\[)[^\\]\\[]*?)*[^\\]\\[]*?)(\\](?!\\[)))", + "begin": "((?:(?<=[^\\s]|^)(?])|(?<=\\Wreturn|^return))\\s*(\\[(?!\\[| *+\"| *+\\d))((?>(?:[^\\[\\]]|((?(?:(?>[^\\[\\]]*)\\g<4>?)+)\\]))*))(\\](?!\\[)))", "beginCaptures": { "2": { "name": "punctuation.definition.capture.begin.lambda.cpp" @@ -5807,7 +5807,7 @@ "include": "#the_this_keyword" }, { - "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", + "match": "((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?=\\]|\\z|$)|(,))|(\\=))", "captures": { "1": { "name": "variable.parameter.capture.cpp" @@ -5850,7 +5850,7 @@ } ] }, - "4": { + "5": { "name": "punctuation.definition.capture.end.lambda.cpp" } }, @@ -5919,7 +5919,7 @@ }, "line": { "name": "meta.preprocessor.line.cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*line\\b)", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*line\\b)", "beginCaptures": { "1": { "name": "keyword.control.directive.line.cpp" @@ -5987,7 +5987,7 @@ }, "macro": { "name": "meta.preprocessor.macro.cpp", - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*define\\b)\\s*((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*define\\b)\\s*((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!uint_least64_t[^(?-mix:\\w)]|uint_least16_t[^(?-mix:\\w)]|uint_least32_t[^(?-mix:\\w)]|int_least16_t[^(?-mix:\\w)]|uint_fast64_t[^(?-mix:\\w)]|uint_fast32_t[^(?-mix:\\w)]|uint_fast16_t[^(?-mix:\\w)]|uint_least8_t[^(?-mix:\\w)]|int_least64_t[^(?-mix:\\w)]|int_least32_t[^(?-mix:\\w)]|int_fast32_t[^(?-mix:\\w)]|int_fast16_t[^(?-mix:\\w)]|int_least8_t[^(?-mix:\\w)]|uint_fast8_t[^(?-mix:\\w)]|int_fast64_t[^(?-mix:\\w)]|int_fast8_t[^(?-mix:\\w)]|suseconds_t[^(?-mix:\\w)]|useconds_t[^(?-mix:\\w)]|in_addr_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintmax_t[^(?-mix:\\w)]|uintptr_t[^(?-mix:\\w)]|blksize_t[^(?-mix:\\w)]|in_port_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|unsigned[^(?-mix:\\w)]|blkcnt_t[^(?-mix:\\w)]|uint32_t[^(?-mix:\\w)]|u_quad_t[^(?-mix:\\w)]|uint16_t[^(?-mix:\\w)]|intmax_t[^(?-mix:\\w)]|uint64_t[^(?-mix:\\w)]|intptr_t[^(?-mix:\\w)]|swblk_t[^(?-mix:\\w)]|wchar_t[^(?-mix:\\w)]|u_short[^(?-mix:\\w)]|qaddr_t[^(?-mix:\\w)]|caddr_t[^(?-mix:\\w)]|daddr_t[^(?-mix:\\w)]|fixpt_t[^(?-mix:\\w)]|nlink_t[^(?-mix:\\w)]|segsz_t[^(?-mix:\\w)]|clock_t[^(?-mix:\\w)]|ssize_t[^(?-mix:\\w)]|int16_t[^(?-mix:\\w)]|int32_t[^(?-mix:\\w)]|int64_t[^(?-mix:\\w)]|uint8_t[^(?-mix:\\w)]|int8_t[^(?-mix:\\w)]|mode_t[^(?-mix:\\w)]|quad_t[^(?-mix:\\w)]|ushort[^(?-mix:\\w)]|u_long[^(?-mix:\\w)]|u_char[^(?-mix:\\w)]|double[^(?-mix:\\w)]|size_t[^(?-mix:\\w)]|signed[^(?-mix:\\w)]|time_t[^(?-mix:\\w)]|key_t[^(?-mix:\\w)]|ino_t[^(?-mix:\\w)]|gid_t[^(?-mix:\\w)]|dev_t[^(?-mix:\\w)]|div_t[^(?-mix:\\w)]|float[^(?-mix:\\w)]|u_int[^(?-mix:\\w)]|uid_t[^(?-mix:\\w)]|short[^(?-mix:\\w)]|off_t[^(?-mix:\\w)]|pid_t[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|bool[^(?-mix:\\w)]|char[^(?-mix:\\w)]|id_t[^(?-mix:\\w)]|uint[^(?-mix:\\w)]|void[^(?-mix:\\w)]|long[^(?-mix:\\w)]|auto[^(?-mix:\\w)]|int[^(?-mix:\\w)])(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\b(?!\\())", "captures": { "1": { "patterns": [ @@ -6124,7 +6124,7 @@ "9": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6166,7 +6166,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6221,7 +6221,7 @@ } }, "memory_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w))", "captures": { "1": { "patterns": [ @@ -6266,7 +6266,7 @@ } }, "method_access": { - "begin": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", + "begin": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s*(?:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(~?(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\()", "beginCaptures": { "1": { "patterns": [ @@ -6308,7 +6308,7 @@ "9": { "patterns": [ { - "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?<=(?:\\.\\*|\\.|->|->\\*))\\s*(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6350,7 +6350,7 @@ } }, { - "match": "(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\*|->)))", + "match": "(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\*|->)))", "captures": { "1": { "patterns": [ @@ -6423,7 +6423,7 @@ "name": "storage.modifier.$0.cpp" }, "module_import": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=\\/\\/))))|(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", + "match": "(?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((import))\\s*(?:(?:(?:((<)[^>]*(>?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/)))|((\\\")[^\\\"]*(\\\"?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=\\/\\/))))|(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*(?:\\.(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)*((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;)))))|((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:\\n|$)|(?=(?:\\/\\/|;))))\\s*(;?)", "captures": { "1": { "patterns": [ @@ -6801,7 +6801,7 @@ }, "noexcept_operator": { "contentName": "meta.arguments.operator.noexcept.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.noexcept.cpp" @@ -6848,7 +6848,7 @@ ] }, "non_primitive_types": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:\\[\\])?)))|(\"\")((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\<|\\())", + "begin": "((?:(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:__cdecl|__clrcall|__stdcall|__fastcall|__thiscall|__vectorcall)?)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(operator)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<67>?)+)>)\\s*)?::)*)(?:(?:((?:delete\\[\\]|delete|new\\[\\]|<=>|<<=|new|>>=|\\->\\*|\\/=|%=|&=|>=|\\|=|\\+\\+|\\-\\-|\\(\\)|\\[\\]|\\->|\\+\\+|<<|>>|\\-\\-|<=|\\^=|==|!=|&&|\\|\\||\\+=|\\-=|\\*=|,|\\+|\\-|!|~|\\*|&|\\*|\\/|%|\\+|\\-|<|>|&|\\^|\\||=))|((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:\\[\\])?)))|(\"\")((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\<|\\())", "beginCaptures": { "1": { "name": "meta.head.function.definition.special.operator-overload.cpp" @@ -7330,7 +7330,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7606,7 +7606,7 @@ "name": "entity.name.operator.type.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -7935,7 +7935,7 @@ }, "parameter": { "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\w)", "beginCaptures": { "1": { "patterns": [ @@ -7983,7 +7983,7 @@ "include": "#vararg_ellipses" }, { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", + "match": "((?:((?:volatile|register|restrict|static|extern|const))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))+)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=,|\\)|=)", "captures": { "1": { "patterns": [ @@ -8240,7 +8240,7 @@ "include": "#assignment_operator" }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\)|,|\\[|=|\\n)", + "match": "(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\)|,|\\[|=|\\n)", "captures": { "1": { "patterns": [ @@ -8328,7 +8328,7 @@ "include": "#template_call_range" }, { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*)", "captures": { "0": { "patterns": [ @@ -8337,7 +8337,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8428,7 +8428,7 @@ ] }, "parameter_class": { - "match": "(class)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(class)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.class.parameter.cpp" @@ -8493,7 +8493,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8685,7 +8685,7 @@ } }, "parameter_enum": { - "match": "(enum)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(enum)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.enum.parameter.cpp" @@ -8750,7 +8750,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -8943,7 +8943,7 @@ }, "parameter_or_maybe_value": { "name": "meta.parameter.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\w)", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\w)", "beginCaptures": { "1": { "patterns": [ @@ -9000,7 +9000,7 @@ "include": "#vararg_ellipses" }, { - "match": "((?:((?:volatile|register|restrict|static|extern|const))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))+)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=,|\\)|=)", + "match": "((?:((?:volatile|register|restrict|static|extern|const))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))+)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=,|\\)|=)", "captures": { "1": { "patterns": [ @@ -9257,7 +9257,7 @@ ] }, { - "match": "(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", + "match": "(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=(?:\\)|,|\\[|=|\\/\\/|(?:\\n|$)))", "captures": { "1": { "patterns": [ @@ -9345,7 +9345,7 @@ "include": "#template_call_range" }, { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*)", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*)", "captures": { "0": { "patterns": [ @@ -9354,7 +9354,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9448,7 +9448,7 @@ ] }, "parameter_struct": { - "match": "(struct)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(struct)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.struct.parameter.cpp" @@ -9513,7 +9513,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9705,7 +9705,7 @@ } }, "parameter_union": { - "match": "(union)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:\\[((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\]((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?=,|\\)|\\n)", + "match": "(union)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:\\[((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\]((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?=,|\\)|\\n)", "captures": { "1": { "name": "storage.type.union.parameter.cpp" @@ -9770,7 +9770,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -9989,7 +9989,7 @@ ] }, "posix_reserved_types": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\b)", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*pragma\\b)", "beginCaptures": { "1": { "name": "keyword.control.directive.pragma.cpp" @@ -10078,7 +10078,7 @@ ] }, "pragma_mark": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*pragma\\s+mark)\\s+(.*)", + "match": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*pragma\\s+mark)\\s+(.*)", "captures": { "1": { "name": "keyword.control.directive.pragma.pragma-mark.cpp" @@ -10202,7 +10202,7 @@ } }, "preprocessor_conditional_range": { - "begin": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?:(?:ifndef|ifdef)|if)))", + "begin": "((?:^)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?:(?:ifndef|ifdef)|if)))", "beginCaptures": { "1": { "name": "keyword.control.directive.conditional.$7.cpp" @@ -10254,7 +10254,7 @@ ] }, "preprocessor_conditional_standalone": { - "match": "(?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", + "match": "\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<26>?)+)>)\\s*)?(?![\\w<:.])", "captures": { "0": { "name": "meta.qualified_type.cpp", @@ -10777,7 +10777,7 @@ } }, "qualifiers_and_specifiers_post_parameters": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?", + "match": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?", "captures": { "1": { "name": "meta.qualified_type.cpp", @@ -11588,7 +11588,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -11677,7 +11677,7 @@ } }, "single_line_macro": { - "match": "^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))#define.*(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))#define.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.cpp" @@ -11766,7 +11766,7 @@ }, "sizeof_variadic_operator": { "contentName": "meta.arguments.operator.sizeof.variadic.cpp", - "begin": "(\\bsizeof\\.\\.\\.)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "(\\bsizeof\\.\\.\\.)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.sizeof.variadic.cpp" @@ -11852,7 +11852,7 @@ ] }, "static_assert": { - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -11939,7 +11939,7 @@ ] }, "storage_specifiers": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.struct.cpp" @@ -12450,7 +12450,7 @@ ] }, "struct_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.struct.declare.cpp" @@ -12490,7 +12490,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -12633,7 +12633,7 @@ }, "switch_conditional_parentheses": { "name": "meta.conditional.switch.cpp", - "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "patterns": [ @@ -12681,7 +12681,7 @@ }, "switch_statement": { "name": "meta.block.switch.cpp", - "begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", + "match": "((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)|((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*\\s+)+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))|((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*(\\.\\.\\.)\\s*((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*(?:(,)|(?=>|$))", "captures": { "1": { "patterns": [ @@ -13093,7 +13093,7 @@ ] }, "the_this_keyword": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?:(?:(?>\\s+)|(?:\\/\\*)(?:(?>(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", + "match": "(using)\\s*(?!namespace)(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))\\s*(\\=)\\s*((?:typename)?)\\s*((?:(?:(?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)(?:(?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<58>?)+)>)\\s*)?(?![\\w<:.]))|(.*(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:(\\[)(\\w*)(\\])\\s*)?\\s*(?:(;)|\\n)", "captures": { "1": { "name": "keyword.other.using.directive.cpp" @@ -13489,7 +13489,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -13620,7 +13620,7 @@ "name": "meta.declaration.type.alias.cpp" }, "type_casting_operators": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.class.cpp" @@ -13950,7 +13950,7 @@ "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14094,7 +14094,7 @@ "end": "(?<=;)", "patterns": [ { - "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", + "begin": "(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<27>?)+)>)\\s*)?(?![\\w<:.]))(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()(\\*)\\s*((?:(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)?)\\s*(?:(\\[)(\\w*)(\\])\\s*)*(\\))\\s*(\\()", "beginCaptures": { "1": { "name": "meta.qualified_type.cpp", @@ -14268,7 +14268,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14408,7 +14408,7 @@ "name": "punctuation.section.parameters.begin.bracket.round.function.pointer.cpp" } }, - "end": "(\\))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=[{=,);]|\\n)(?!\\()", + "end": "(\\))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=[{=,);]|\\n)(?!\\()", "endCaptures": { "1": { "name": "punctuation.section.parameters.end.bracket.round.function.pointer.cpp" @@ -14448,7 +14448,7 @@ ] }, "typedef_keyword": { - "match": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.struct.cpp" @@ -14778,7 +14778,7 @@ "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -14923,7 +14923,7 @@ "patterns": [ { "name": "meta.block.union.cpp", - "begin": "((((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.union.cpp" @@ -15210,7 +15210,7 @@ "end": "[\\s\\n]*(?=;)", "patterns": [ { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ @@ -15346,7 +15346,7 @@ }, "typeid_operator": { "contentName": "meta.arguments.operator.typeid.cpp", - "begin": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()", + "begin": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\()", "beginCaptures": { "1": { "name": "keyword.operator.functionlike.cpp keyword.operator.typeid.cpp" @@ -15393,7 +15393,7 @@ ] }, "typename": { - "match": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", + "match": "(((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(\\s*+((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?:(?:(?:unsigned|signed|short|long)|(?:struct|class|union|enum))((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(((::)?(?:((?-mix:(?!\\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_cancel|atomic_commit|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|consteval|constexpr|protected|namespace|co_return|constexpr|constexpr|continue|explicit|volatile|noexcept|co_yield|noexcept|noexcept|requires|typename|decltype|operator|co_await|template|volatile|register|restrict|reflexpr|alignof|private|default|mutable|include|concept|__asm__|defined|_Pragma|alignas|typedef|warning|virtual|mutable|struct|sizeof|delete|not_eq|bitand|and_eq|xor_eq|typeid|switch|return|static|extern|inline|friend|public|ifndef|define|pragma|export|import|module|catch|throw|const|or_eq|while|compl|bitor|const|union|ifdef|class|undef|error|break|using|endif|goto|line|enum|this|case|else|elif|else|asm|try|for|new|and|xor|not|do|or|if|if)\\b)(?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*))\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?::)*\\s*+)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\s*+(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(::))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?!(?:transaction_safe_dynamic|__has_cpp_attribute|transaction_safe|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|dynamic_cast|thread_local|synchronized|static_cast|const_cast|constexpr|consteval|protected|constexpr|co_return|namespace|constexpr|noexcept|typename|decltype|template|operator|noexcept|co_yield|co_await|continue|volatile|register|restrict|explicit|override|volatile|reflexpr|noexcept|requires|default|typedef|nullptr|alignof|mutable|concept|virtual|defined|__asm__|include|_Pragma|mutable|warning|private|alignas|module|switch|not_eq|bitand|and_eq|ifndef|return|sizeof|xor_eq|export|static|delete|public|define|extern|inline|import|pragma|friend|typeid|const|compl|bitor|throw|or_eq|while|catch|break|false|final|const|endif|ifdef|undef|error|using|audit|axiom|line|else|elif|true|NULL|case|goto|else|this|new|asm|not|and|xor|try|for|if|do|or|if)\\b)((?:[a-zA-Z_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\\\u[0-9a-fA-F]{4}|\\\\U[0-9a-fA-F]{8}))*)\\b(((?(?:(?>[^<>]*)\\g<36>?)+)>)\\s*)?(?![\\w<:.]))", "captures": { "1": { "name": "storage.modifier.cpp" @@ -15616,7 +15616,7 @@ } }, "undef": { - "match": "((?:^)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(#)\\s*undef\\b)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(#)\\s*undef\\b)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(DLLEXPORT)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?:(?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(final)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(:)((?>[^{]*)))?))", + "begin": "((((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))|((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\))))|(?={))(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(DLLEXPORT)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?((?:(?:(?:\\[\\[.*?\\]\\]|__attribute(?:__)?\\(\\(.*?\\)\\))|__declspec\\(.*?\\))|alignas\\(.*?\\))(?!\\)))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?:(?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(final)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))?(?:((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(:)((?>[^{]*)))?))", "beginCaptures": { "1": { "name": "meta.head.union.cpp" @@ -15976,7 +15976,7 @@ ] }, "union_declare": { - "match": "((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))?(?:(?:\\&|\\*)((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))*(?:\\&|\\*))?((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))\\b(?!override\\W|override\\$|final\\W|final\\$)((?\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(?=\\S)(?![:{])", + "match": "((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))?(?:(?:\\&|\\*)((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))))*(?:\\&|\\*))?((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))\\b(?!override\\W|override\\$|final\\W|final\\$)((?(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))(?=\\S)(?![:{])", "captures": { "1": { "name": "storage.type.union.declare.cpp" @@ -16016,7 +16016,7 @@ "name": "storage.modifier.pointer.cpp" }, { - "match": "(?:\\&((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))){2,}\\&", + "match": "(?:\\&((?>(?:(?:(?>(?(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z))))){2,}\\&", "captures": { "1": { "patterns": [ diff --git a/extensions/csharp/cgmanifest.json b/extensions/csharp/cgmanifest.json index beef7f27b8f..6156bbb5082 100644 --- a/extensions/csharp/cgmanifest.json +++ b/extensions/csharp/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "dotnet/csharp-tmLanguage", "repositoryUrl": "https://github.com/dotnet/csharp-tmLanguage", - "commitHash": "ad7514e8d78542a6ee37f6187091cd4102eb3797" + "commitHash": "572697a2c2267430010b3534281f73337144e94f" } }, "license": "MIT", diff --git a/extensions/csharp/syntaxes/csharp.tmLanguage.json b/extensions/csharp/syntaxes/csharp.tmLanguage.json index 4d80bcc364e..8e26aaefa77 100644 --- a/extensions/csharp/syntaxes/csharp.tmLanguage.json +++ b/extensions/csharp/syntaxes/csharp.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/dotnet/csharp-tmLanguage/commit/ad7514e8d78542a6ee37f6187091cd4102eb3797", + "version": "https://github.com/dotnet/csharp-tmLanguage/commit/572697a2c2267430010b3534281f73337144e94f", "name": "C#", "scopeName": "source.cs", "patterns": [ @@ -2498,7 +2498,7 @@ }, "interpolation": { "name": "meta.interpolation.cs", - "begin": "(?<=[^\\{])((?:\\{\\{)*)(\\{)(?=[^\\{])", + "begin": "(?<=[^\\{]|^)((?:\\{\\{)*)(\\{)(?=[^\\{])", "beginCaptures": { "1": { "name": "string.quoted.double.cs" diff --git a/extensions/java/cgmanifest.json b/extensions/java/cgmanifest.json index 762917e9802..b7090d4a45c 100644 --- a/extensions/java/cgmanifest.json +++ b/extensions/java/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "atom/language-java", "repositoryUrl": "https://github.com/atom/language-java", - "commitHash": "123beb50115b0bfb0db8f2325df6d05fb8a016a8" + "commitHash": "0facf7cbe02cda460db1160fd730f2e57bf15c36" } }, "license": "MIT", - "version": "0.31.3" + "version": "0.31.4" } ], "version": 1 diff --git a/extensions/java/syntaxes/java.tmLanguage.json b/extensions/java/syntaxes/java.tmLanguage.json index f806edf7b6d..7dad7d72837 100644 --- a/extensions/java/syntaxes/java.tmLanguage.json +++ b/extensions/java/syntaxes/java.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-java/commit/123beb50115b0bfb0db8f2325df6d05fb8a016a8", + "version": "https://github.com/atom/language-java/commit/0facf7cbe02cda460db1160fd730f2e57bf15c36", "name": "Java", "scopeName": "source.java", "patterns": [ @@ -209,7 +209,7 @@ "name": "keyword.control.new.java" } }, - "end": "(?=;|\\)|,|:|}|\\+|\\-|\\*|\\/|%|!|&|\\||=)", + "end": "(?=;|\\)|\\]|\\.|,|\\?|:|}|\\+|\\-|\\*|\\/(?!\\/|\\*)|%|!|&|\\||\\^|=)", "patterns": [ { "include": "#comments" @@ -269,7 +269,7 @@ ] }, "class": { - "begin": "(?=\\w?[\\w\\s]*\\b(?:class|(? Date: Tue, 10 Dec 2019 12:36:26 +0100 Subject: [PATCH 282/637] ignore .git files for ext recommendations fixes #86427 --- .../contrib/extensions/browser/extensionTipsService.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 3d934b3d584..34b68dbb7ea 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -755,6 +755,11 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe return; } + // ignore .git files + if (fileExtension === 'git') { + return; + } + await this.extensionService.whenInstalledExtensionsRegistered(); const mimeTypes = guessMimeTypes(uri); if (mimeTypes.length !== 1 || mimeTypes[0] !== MIME_UNKNOWN) { From 9980464a4c4106add9d54bbb665fe28c6c311348 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 12:42:51 +0100 Subject: [PATCH 283/637] Add a Port... -> Forward Port... for consistency Part of #86064 --- src/vs/workbench/contrib/remote/browser/tunnelView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 9f9f6612801..ea19a1064df 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -95,7 +95,7 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { }); } groups.push({ - label: nls.localize('remote.tunnelsView.add', "Add a Port..."), + label: nls.localize('remote.tunnelsView.add', "Forward Port..."), tunnelType: TunnelType.Add, }); return groups; From 3f311102de995d010f57e49bb84f56534416477d Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Tue, 10 Dec 2019 12:58:19 +0100 Subject: [PATCH 284/637] Fixes microsoft/monaco-editor#173: Stop propagation when a keyboard event is handled in the editor --- src/vs/editor/standalone/browser/simpleServices.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index d9701b08ae0..9fd2d80f1d0 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -305,6 +305,7 @@ export class StandaloneKeybindingService extends AbstractKeybindingService { let shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target); if (shouldPreventDefault) { keyEvent.preventDefault(); + keyEvent.stopPropagation(); } })); } From 97eb9163551362b454a96964ea5dd87a54bd2199 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 13:16:22 +0100 Subject: [PATCH 285/637] :lipstick: --- src/vs/base/common/errors.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/base/common/errors.ts b/src/vs/base/common/errors.ts index 0beea24d6f3..b2440204634 100644 --- a/src/vs/base/common/errors.ts +++ b/src/vs/base/common/errors.ts @@ -31,7 +31,7 @@ export class ErrorHandler { }; } - public addListener(listener: ErrorListenerCallback): ErrorListenerUnbind { + addListener(listener: ErrorListenerCallback): ErrorListenerUnbind { this.listeners.push(listener); return () => { @@ -49,21 +49,21 @@ export class ErrorHandler { this.listeners.splice(this.listeners.indexOf(listener), 1); } - public setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void { + setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void { this.unexpectedErrorHandler = newUnexpectedErrorHandler; } - public getUnexpectedErrorHandler(): (e: any) => void { + getUnexpectedErrorHandler(): (e: any) => void { return this.unexpectedErrorHandler; } - public onUnexpectedError(e: any): void { + onUnexpectedError(e: any): void { this.unexpectedErrorHandler(e); this.emit(e); } // For external errors, we don't want the listeners to be called - public onUnexpectedExternalError(e: any): void { + onUnexpectedExternalError(e: any): void { this.unexpectedErrorHandler(e); } } From 9daf2387aef4fdb44d5d3b1670c452499d9aedf9 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Tue, 10 Dec 2019 14:01:23 +0100 Subject: [PATCH 286/637] Fixes microsoft/monaco-editor#194 --- src/vs/editor/browser/widget/codeEditorWidget.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 4bfde519d76..e3a0b8dd88b 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -417,9 +417,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE // Current model is the new model return; } - + const hasTextFocus = this.hasTextFocus(); const detachedModel = this._detachModel(); this._attachModel(model); + if (hasTextFocus && this.hasModel()) { + this.focus(); + } const e: editorCommon.IModelChangedEvent = { oldModelUrl: detachedModel ? detachedModel.uri : null, From 185d71b615e529b154c76907764bfda9270cb42f Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Tue, 10 Dec 2019 14:14:57 +0100 Subject: [PATCH 287/637] Fixes microsoft/monaco-editor#211: Consume all mouse wheel events by default --- .../browser/viewParts/editorScrollbar/editorScrollbar.ts | 1 + src/vs/editor/common/config/editorOptions.ts | 8 ++++++++ src/vs/editor/contrib/gotoSymbol/peek/referencesWidget.ts | 3 ++- .../contrib/callHierarchy/browser/callHierarchyPeek.ts | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts b/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts index d816f1265e8..11a01c1eb11 100644 --- a/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts +++ b/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.ts @@ -50,6 +50,7 @@ export class EditorScrollbar extends ViewPart { horizontalScrollbarSize: scrollbar.horizontalScrollbarSize, horizontalSliderSize: scrollbar.horizontalSliderSize, handleMouseWheel: scrollbar.handleMouseWheel, + alwaysConsumeMouseWheel: scrollbar.alwaysConsumeMouseWheel, arrowSize: scrollbar.arrowSize, mouseWheelScrollSensitivity: mouseWheelScrollSensitivity, fastScrollSensitivity: fastScrollSensitivity, diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index a5c35ef4b60..71d3e899a4a 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -2321,6 +2321,11 @@ export interface IEditorScrollbarOptions { * Defaults to true. */ handleMouseWheel?: boolean; + /** + * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events). + * Defaults to true. + */ + alwaysConsumeMouseWheel?: boolean; /** * Height in pixels for the horizontal scrollbar. * Defaults to 10 (px). @@ -2351,6 +2356,7 @@ export interface InternalEditorScrollbarOptions { readonly verticalHasArrows: boolean; readonly horizontalHasArrows: boolean; readonly handleMouseWheel: boolean; + readonly alwaysConsumeMouseWheel: boolean; readonly horizontalScrollbarSize: number; readonly horizontalSliderSize: number; readonly verticalScrollbarSize: number; @@ -2385,6 +2391,7 @@ class EditorScrollbar extends BaseEditorOption Date: Tue, 10 Dec 2019 14:27:31 +0100 Subject: [PATCH 288/637] Fix compilation --- .../test/common/viewLayout/editorLayoutProvider.test.ts | 1 + src/vs/monaco.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts index 3b34c85db14..8e71814c2aa 100644 --- a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts +++ b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts @@ -60,6 +60,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => { verticalHasArrows: input.verticalScrollbarHasArrows, horizontalHasArrows: false, handleMouseWheel: EditorOptions.scrollbar.defaultValue.handleMouseWheel, + alwaysConsumeMouseWheel: true, horizontalScrollbarSize: input.horizontalScrollbarHeight, horizontalSliderSize: EditorOptions.scrollbar.defaultValue.horizontalSliderSize, verticalScrollbarSize: input.verticalScrollbarWidth, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 100626ba2f1..9c2896240f3 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -3359,6 +3359,11 @@ declare namespace monaco.editor { * Defaults to true. */ handleMouseWheel?: boolean; + /** + * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events). + * Defaults to true. + */ + alwaysConsumeMouseWheel?: boolean; /** * Height in pixels for the horizontal scrollbar. * Defaults to 10 (px). @@ -3389,6 +3394,7 @@ declare namespace monaco.editor { readonly verticalHasArrows: boolean; readonly horizontalHasArrows: boolean; readonly handleMouseWheel: boolean; + readonly alwaysConsumeMouseWheel: boolean; readonly horizontalScrollbarSize: number; readonly horizontalSliderSize: number; readonly verticalScrollbarSize: number; From 17f0e4ba29b58bc7b6d27bf487117dc4fc5862e1 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Tue, 10 Dec 2019 14:59:58 +0100 Subject: [PATCH 289/637] Fixes microsoft/monaco-editor#812 --- src/vs/editor/contrib/hover/hoverWidgets.ts | 2 +- src/vs/editor/contrib/hover/modesContentHover.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/contrib/hover/hoverWidgets.ts b/src/vs/editor/contrib/hover/hoverWidgets.ts index 9077e4a9eb0..9d55f8340a6 100644 --- a/src/vs/editor/contrib/hover/hoverWidgets.ts +++ b/src/vs/editor/contrib/hover/hoverWidgets.ts @@ -19,7 +19,7 @@ export class ContentHoverWidget extends Widget implements IContentWidget { protected _editor: ICodeEditor; private _isVisible: boolean; private readonly _containerDomNode: HTMLElement; - private readonly _domNode: HTMLElement; + protected readonly _domNode: HTMLElement; protected _showAtPosition: Position | null; protected _showAtRange: Range | null; private _stoleFocus: boolean; diff --git a/src/vs/editor/contrib/hover/modesContentHover.ts b/src/vs/editor/contrib/hover/modesContentHover.ts index de0e08e7099..63fd6053301 100644 --- a/src/vs/editor/contrib/hover/modesContentHover.ts +++ b/src/vs/editor/contrib/hover/modesContentHover.ts @@ -13,7 +13,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Position } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; -import { DocumentColorProvider, Hover as MarkdownHover, HoverProviderRegistry, IColor } from 'vs/editor/common/modes'; +import { DocumentColorProvider, Hover as MarkdownHover, HoverProviderRegistry, IColor, TokenizationRegistry } from 'vs/editor/common/modes'; import { getColorPresentations } from 'vs/editor/contrib/colorPicker/color'; import { ColorDetector } from 'vs/editor/contrib/colorPicker/colorDetector'; import { ColorPickerModel } from 'vs/editor/contrib/colorPicker/colorPickerModel'; @@ -238,6 +238,12 @@ export class ModesContentHoverWidget extends ContentHoverWidget { this._register(editor.onDidChangeConfiguration((e) => { this._hoverOperation.setHoverTime(this._editor.getOption(EditorOption.hover).delay); })); + this._register(TokenizationRegistry.onDidChange((e) => { + if (this.isVisible && this._lastRange && this._messages.length > 0) { + this._domNode.textContent = ''; + this._renderMessages(this._lastRange, this._messages); + } + })); } dispose(): void { From b2fcf2d3a26bc1451d6be68d3d9b8d566e73a26e Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 15:01:51 +0100 Subject: [PATCH 290/637] Fix #86663 --- .../api/common/extHostContributions.ts | 82 +++++++++++++++++++ .../api/common/extHostInitDataService.ts | 2 + .../workbench/api/node/extHostLogService.ts | 35 +++++--- .../workbench/api/worker/extHostLogService.ts | 25 ++++-- .../extensions/common/extensionHostMain.ts | 13 ++- 5 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 src/vs/workbench/api/common/extHostContributions.ts diff --git a/src/vs/workbench/api/common/extHostContributions.ts b/src/vs/workbench/api/common/extHostContributions.ts new file mode 100644 index 00000000000..e496cd73cdc --- /dev/null +++ b/src/vs/workbench/api/common/extHostContributions.ts @@ -0,0 +1,82 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { BrandedService, IInstantiationService, ServicesAccessor, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IDisposable, dispose } from 'vs/base/common/lifecycle'; + +/** + * An ext host contribution that will be loaded when the extension host starts and disposed when the extension host shuts down. + */ +export interface IExtHostContribution extends IDisposable { + // Marker Interface +} + +export namespace Extensions { + export const ExtHost = 'exthost.contributions.kind'; +} + +type IExtHostContributionSignature = new (...services: Service) => IExtHostContribution; + +export interface IExtHostContributionsRegistry { + + /** + * Registers a ext host contribution to the platform that will be loaded when the extension host starts and disposed when the extension host shuts down. + */ + registerExtHostContribution(contribution: IExtHostContributionSignature): void; + + /** + * Starts the registry by providing the required services. + */ + start(accessor: ServicesAccessor): void; + + /** + * Stops the registry by disposing the instantiated contributions + */ + stop(): void; +} + +class ExtHostContributionsRegistry implements IExtHostContributionsRegistry { + + private instantiationService: IInstantiationService | undefined; + private readonly contributions: IConstructorSignature0[] = []; + private toBeInstantiated: IConstructorSignature0[] = []; + private instantiated: IExtHostContribution[] = []; + + registerExtHostContribution(ctor: { new(...services: Services): IExtHostContribution }): void { + this.contributions.push(ctor); + + // Instantiate directly if started + if (this.instantiationService) { + this.instantiate(ctor); + } + + // Otherwise keep contributions to be instantiated + else { + this.toBeInstantiated.push(ctor); + } + } + + start(accessor: ServicesAccessor): void { + this.instantiationService = accessor.get(IInstantiationService); + this.toBeInstantiated.forEach(ctor => this.instantiate(ctor), this); + this.toBeInstantiated = []; + } + + private instantiate(ctor: { new(...services: Services): IExtHostContribution }) { + this.instantiated.push(this.instantiationService!.createInstance(ctor)); + } + + stop(): void { + this.instantiationService = undefined; + this.instantiated.forEach(dispose); + this.instantiated = []; + this.toBeInstantiated = [...this.contributions]; + } + +} + +Registry.add(Extensions.ExtHost, new ExtHostContributionsRegistry()); + diff --git a/src/vs/workbench/api/common/extHostInitDataService.ts b/src/vs/workbench/api/common/extHostInitDataService.ts index 2f0acd57a3c..cefea262ce3 100644 --- a/src/vs/workbench/api/common/extHostInitDataService.ts +++ b/src/vs/workbench/api/common/extHostInitDataService.ts @@ -5,10 +5,12 @@ import { IInitData } from './extHost.protocol'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { URI } from 'vs/base/common/uri'; export const IExtHostInitDataService = createDecorator('IExtHostInitDataService'); export interface IExtHostInitDataService extends Readonly { _serviceBrand: undefined; + readonly logFile: URI; } diff --git a/src/vs/workbench/api/node/extHostLogService.ts b/src/vs/workbench/api/node/extHostLogService.ts index f29d417620d..263758ec40a 100644 --- a/src/vs/workbench/api/node/extHostLogService.ts +++ b/src/vs/workbench/api/node/extHostLogService.ts @@ -3,34 +3,45 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize } from 'vs/nls'; -import { join } from 'vs/base/common/path'; import { ILogService, DelegatedLogService, LogLevel } from 'vs/platform/log/common/log'; import { ExtHostLogServiceShape } from 'vs/workbench/api/common/extHost.protocol'; import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; -import { URI } from 'vs/base/common/uri'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { Schemas } from 'vs/base/common/network'; import { SpdLogService } from 'vs/platform/log/node/spdlogService'; +import { dirname } from 'vs/base/common/resources'; +import { IExtHostContribution, IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; import { IExtHostOutputService } from 'vs/workbench/api/common/extHostOutput'; +import { localize } from 'vs/nls'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { Disposable } from 'vs/base/common/lifecycle'; export class ExtHostLogService extends DelegatedLogService implements ILogService, ExtHostLogServiceShape { constructor( @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtHostOutputService extHostOutputService: IExtHostOutputService ) { - if (initData.logsLocation.scheme !== Schemas.file) { throw new Error('Only file-logging supported'); } - super(new SpdLogService(ExtensionHostLogFileName, initData.logsLocation.fsPath, initData.logLevel)); - - // Register an output channel for exthost log - extHostOutputService.createOutputChannelFromLogFile( - initData.remote.isRemote ? localize('remote extension host Log', "Remote Extension Host") : localize('extension host Log', "Extension Host"), - URI.file(join(initData.logsLocation.fsPath, `${ExtensionHostLogFileName}.log`)) - ); + if (initData.logFile.scheme !== Schemas.file) { throw new Error('Only file-logging supported'); } + super(new SpdLogService(ExtensionHostLogFileName, dirname(initData.logFile).fsPath, initData.logLevel)); } $setLevel(level: LogLevel): void { this.setLevel(level); } } + +class ExtHostLogChannelContribution extends Disposable implements IExtHostContribution { + + constructor( + @IExtHostInitDataService initData: IExtHostInitDataService, + @IExtHostOutputService outputSerice: IExtHostOutputService, + ) { + super(); + outputSerice.createOutputChannelFromLogFile( + initData.remote.isRemote ? localize('remote extension host Log', "Remote Extension Host") : localize('extension host Log', "Extension Host"), + initData.logFile); + } + +} + +Registry.as(Extensions.ExtHost).registerExtHostContribution(ExtHostLogChannelContribution); diff --git a/src/vs/workbench/api/worker/extHostLogService.ts b/src/vs/workbench/api/worker/extHostLogService.ts index acf2d3be8da..7625e52cca4 100644 --- a/src/vs/workbench/api/worker/extHostLogService.ts +++ b/src/vs/workbench/api/worker/extHostLogService.ts @@ -8,10 +8,11 @@ import { ExtHostLogServiceShape, MainThreadLogShape, MainContext } from 'vs/work import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostOutputService } from 'vs/workbench/api/common/extHostOutput'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; -import { joinPath } from 'vs/base/common/resources'; -import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; import { UriComponents } from 'vs/base/common/uri'; import { localize } from 'vs/nls'; +import { IExtHostContribution, IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { Disposable } from 'vs/base/common/lifecycle'; export class ExtHostLogService extends AbstractLogService implements ILogService, ExtHostLogServiceShape { @@ -23,14 +24,11 @@ export class ExtHostLogService extends AbstractLogService implements ILogService constructor( @IExtHostRpcService rpc: IExtHostRpcService, @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtHostOutputService extHostOutputService: IExtHostOutputService ) { super(); - const logFile = joinPath(initData.logsLocation, `${ExtensionHostLogFileName}.log`); this._proxy = rpc.getProxy(MainContext.MainThreadLog); - this._logFile = logFile.toJSON(); + this._logFile = initData.logFile.toJSON(); this.setLevel(initData.logLevel); - extHostOutputService.createOutputChannelFromLogFile(localize('name', "Worker Extension Host"), logFile); } $setLevel(level: LogLevel): void { @@ -75,3 +73,18 @@ export class ExtHostLogService extends AbstractLogService implements ILogService flush(): void { } } + + +class ExtHostLogChannelContribution extends Disposable implements IExtHostContribution { + + constructor( + @IExtHostInitDataService initData: IExtHostInitDataService, + @IExtHostOutputService outputSerice: IExtHostOutputService, + ) { + super(); + outputSerice.createOutputChannelFromLogFile(localize('name', "Worker Extension Host"), initData.logFile); + } + +} + +Registry.as(Extensions.ExtHost).registerExtHostContribution(ExtHostLogChannelContribution); diff --git a/src/vs/workbench/services/extensions/common/extensionHostMain.ts b/src/vs/workbench/services/extensions/common/extensionHostMain.ts index da1dc8e9a9e..105756420fc 100644 --- a/src/vs/workbench/services/extensions/common/extensionHostMain.ts +++ b/src/vs/workbench/services/extensions/common/extensionHostMain.ts @@ -5,7 +5,7 @@ import { timeout } from 'vs/base/common/async'; import * as errors from 'vs/base/common/errors'; -import { DisposableStore } from 'vs/base/common/lifecycle'; +import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IURITransformer } from 'vs/base/common/uriIpc'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; @@ -21,6 +21,10 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IExtHostRpcService, ExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IURITransformerService, URITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService'; import { IExtHostExtensionService, IHostUtils } from 'vs/workbench/api/common/extHostExtensionService'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; +import { joinPath } from 'vs/base/common/resources'; +import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; export interface IExitFn { (code?: number): any; @@ -52,13 +56,18 @@ export class ExtensionHostMain { // bootstrap services const services = new ServiceCollection(...getSingletonServiceDescriptors()); - services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData }); + services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData, logFile: joinPath(initData.logsLocation, `${ExtensionHostLogFileName}.log`) }); services.set(IExtHostRpcService, new ExtHostRpcService(rpcProtocol)); services.set(IURITransformerService, new URITransformerService(uriTransformer)); services.set(IHostUtils, hostUtils); const instaService: IInstantiationService = new InstantiationService(services, true); + // start ext host contributions + const extHostContributionsRegistry = Registry.as(Extensions.ExtHost); + instaService.invokeFunction(accessor => extHostContributionsRegistry.start(accessor)); + this._disposables.add(toDisposable(() => extHostContributionsRegistry.stop())); + // todo@joh // ugly self - inject const logService = instaService.invokeFunction(accessor => accessor.get(ILogService)); From f4fa2da7ae817d91c805b743b70eefd601ec46ff Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 08:03:30 +0100 Subject: [PATCH 291/637] #84283 use log service to log --- src/vs/workbench/api/node/extHostOutputService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index fd194124907..4e6d32c4967 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -14,6 +14,7 @@ import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputSe import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { MutableDisposable } from 'vs/base/common/lifecycle'; +import { ILogService } from 'vs/platform/log/common/log'; export class ExtHostOutputChannelBackedByFile extends AbstractExtHostOutputChannel { @@ -55,6 +56,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService { constructor( @IExtHostRpcService extHostRpc: IExtHostRpcService, + @ILogService private readonly logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, ) { super(extHostRpc); @@ -90,7 +92,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService { return new ExtHostOutputChannelBackedByFile(name, appender, this._proxy); } catch (error) { // Do not crash if logger cannot be created - console.log(error); + this.logService.error(error); return new ExtHostPushOutputChannel(name, this._proxy); } } From e9bbdaa012819a5f6e8c407ed2a9e64a03fa3f53 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 15:07:46 +0100 Subject: [PATCH 292/637] adopt extensionKind in product configuration to be array --- src/vs/platform/product/common/productService.ts | 2 +- .../services/extensions/common/extensionsUtil.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts index 6db9725704d..1c37427fd5d 100644 --- a/src/vs/platform/product/common/productService.ts +++ b/src/vs/platform/product/common/productService.ts @@ -97,7 +97,7 @@ export interface IProductConfiguration { readonly portable?: string; - readonly extensionKind?: { readonly [extensionId: string]: ExtensionKind | ExtensionKind[]; }; + readonly extensionKind?: { readonly [extensionId: string]: ExtensionKind[]; }; readonly extensionAllowedProposedApi?: readonly string[]; readonly msftInternalDomains?: string[]; diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts index 75f715cc512..9e8352ac881 100644 --- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts +++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts @@ -45,7 +45,7 @@ export function getExtensionKind(manifest: IExtensionManifest, productService: I // check product.json result = getProductExtensionKind(manifest, productService); if (typeof result !== 'undefined') { - return toArray(result); + return result; } // check the manifest itself @@ -88,10 +88,10 @@ function isUIExtensionPoint(extensionPoint: string): boolean { return _uiExtensionPoints.has(extensionPoint); } -let _productExtensionKindsMap: Map | null = null; -function getProductExtensionKind(manifest: IExtensionManifest, productService: IProductService): ExtensionKind | ExtensionKind[] | undefined { +let _productExtensionKindsMap: Map | null = null; +function getProductExtensionKind(manifest: IExtensionManifest, productService: IProductService): ExtensionKind[] | undefined { if (_productExtensionKindsMap === null) { - const productExtensionKindsMap = new Map(); + const productExtensionKindsMap = new Map(); if (productService.extensionKind) { for (const id of Object.keys(productService.extensionKind)) { productExtensionKindsMap.set(ExtensionIdentifier.toKey(id), productService.extensionKind[id]); From 6b247c6d7de720eaf03bab0f48afe78d40bb4636 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 15:25:24 +0100 Subject: [PATCH 293/637] debug viewlet: fix check for context debug ux key change --- src/vs/workbench/contrib/debug/browser/debugViewlet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts index 6b3ab5e7ec2..17f8398d2a3 100644 --- a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts @@ -84,7 +84,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer { this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state))); this._register(this.debugService.onDidNewSession(() => this.updateToolBar())); this._register(this.contextKeyService.onDidChangeContext(e => { - if (e.affectsSome(new Set(CONTEXT_DEBUG_UX_KEY))) { + if (e.affectsSome(new Set([CONTEXT_DEBUG_UX_KEY]))) { this.updateTitleArea(); } })); From cb1ae817a82fc30efba1a7c1a5d845f96e47c9ab Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 15:27:58 +0100 Subject: [PATCH 294/637] #83421 remove semver typings --- package.json | 3 +-- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bd28babf11f..18fc43f2810 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.4", + "semver-umd": "^5.5.5", "spdlog": "^0.11.1", "sudo-prompt": "9.1.1", "v8-inspect-profiler": "^0.0.20", @@ -71,7 +71,6 @@ "@types/keytar": "^4.4.0", "@types/mocha": "2.2.39", "@types/node": "^10.12.12", - "@types/semver": "^5.5.0", "@types/sinon": "^1.16.36", "@types/webpack": "^4.4.10", "@types/windows-foreground-love": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 6bf12932c2d..7d52180aed4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7572,10 +7572,10 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -semver-umd@^5.5.4: - version "5.5.4" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" - integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== +semver-umd@^5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.5.tgz#a2e4280d0e92a2b27695c18811f0e939e144d86f" + integrity sha512-8rUq0nnTzlexpAdYmm8UDYsLkBn0MnBkfrGWPmyDBDDzv71dPOH07szOOaLj/5hO3BYmumYwS+wp3C60zLzh5g== "semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: version "5.4.1" From 553e1eac05ae9d0b1c51a5068eb467842e2d68b2 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 15:33:57 +0100 Subject: [PATCH 295/637] If the uri can not be resolved we should not spam the console with error, remain quite fixes #86587 --- src/vs/workbench/contrib/debug/browser/linkDetector.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/debug/browser/linkDetector.ts b/src/vs/workbench/contrib/debug/browser/linkDetector.ts index 030231a132f..ff264cc8c29 100644 --- a/src/vs/workbench/contrib/debug/browser/linkDetector.ts +++ b/src/vs/workbench/contrib/debug/browser/linkDetector.ts @@ -131,6 +131,8 @@ export class LinkDetector { } const options = { selection: { startLineNumber: lineNumber, startColumn: columnNumber } }; this.decorateLink(link, () => this.editorService.openEditor({ resource: uri, options })); + }).catch(() => { + // If the uri can not be resolved we should not spam the console with error, remain quite #86587 }); return link; } From 1f0a0a7f3ea933a15caa763ceec5532901c7d686 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 15:43:25 +0100 Subject: [PATCH 296/637] debug: increase opacity of disabled items to pass color check fixes #86342 --- src/vs/workbench/contrib/debug/browser/media/debugViewlet.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css b/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css index 4ccff4262eb..235181c8108 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css +++ b/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css @@ -108,7 +108,7 @@ } .debug-viewlet .disabled { - opacity: 0.35; + opacity: 0.65; } /* Call stack */ From 9566da2e166019abffd8534133f5873c81e69c5b Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 10 Dec 2019 15:44:30 +0100 Subject: [PATCH 297/637] First pass at port API needed for port UI (#85117) Part of https://github.com/microsoft/vscode-remote-release/issues/1777 and https://github.com/microsoft/vscode/issues/81388 --- src/vs/vscode.proposed.d.ts | 42 ++++++++++++++++++- .../workbench/api/common/extHost.api.impl.ts | 7 ++++ .../workbench/api/common/extHost.protocol.ts | 8 +++- .../api/common/extHostTunnelService.ts | 21 ++++++++++ src/vs/workbench/api/node/extHost.services.ts | 2 + .../extensions/worker/extHost.services.ts | 2 + 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/vs/workbench/api/common/extHostTunnelService.ts diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 4b7ea910891..945c9bd2aae 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -16,7 +16,7 @@ declare module 'vscode' { - //#region Alex - resolvers + //#region Alex - resolvers, AlexR - ports export interface RemoteAuthorityResolverContext { resolveAttempt: number; @@ -33,7 +33,31 @@ declare module 'vscode' { extensionHostEnv?: { [key: string]: string | null }; } - export type ResolverResult = ResolvedAuthority & ResolvedOptions; + export interface TunnelOptions { + remote: { port: number, host: string }; + localPort?: number; + name?: string; + closeable?: boolean; + } + + export interface Tunnel extends Disposable { + remote: { port: number, host: string }; + local: { port: number, host: string }; + } + + /** + * Used as part of the ResolverResult if the extension has any candidate, published, or forwarded ports. + */ + export interface TunnelInformation { + /** + * Tunnels that are detected by the extension. The remotePort is used for display purposes. + * The localAddress should be the complete local address(ex. localhost:1234) for connecting to the port. Tunnels provided through + * detected are read-only from the forwarded ports UI. + */ + detectedTunnels?: { remotePort: number, localAddress: string }[]; + } + + export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation; export class RemoteAuthorityResolverError extends Error { static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError; @@ -44,6 +68,20 @@ declare module 'vscode' { export interface RemoteAuthorityResolver { resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable; + /** + * Can be optionally implemented if the extension can forward ports better than the core. + * When not implemented, the core will use its default forwarding logic. + * When implemented, the core will use this to forward ports. + */ + forwardPort?(tunnelOptions: TunnelOptions): Thenable; + } + + export namespace workspace { + /** + * Forwards a port. + * @param forward The `localPort` is a suggestion only. If that port is not available another will be chosen. + */ + export function makeTunnel(forward: TunnelOptions): Thenable; } export interface ResourceLabelFormatter { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 17d88ec6b3d..69fee57eace 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -67,6 +67,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; +import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; export interface IExtensionApiFactory { (extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode; @@ -86,6 +87,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I const rpcProtocol = accessor.get(IExtHostRpcService); const extHostStorage = accessor.get(IExtHostStorage); const extHostLogService = accessor.get(ILogService); + const extHostTunnelService = accessor.get(IExtHostTunnelService); // register addressable instances rpcProtocol.set(ExtHostContext.ExtHostLogService, extHostLogService); @@ -93,6 +95,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration); rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService); rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage); + rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService); // automatically create and register addressable instances const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations)); @@ -710,6 +713,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I }, onWillRenameFiles: (listener: (e: vscode.FileWillRenameEvent) => any, thisArg?: any, disposables?: vscode.Disposable[]) => { return extHostFileSystemEvent.getOnWillRenameFileEvent(extension)(listener, thisArg, disposables); + }, + makeTunnel: (forward: vscode.TunnelOptions) => { + checkProposedApiEnabled(extension); + return extHostTunnelService.makeTunnel(forward); } }; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 597271afd93..dc89753a162 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1390,6 +1390,11 @@ export interface ExtHostStorageShape { $acceptValue(shared: boolean, key: string, value: object | undefined): void; } + +export interface ExtHostTunnelServiceShape { + +} + // --- proxy identifiers export const MainContext = { @@ -1464,5 +1469,6 @@ export const ExtHostContext = { ExtHostStorage: createMainId('ExtHostStorage'), ExtHostUrls: createExtId('ExtHostUrls'), ExtHostOutputService: createMainId('ExtHostOutputService'), - ExtHosLabelService: createMainId('ExtHostLabelService') + ExtHosLabelService: createMainId('ExtHostLabelService'), + ExtHostTunnelService: createMainId('ExtHostTunnelService') }; diff --git a/src/vs/workbench/api/common/extHostTunnelService.ts b/src/vs/workbench/api/common/extHostTunnelService.ts new file mode 100644 index 00000000000..20ddef9845d --- /dev/null +++ b/src/vs/workbench/api/common/extHostTunnelService.ts @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol'; +import * as vscode from 'vscode'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; + +export interface IExtHostTunnelService extends ExtHostTunnelServiceShape { + makeTunnel(forward: vscode.TunnelOptions): Promise; +} + +export const IExtHostTunnelService = createDecorator('IExtHostTunnelService'); + +export class ExtHostTunnelService implements IExtHostTunnelService { + makeTunnel(forward: vscode.TunnelOptions): Promise { + throw new Error('Method not implemented.'); + } +} + diff --git a/src/vs/workbench/api/node/extHost.services.ts b/src/vs/workbench/api/node/extHost.services.ts index 9ae085f5366..7dd3169394c 100644 --- a/src/vs/workbench/api/node/extHost.services.ts +++ b/src/vs/workbench/api/node/extHost.services.ts @@ -26,6 +26,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionS import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService'; +import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; // register singleton services registerSingleton(ILogService, ExtHostLogService); @@ -42,3 +43,4 @@ registerSingleton(IExtHostSearch, NativeExtHostSearch); registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths); registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(IExtHostStorage, ExtHostStorage); +registerSingleton(IExtHostTunnelService, ExtHostTunnelService); diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts index 8a65101aa4e..de59a448147 100644 --- a/src/vs/workbench/services/extensions/worker/extHost.services.ts +++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts @@ -21,6 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; +import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; // register singleton services registerSingleton(ILogService, ExtHostLogService); @@ -33,6 +34,7 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors); registerSingleton(IExtHostStorage, ExtHostStorage); registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(IExtHostSearch, ExtHostSearch); +registerSingleton(IExtHostTunnelService, ExtHostTunnelService); // register services that only throw errors function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { From 3fadbc874eb3d40739ced914b64e335b856a1fa1 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Tue, 10 Dec 2019 15:45:12 +0100 Subject: [PATCH 298/637] Remove useless property --- .../workbench/contrib/welcome/page/browser/welcomePage.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts index bf21486dee0..e3b413f69e7 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts @@ -523,15 +523,13 @@ class WelcomePage extends Disposable { "WelcomePageInstalled-4" : { "from" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, "extensionId": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "outcome": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "error": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" } + "outcome": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } } */ this.telemetryService.publicLog(strings.installedEvent, { from: telemetryFrom, extensionId: extensionSuggestion.id, outcome: isPromiseCanceledError(err) ? 'canceled' : 'error', - error: String(err), }); this.notificationService.error(err); }); @@ -560,15 +558,13 @@ class WelcomePage extends Disposable { "WelcomePageInstalled-6" : { "from" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, "extensionId": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "outcome": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, - "error": { "classification": "CallstackOrException", "purpose": "PerformanceAndHealth" } + "outcome": { "classification": "SystemMetaData", "purpose": "FeatureInsight" } } */ this.telemetryService.publicLog(strings.installedEvent, { from: telemetryFrom, extensionId: extensionSuggestion.id, outcome: isPromiseCanceledError(err) ? 'canceled' : 'error', - error: String(err), }); this.notificationService.error(err); }); From 2f72da18a62a46578968e20e169d8d902594b85d Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 15:48:30 +0100 Subject: [PATCH 299/637] debug context menus update names fixes #86465 --- .../workbench/contrib/debug/browser/debugEditorActions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts index 80306b110a5..9650fba3db7 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorActions.ts @@ -157,8 +157,8 @@ class SelectionToReplAction extends EditorAction { constructor() { super({ id: 'editor.debug.action.selectionToRepl', - label: nls.localize('debugEvaluate', "Debug: Evaluate"), - alias: 'Debug: Evaluate', + label: nls.localize('evaluateInDebugConsole', "Evaluate in Debug Console"), + alias: 'Evaluate', precondition: ContextKeyExpr.and(EditorContextKeys.hasNonEmptySelection, CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus), contextMenuOpts: { group: 'debug', @@ -187,8 +187,8 @@ class SelectionToWatchExpressionsAction extends EditorAction { constructor() { super({ id: 'editor.debug.action.selectionToWatch', - label: nls.localize('debugAddToWatch', "Debug: Add to Watch"), - alias: 'Debug: Add to Watch', + label: nls.localize('addToWatch', "Add to Watch"), + alias: 'Add to Watch', precondition: ContextKeyExpr.and(EditorContextKeys.hasNonEmptySelection, CONTEXT_IN_DEBUG_MODE, EditorContextKeys.editorTextFocus), contextMenuOpts: { group: 'debug', From 73adb1bb0e1b889df990182b1b90956ac051be14 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Tue, 10 Dec 2019 16:02:24 +0100 Subject: [PATCH 300/637] Fixes microsoft/monaco-editor#515: Allow larger values for lineNumbersMinChars --- src/vs/editor/common/config/editorOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 71d3e899a4a..035b36c09b1 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -3358,7 +3358,7 @@ export const EditorOptions = { lineNumbers: register(new EditorRenderLineNumbersOption()), lineNumbersMinChars: register(new EditorIntOption( EditorOption.lineNumbersMinChars, 'lineNumbersMinChars', - 5, 1, 10 + 5, 1, 300 )), links: register(new EditorBooleanOption( EditorOption.links, 'links', true, From 23271d35ed61c1579e5e9e8fef8abcd697be8ed9 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 16:11:12 +0100 Subject: [PATCH 301/637] use same version everywhere --- remote/package.json | 2 +- remote/web/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/remote/package.json b/remote/package.json index 0a70b75f105..e61f3996236 100644 --- a/remote/package.json +++ b/remote/package.json @@ -13,7 +13,7 @@ "native-watchdog": "1.3.0", "node-pty": "^0.10.0-beta2", "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.4", + "semver-umd": "^5.5.5", "spdlog": "^0.11.1", "vscode-minimist": "^1.2.2", "vscode-nsfw": "1.2.8", diff --git a/remote/web/package.json b/remote/web/package.json index 0f75c254b64..745747611d7 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "dependencies": { "onigasm-umd": "2.2.5", - "semver-umd": "^5.5.4", + "semver-umd": "^5.5.5", "vscode-textmate": "4.4.0", "xterm": "4.3.0-beta.28.vscode.1", "xterm-addon-search": "0.4.0-beta4", From 63fd0dbc8b49bd5fd493e378615950d69665f31e Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 16:23:01 +0100 Subject: [PATCH 302/637] fixes #86445 --- src/vs/workbench/contrib/debug/browser/debugCommands.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index e0aedfd64ac..957bcb5ebf2 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -430,9 +430,13 @@ export function registerCommands(): void { const focused = listService.lastFocusedList; if (focused) { - const elements = focused.getFocus(); + let elements = focused.getFocus(); if (Array.isArray(elements) && elements[0] instanceof Expression) { - debugService.removeWatchExpressions(elements[0].getId()); + const selection = focused.getSelection(); + if (selection && selection.indexOf(elements[0]) >= 0) { + elements = selection; + } + elements.forEach((e: Expression) => debugService.removeWatchExpressions(e.getId())); } } } From 98ffc5d317ab3856fca0b88bc3480b2d50f993b5 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 10 Dec 2019 16:29:28 +0100 Subject: [PATCH 303/637] :lipstick: --- .../browser/parts/editor/editorGroupView.ts | 36 +++++++++---------- .../browser/parts/editor/editorPart.ts | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index ceb4b081d42..59bf3608a9f 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -73,30 +73,30 @@ export class EditorGroupView extends Themable implements IEditorGroupView { //#region events - private readonly _onDidFocus: Emitter = this._register(new Emitter()); - readonly onDidFocus: Event = this._onDidFocus.event; + private readonly _onDidFocus = this._register(new Emitter()); + readonly onDidFocus = this._onDidFocus.event; - private readonly _onWillDispose: Emitter = this._register(new Emitter()); - readonly onWillDispose: Event = this._onWillDispose.event; + private readonly _onWillDispose = this._register(new Emitter()); + readonly onWillDispose = this._onWillDispose.event; - private readonly _onDidGroupChange: Emitter = this._register(new Emitter()); - readonly onDidGroupChange: Event = this._onDidGroupChange.event; + private readonly _onDidGroupChange = this._register(new Emitter()); + readonly onDidGroupChange = this._onDidGroupChange.event; - private readonly _onWillOpenEditor: Emitter = this._register(new Emitter()); - readonly onWillOpenEditor: Event = this._onWillOpenEditor.event; + private readonly _onWillOpenEditor = this._register(new Emitter()); + readonly onWillOpenEditor = this._onWillOpenEditor.event; - private readonly _onDidOpenEditorFail: Emitter = this._register(new Emitter()); - readonly onDidOpenEditorFail: Event = this._onDidOpenEditorFail.event; + private readonly _onDidOpenEditorFail = this._register(new Emitter()); + readonly onDidOpenEditorFail = this._onDidOpenEditorFail.event; - private readonly _onWillCloseEditor: Emitter = this._register(new Emitter()); - readonly onWillCloseEditor: Event = this._onWillCloseEditor.event; + private readonly _onWillCloseEditor = this._register(new Emitter()); + readonly onWillCloseEditor = this._onWillCloseEditor.event; - private readonly _onDidCloseEditor: Emitter = this._register(new Emitter()); - readonly onDidCloseEditor: Event = this._onDidCloseEditor.event; + private readonly _onDidCloseEditor = this._register(new Emitter()); + readonly onDidCloseEditor = this._onDidCloseEditor.event; //#endregion - private _group: EditorGroup; + private readonly _group: EditorGroup; private _disposed = false; private active: boolean | undefined; @@ -115,9 +115,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView { private editorContainer: HTMLElement; private editorControl: EditorControl; - private disposedEditorsWorker: RunOnceWorker; + private readonly disposedEditorsWorker = this._register(new RunOnceWorker(editors => this.handleDisposedEditors(editors), 0)); - private mapEditorToPendingConfirmation: Map> = new Map>(); + private readonly mapEditorToPendingConfirmation = new Map>(); constructor( private accessor: IEditorGroupsAccessor, @@ -146,8 +146,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView { this._group = this._register(instantiationService.createInstance(EditorGroup, undefined)); } - this.disposedEditorsWorker = this._register(new RunOnceWorker(editors => this.handleDisposedEditors(editors), 0)); - //#region create() { // Container diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index b1e47014aa9..c828dd74713 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -121,7 +121,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro private _partOptions: IEditorPartOptions; - private groupViews: Map = new Map(); + private readonly groupViews = new Map(); private mostRecentActiveGroups: GroupIdentifier[] = []; private container: HTMLElement | undefined; From 53f41560a606bafa3de28cca4cc5d13f1d13b323 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Tue, 10 Dec 2019 16:36:15 +0100 Subject: [PATCH 304/637] remove vs da --- src/typings/vsda.d.ts | 10 ---------- src/vs/platform/sign/node/signService.ts | 14 -------------- 2 files changed, 24 deletions(-) delete mode 100644 src/typings/vsda.d.ts diff --git a/src/typings/vsda.d.ts b/src/typings/vsda.d.ts deleted file mode 100644 index 369e98483b6..00000000000 --- a/src/typings/vsda.d.ts +++ /dev/null @@ -1,10 +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 'vsda' { - export class signer { - sign(arg: any): any; - } -} diff --git a/src/vs/platform/sign/node/signService.ts b/src/vs/platform/sign/node/signService.ts index ba9b9641e06..4ccd1d1dffb 100644 --- a/src/vs/platform/sign/node/signService.ts +++ b/src/vs/platform/sign/node/signService.ts @@ -8,21 +8,7 @@ import { ISignService } from 'vs/platform/sign/common/sign'; export class SignService implements ISignService { _serviceBrand: undefined; - private vsda(): Promise { - return import('vsda'); - } - async sign(value: string): Promise { - try { - const vsda = await this.vsda(); - const signer = new vsda.signer(); - if (signer) { - return signer.sign(value); - } - } catch (e) { - console.error('signer.sign: ' + e); - } - return value; } } From 82153ac2b76dfcc307ada83edef1792c229b1d70 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 10 Dec 2019 07:53:10 -0800 Subject: [PATCH 305/637] fixes #86056 --- src/vs/workbench/contrib/debug/browser/debugViewlet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts index 17f8398d2a3..86fb545750b 100644 --- a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts @@ -79,7 +79,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer { @IContextKeyService private readonly contextKeyService: IContextKeyService, @INotificationService private readonly notificationService: INotificationService ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: false }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state))); this._register(this.debugService.onDidNewSession(() => this.updateToolBar())); From 0715b449d0cd981bd56a391c19f9f5488bb6128f Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Tue, 10 Dec 2019 16:56:38 +0100 Subject: [PATCH 306/637] update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18fc43f2810..a5a27d8dbe8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.42.0", - "distro": "17f1b806c349d58f96b4aef97ae59d836e2c5605", + "distro": "5335b745c91d972634e882592d5edff5e3609503", "author": { "name": "Microsoft Corporation" }, From 0ab0020ed9f8325b51c50e12fa8427ec15995ab7 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 10 Dec 2019 16:59:13 +0100 Subject: [PATCH 307/637] Tree Guide Indents not showing in latest Insiders #86662 --- src/vs/platform/list/browser/listService.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index 20235f709c7..77dbbdd54cf 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -22,7 +22,7 @@ import { IEditorOptions } from 'vs/platform/editor/common/editor'; import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { Registry } from 'vs/platform/registry/common/platform'; -import { attachListStyler, computeStyles, defaultListStyles, IColorMapping, attachStyler } from 'vs/platform/theme/common/styler'; +import { attachListStyler, computeStyles, defaultListStyles, IColorMapping } from 'vs/platform/theme/common/styler'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys'; import { ObjectTree, IObjectTreeOptions, ICompressibleTreeRenderer, CompressibleObjectTree, ICompressibleObjectTreeOptions } from 'vs/base/browser/ui/tree/objectTree'; @@ -287,7 +287,7 @@ export class WorkbenchList extends List { this.disposables.add((listService as ListService).register(this)); if (options.overrideStyles) { - this.disposables.add(attachStyler(themeService, options.overrideStyles, this)); + this.disposables.add(attachListStyler(this, themeService, options.overrideStyles)); } this.disposables.add(this.onSelectionChange(() => { @@ -368,7 +368,7 @@ export class WorkbenchPagedList extends PagedList { this.disposables.add((listService as ListService).register(this)); if (options.overrideStyles) { - this.disposables.add(attachStyler(themeService, options.overrideStyles, this)); + this.disposables.add(attachListStyler(this, themeService, options.overrideStyles)); } this.registerListeners(); @@ -1044,7 +1044,7 @@ class WorkbenchTreeInternals { this.disposables.push( this.contextKeyService, (listService as ListService).register(tree), - overrideStyles ? attachStyler(themeService, overrideStyles, tree) : Disposable.None, + overrideStyles ? attachListStyler(tree, themeService, overrideStyles) : Disposable.None, tree.onDidChangeSelection(() => { const selection = tree.getSelection(); const focus = tree.getFocus(); From ed740f3bdb57ae49424ef7f35dd7b8ad469bded2 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 17:13:59 +0100 Subject: [PATCH 308/637] Revert "ignore .git files for ext recommendations" This reverts commit 794330fb6b56311876daf9dce386e7859782030a. --- .../contrib/extensions/browser/extensionTipsService.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 351c78234b6..598b849ed37 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -755,11 +755,6 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe return; } - // ignore .git files - if (fileExtension === 'git') { - return; - } - await this.extensionService.whenInstalledExtensionsRegistered(); const mimeTypes = guessMimeTypes(uri); if (mimeTypes.length !== 1 || mimeTypes[0] !== MIME_UNKNOWN) { From 80235f529a68a89c82b8d36f6db18be7a3edf0cf Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 16:59:20 +0100 Subject: [PATCH 309/637] ignore file type recommendations for gitfs scheme --- .../contrib/extensions/browser/extensionTipsService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 598b849ed37..275a65aaff3 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -698,7 +698,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe */ private promptFiletypeBasedRecommendations(model: ITextModel): void { const uri = model.uri; - if (!uri || !this.fileService.canHandleResource(uri)) { + if (!uri || uri.scheme === 'gitfs' || !this.fileService.canHandleResource(uri)) { return; } From fdb8e0d9f749494a55acfe1794af789e422d8e6b Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 17:20:51 +0100 Subject: [PATCH 310/637] update yarn lock files --- remote/web/yarn.lock | 8 ++++---- remote/yarn.lock | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index ee5c1cf7879..b11746cd8f0 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -19,10 +19,10 @@ oniguruma@^7.2.0: dependencies: nan "^2.14.0" -semver-umd@^5.5.4: - version "5.5.4" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" - integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== +semver-umd@^5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.5.tgz#a2e4280d0e92a2b27695c18811f0e939e144d86f" + integrity sha512-8rUq0nnTzlexpAdYmm8UDYsLkBn0MnBkfrGWPmyDBDDzv71dPOH07szOOaLj/5hO3BYmumYwS+wp3C60zLzh5g== vscode-textmate@4.4.0: version "4.4.0" diff --git a/remote/yarn.lock b/remote/yarn.lock index ea3675efb3c..ef13c7644df 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -317,10 +317,10 @@ readdirp@~3.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver-umd@^5.5.4: - version "5.5.4" - resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.4.tgz#0e5d1c1bdafc168037c702421ce06ae32e95a264" - integrity sha512-ZOhTfbVGOvsNuwsY3CK8KvcOjUWfgdD8dD8oTpZdLZ31nvp+NcZtcE5dZUV4tukYQGXtxY2Lpdqr/OOL0qPlGA== +semver-umd@^5.5.5: + version "5.5.5" + resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.5.tgz#a2e4280d0e92a2b27695c18811f0e939e144d86f" + integrity sha512-8rUq0nnTzlexpAdYmm8UDYsLkBn0MnBkfrGWPmyDBDDzv71dPOH07szOOaLj/5hO3BYmumYwS+wp3C60zLzh5g== semver@^5.3.0: version "5.6.0" From eac51ccbb32490f9ae4dfd4bb93bccb106f01286 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 10 Dec 2019 17:34:06 +0100 Subject: [PATCH 311/637] Fix #86676 --- .../contrib/extensions/browser/extensionTipsService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts index 275a65aaff3..029e4192cb8 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts @@ -43,6 +43,7 @@ import { IWorkspaceTagsService } from 'vs/workbench/contrib/tags/common/workspac import { setImmediate, isWeb } from 'vs/base/common/platform'; import { platform, env as processEnv } from 'vs/base/common/process'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { Schemas } from 'vs/base/common/network'; const milliSecondsInADay = 1000 * 60 * 60 * 24; const choiceNever = localize('neverShowAgain', "Don't Show Again"); @@ -698,7 +699,8 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe */ private promptFiletypeBasedRecommendations(model: ITextModel): void { const uri = model.uri; - if (!uri || uri.scheme === 'gitfs' || !this.fileService.canHandleResource(uri)) { + const supportedSchemes = [Schemas.untitled, Schemas.file, Schemas.vscodeRemote]; + if (!uri || supportedSchemes.indexOf(uri.scheme) === -1) { return; } From 2dfedf4494850eddc586be3644931b6b8252bbb4 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Tue, 10 Dec 2019 10:49:30 -0800 Subject: [PATCH 312/637] Clean up npm script --- extensions/search-result/package.json | 2 +- extensions/search-result/syntaxes/generateTMLanguage.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/search-result/package.json b/extensions/search-result/package.json index 4129c6c7b63..7442c05b8ee 100644 --- a/extensions/search-result/package.json +++ b/extensions/search-result/package.json @@ -16,7 +16,7 @@ "*" ], "scripts": { - "update-grammar": "node ./syntaxes/generateTMLanguage.js", + "generate-grammar": "node ./syntaxes/generateTMLanguage.js", "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:search-result ./tsconfig.json" }, "contributes": { diff --git a/extensions/search-result/syntaxes/generateTMLanguage.js b/extensions/search-result/syntaxes/generateTMLanguage.js index 0f2fd115888..d646b5bf86f 100644 --- a/extensions/search-result/syntaxes/generateTMLanguage.js +++ b/extensions/search-result/syntaxes/generateTMLanguage.js @@ -158,6 +158,5 @@ const tmLanguage = { repository }; - require('fs') - .writeFileSync('./searchResult.tmLanguage.json', JSON.stringify(tmLanguage, null, 2)); + .writeFileSync(require('path').join(__dirname, './searchResult.tmLanguage.json'), JSON.stringify(tmLanguage, null, 2)); From ac39756049c13d8fa1d799a6848e741ec905bf1a Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 10 Dec 2019 11:43:20 -0800 Subject: [PATCH 313/637] initialize multicursormodifier fixes #86654 --- .../contrib/codeEditor/browser/toggleMultiCursorModifier.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.ts b/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.ts index a41bea88b34..05df06aa388 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.ts @@ -48,6 +48,8 @@ class MultiCursorModifierContextKeyController implements IWorkbenchContribution @IContextKeyService contextKeyService: IContextKeyService ) { this._multiCursorModifier = multiCursorModifier.bindTo(contextKeyService); + + this._update(); configurationService.onDidChangeConfiguration((e) => { if (e.affectsConfiguration('editor.multiCursorModifier')) { this._update(); From 7f05ebf5a6422aa33c7986cb9eeb147a3912bb75 Mon Sep 17 00:00:00 2001 From: sverg1 <46539462+sverg1@users.noreply.github.com> Date: Tue, 10 Dec 2019 14:54:59 -0500 Subject: [PATCH 314/637] customEditor toggle and save/preview keybinds (#86505) * customEditor toggle and save/preview keybinds * travis ci * removed save command; toggle replaces current tab * removed travis ci; use vscode ci checks * export default id and using replaceEditors --- .../contrib/customEditor/browser/commands.ts | 65 ++++++++++++++++++- .../customEditor/browser/customEditors.ts | 2 +- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/commands.ts b/src/vs/workbench/contrib/customEditor/browser/commands.ts index 7b384f6c7d1..f2b3fc113f2 100644 --- a/src/vs/workbench/contrib/customEditor/browser/commands.ts +++ b/src/vs/workbench/contrib/customEditor/browser/commands.ts @@ -12,15 +12,17 @@ import * as nls from 'vs/nls'; import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys'; -import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IListService } from 'vs/platform/list/browser/listService'; -import { IEditorCommandsContext } from 'vs/workbench/common/editor'; +import { IEditorCommandsContext, IEditorInput } from 'vs/workbench/common/editor'; import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; import { getMultiSelectedResources } from 'vs/workbench/contrib/files/browser/files'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExplorerService } from 'vs/workbench/contrib/files/common/files'; +import { defaultEditorId } from 'vs/workbench/contrib/customEditor/browser/customEditors'; +import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput'; const viewCategory = nls.localize('viewCategory', "View"); @@ -172,3 +174,62 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, { model.redo(); } }).register(); + +(new class ToggleCustomEditorCommand extends Command { + public static readonly ID = 'editor.action.customEditor.toggle'; + + constructor() { + super({ + id: ToggleCustomEditorCommand.ID, + precondition: CONTEXT_HAS_CUSTOM_EDITORS, + }); + } + + public runCommand(accessor: ServicesAccessor): void { + const editorService = accessor.get(IEditorService); + const activeControl = editorService.activeControl; + if (!activeControl) { + return; + } + + const activeGroup = activeControl.group; + const activeEditor = activeControl.input; + + if (!activeEditor) { + return; + } + + const targetResource = activeEditor.getResource(); + if (!targetResource) { + return; + } + + const customEditorService = accessor.get(ICustomEditorService); + const activeCustomEditor = customEditorService.activeCustomEditor; + + let toggleView = defaultEditorId; + if (!activeCustomEditor) { + const viewIDs = customEditorService.getContributedCustomEditors(targetResource); + if (viewIDs && viewIDs.length) { + toggleView = viewIDs[0].id; + } + else { + return; + } + } + + let replInput: IEditorInput; + if (toggleView === defaultEditorId) { + const instantiationService = accessor.get(IInstantiationService); + replInput = instantiationService.createInstance(FileEditorInput, targetResource, undefined, undefined); + } + else { + replInput = customEditorService.createInput(targetResource, toggleView, activeGroup); + } + + editorService.replaceEditors([{ + editor: activeEditor, + replacement: replInput, + }], activeGroup); + } +}).register(); diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts index 49e2d2fcb4d..b2c75386617 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditors.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditors.ts @@ -29,7 +29,7 @@ import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsSe import { IEditorService, IOpenEditorOverride } from 'vs/workbench/services/editor/common/editorService'; import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; import { CustomFileEditorInput } from './customEditorInput'; -const defaultEditorId = 'default'; +export const defaultEditorId = 'default'; const defaultEditorInfo = new CustomEditorInfo({ id: defaultEditorId, From 029429db0f8c4526c7af0aa51679482aa945d8ef Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 10 Dec 2019 23:08:39 +0100 Subject: [PATCH 315/637] token classification ext point --- .../common/tokenClassificationRegistry.ts | 106 +++++---- .../api/browser/extensionHost.contribution.ts | 2 + .../themes/browser/workbenchThemeService.ts | 13 +- .../themes/common/colorThemeSchema.ts | 13 + .../tokenClassificationExtensionPoint.ts | 222 ++++++++++++++++++ 5 files changed, 303 insertions(+), 53 deletions(-) create mode 100644 src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts diff --git a/src/vs/platform/theme/common/tokenClassificationRegistry.ts b/src/vs/platform/theme/common/tokenClassificationRegistry.ts index fa4303f57a9..e4cf7231d15 100644 --- a/src/vs/platform/theme/common/tokenClassificationRegistry.ts +++ b/src/vs/platform/theme/common/tokenClassificationRegistry.ts @@ -12,14 +12,14 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { Event, Emitter } from 'vs/base/common/event'; import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema'; -// ------ API types - export const TOKEN_TYPE_WILDCARD = '*'; export const TOKEN_TYPE_WILDCARD_NUM = -1; // qualified string [type|*](.modifier)* export type TokenClassificationString = string; +export const typeAndModifierIdPattern = '^\\w+[-_\\w+]*$'; + export interface TokenClassification { type: number; modifiers: number; @@ -120,6 +120,12 @@ export interface ITokenClassificationRegistry { */ registerTokenStyleDefault(selector: TokenClassification, defaults: TokenStyleDefaults): void; + /** + * Deregister a TokenStyle default to the registry. + * @param selector The rule selector + */ + deregisterTokenStyleDefault(selector: TokenClassification): void; + /** * Deregister a TokenType from the registry. */ @@ -202,9 +208,15 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { this.tokenModifierById = {}; this.tokenTypeById[TOKEN_TYPE_WILDCARD] = { num: TOKEN_TYPE_WILDCARD_NUM, id: TOKEN_TYPE_WILDCARD, description: '', deprecationMessage: undefined }; + + this.registerDefaultClassifications(); } public registerTokenType(id: string, description: string, deprecationMessage?: string): void { + if (!id.match(typeAndModifierIdPattern)) { + throw new Error('Invalid token type id.'); + } + const num = this.currentTypeNumber++; let tokenStyleContribution: TokenTypeOrModifierContribution = { num, id, description, deprecationMessage }; this.tokenTypeById[id] = tokenStyleContribution; @@ -213,6 +225,10 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { } public registerTokenModifier(id: string, description: string, deprecationMessage?: string): void { + if (!id.match(typeAndModifierIdPattern)) { + throw new Error('Invalid token modifier id.'); + } + const num = this.currentModifierBit; this.currentModifierBit = this.currentModifierBit * 2; let tokenStyleContribution: TokenTypeOrModifierContribution = { num, id, description, deprecationMessage }; @@ -244,6 +260,10 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { this.tokenStylingDefaultRules.push({ classification, matchScore: getTokenStylingScore(classification), defaults }); } + public deregisterTokenStyleDefault(classification: TokenClassification): void { + this.tokenStylingDefaultRules = this.tokenStylingDefaultRules.filter(r => !(r.classification.type === classification.type && r.classification.modifiers === classification.modifiers)); + } + public deregisterTokenType(id: string): void { delete this.tokenTypeById[id]; delete this.tokenStylingSchema.properties[id]; @@ -270,6 +290,48 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { return this.tokenStylingDefaultRules; } + private registerDefaultClassifications(): void { + + // default token types + + registerTokenType('comment', nls.localize('comment', "Style for comments."), [['comment']]); + registerTokenType('string', nls.localize('string', "Style for strings."), [['string']]); + registerTokenType('keyword', nls.localize('keyword', "Style for keywords."), [['keyword.control']]); + registerTokenType('number', nls.localize('number', "Style for numbers."), [['constant.numeric']]); + registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); + registerTokenType('operator', nls.localize('operator', "Style for operators."), [['keyword.operator']]); + + registerTokenType('namespace', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); + + registerTokenType('type', nls.localize('type', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); + registerTokenType('struct', nls.localize('struct', "Style for structs."), [['storage.type.struct']], 'type'); + registerTokenType('class', nls.localize('class', "Style for classes."), [['entity.name.class']], 'type'); + registerTokenType('interface', nls.localize('interface', "Style for interfaces."), undefined, 'type'); + registerTokenType('enum', nls.localize('enum', "Style for enums."), undefined, 'type'); + registerTokenType('parameterType', nls.localize('parameterType', "Style for parameter types."), undefined, 'type'); + + registerTokenType('function', nls.localize('function', "Style for functions"), [['entity.name.function'], ['support.function']]); + registerTokenType('macro', nls.localize('macro', "Style for macros."), undefined, 'function'); + + registerTokenType('variable', nls.localize('variable', "Style for variables."), [['variable'], ['entity.name.variable']]); + registerTokenType('constant', nls.localize('constant', "Style for constants."), undefined, 'variable'); + registerTokenType('parameter', nls.localize('parameter', "Style for parameters."), undefined, 'variable'); + registerTokenType('property', nls.localize('propertie', "Style for properties."), undefined, 'variable'); + + registerTokenType('label', nls.localize('labels', "Style for labels. "), undefined); + + // default token modifiers + + registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); + registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); + registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); + registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); + registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); + registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); + registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); + registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); + } + public toString() { let sorter = (a: string, b: string) => { let cat1 = a.indexOf('.') === -1 ? 0 : 1; @@ -320,46 +382,6 @@ export function getTokenClassificationRegistry(): ITokenClassificationRegistry { return tokenClassificationRegistry; } -// default token types - -registerTokenType('comment', nls.localize('comment', "Style for comments."), [['comment']]); -registerTokenType('string', nls.localize('string', "Style for strings."), [['string']]); -registerTokenType('keyword', nls.localize('keyword', "Style for keywords."), [['keyword.control']]); -registerTokenType('number', nls.localize('number', "Style for numbers."), [['constant.numeric']]); -registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); -registerTokenType('operator', nls.localize('operator', "Style for operators."), [['keyword.operator']]); - -registerTokenType('namespace', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); - -registerTokenType('type', nls.localize('type', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); -registerTokenType('struct', nls.localize('struct', "Style for structs."), [['storage.type.struct']], 'type'); -registerTokenType('class', nls.localize('class', "Style for classes."), [['entity.name.class']], 'type'); -registerTokenType('interface', nls.localize('interface', "Style for interfaces."), undefined, 'type'); -registerTokenType('enum', nls.localize('enum', "Style for enums."), undefined, 'type'); -registerTokenType('parameterType', nls.localize('parameterType', "Style for parameter types."), undefined, 'type'); - -registerTokenType('function', nls.localize('function', "Style for functions"), [['entity.name.function'], ['support.function']]); -registerTokenType('macro', nls.localize('macro', "Style for macros."), undefined, 'function'); - -registerTokenType('variable', nls.localize('variable', "Style for variables."), [['variable'], ['entity.name.variable']]); -registerTokenType('constant', nls.localize('constant', "Style for constants."), undefined, 'variable'); -registerTokenType('parameter', nls.localize('parameter', "Style for parameters."), undefined, 'variable'); -registerTokenType('property', nls.localize('propertie', "Style for properties."), undefined, 'variable'); - -registerTokenType('label', nls.localize('labels', "Style for labels. "), undefined); - -// default token modifiers - -registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); -registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); -registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); -registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); -registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); -registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); -registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); -registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); - - function bitCount(u: number) { // https://blogs.msdn.microsoft.com/jeuge/2005/06/08/bit-fiddling-3/ const uCount = u - ((u >> 1) & 0o33333333333) - ((u >> 2) & 0o11111111111); diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts index 2905c524113..834e1e3d5a0 100644 --- a/src/vs/workbench/api/browser/extensionHost.contribution.ts +++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts @@ -11,6 +11,7 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; // --- other interested parties import { JSONValidationExtensionPoint } from 'vs/workbench/api/common/jsonValidationExtensionPoint'; import { ColorExtensionPoint } from 'vs/workbench/services/themes/common/colorExtensionPoint'; +import { TokenClassificationExtensionPoints } from 'vs/workbench/services/themes/common/tokenClassificationExtensionPoint'; import { LanguageConfigurationFileHandler } from 'vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint'; // --- mainThread participants @@ -66,6 +67,7 @@ export class ExtensionPoints implements IWorkbenchContribution { // Classes that handle extension points... this.instantiationService.createInstance(JSONValidationExtensionPoint); this.instantiationService.createInstance(ColorExtensionPoint); + this.instantiationService.createInstance(TokenClassificationExtensionPoints); this.instantiationService.createInstance(LanguageConfigurationFileHandler); } } diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index c0172a4cdd8..2cf02c752bd 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -27,7 +27,7 @@ import { IFileService, FileChangeType } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import * as resources from 'vs/base/common/resources'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; -import { textmateColorsSchemaId, registerColorThemeSchemas, textmateColorSettingsSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; +import { textmateColorsSchemaId, registerColorThemeSchemas, textmateColorGroupSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'; import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; @@ -684,16 +684,7 @@ configurationRegistry.registerConfiguration(themeSettingsConfiguration); function tokenGroupSettings(description: string): IJSONSchema { return { description, - default: '#FF0000', - anyOf: [ - { - type: 'string', - format: 'color-hex' - }, - { - $ref: textmateColorSettingsSchemaId - } - ] + $ref: textmateColorGroupSchemaId }; } diff --git a/src/vs/workbench/services/themes/common/colorThemeSchema.ts b/src/vs/workbench/services/themes/common/colorThemeSchema.ts index cb9c63d79b6..7f5d0f5c59a 100644 --- a/src/vs/workbench/services/themes/common/colorThemeSchema.ts +++ b/src/vs/workbench/services/themes/common/colorThemeSchema.ts @@ -115,10 +115,23 @@ let textMateScopes = [ export const textmateColorsSchemaId = 'vscode://schemas/textmate-colors'; export const textmateColorSettingsSchemaId = `${textmateColorsSchemaId}#definitions/settings`; +export const textmateColorGroupSchemaId = `${textmateColorsSchemaId}#definitions/colorGroup`; const textmateColorSchema: IJSONSchema = { type: 'array', definitions: { + colorGroup: { + default: '#FF0000', + anyOf: [ + { + type: 'string', + format: 'color-hex' + }, + { + $ref: '#definitions/settings' + } + ] + }, settings: { type: 'object', description: nls.localize('schema.token.settings', 'Colors and styles for the token.'), diff --git a/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts new file mode 100644 index 00000000000..d2696b72c9d --- /dev/null +++ b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts @@ -0,0 +1,222 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as nls from 'vs/nls'; +import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry'; +import { getTokenClassificationRegistry, ITokenClassificationRegistry, typeAndModifierIdPattern } from 'vs/platform/theme/common/tokenClassificationRegistry'; +import { textmateColorSettingsSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; + +interface ITokenTypeExtensionPoint { + id: string; + description: string; +} + +interface ITokenModifierExtensionPoint { + id: string; + description: string; +} + +interface ITokenStyleDefaultExtensionPoint { + selector: string; + scopes?: string[]; + light?: { + foreground?: string; + fontStyle?: string; + }; + dark?: { + foreground?: string; + fontStyle?: string; + }; + highContrast?: { + foreground?: string; + fontStyle?: string; + }; +} + +const tokenClassificationRegistry: ITokenClassificationRegistry = getTokenClassificationRegistry(); + +const tokenTypeExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'tokenTypes', + jsonSchema: { + description: nls.localize('contributes.tokenTypes', 'Contributes semantic token types.'), + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: nls.localize('contributes.tokenTypes.id', 'The identifier of the token type'), + pattern: typeAndModifierIdPattern, + patternErrorMessage: nls.localize('contributes.tokenTypes.id.format', 'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'), + }, + description: { + type: 'string', + description: nls.localize('contributes.color.description', 'The description of the token type'), + } + } + } + } +}); + +const tokenModifierExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'tokenModifiers', + jsonSchema: { + description: nls.localize('contributes.tokenModifiers', 'Contributes semantic token modifiers.'), + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: nls.localize('contributes.tokenModifiers.id', 'The identifier of the token modifier'), + pattern: typeAndModifierIdPattern, + patternErrorMessage: nls.localize('contributes.tokenModifiers.id.format', 'Identifiers should be in the form letterOrDigit[_-letterOrDigit]*'), + }, + description: { + description: nls.localize('contributes.tokenStyleDefaults.hc', 'The default style used for high contrast themes'), + ers.description', 'The description of the token modifier'), + } + } + } + } +}); + +const tokenStyleDefaultsExtPoint = ExtensionsRegistry.registerExtensionPoint({ + extensionPoint: 'tokenStyleDefaults', + jsonSchema: { + description: nls.localize('contributes.tokenStyleDefaults', 'Contributes semantic token style default.'), + type: 'array', + items: { + type: 'object', + properties: { + selector: { + type: 'string', + description: nls.localize('contributes.tokenStyleDefaults.selector', 'The selector matching token types and modifiers.'), + pattern: '^[-_\\w]+|\\*(\\.[-_\\w+]+)*$', + patternErrorMessage: nls.localize('contributes.tokenStyleDefaults.selector.format', 'Selectors should be in the form (type|*)(.modifier)*'), + }, + scopes: { + type: 'array', + description: nls.localize('contributes.scopes.light', 'A list of textmate scopes that are matched against the current color theme to find a default style'), + items: { + type: 'string' + } + }, + light: { + description: nls.localize('contributes.tokenStyleDefaults.light', 'The default style used for light themes'), + $ref: textmateColorSettingsSchemaId + }, + dark: { + description: nls.localize('contributes.tokenStyleDefaults.dark', 'The default style used for dark themes'), + $ref: textmateColorSettingsSchemaId + }, + highContrast: { + $ref: textmateColorSettingsSchemaId + } + } + } + } +}); + + +export class TokenClassificationExtensionPoints { + + constructor() { + function validate(contribution: ITokenTypeExtensionPoint | ITokenModifierExtensionPoint, extensionPoint: string, collector: ExtensionMessageCollector): boolean { + if (typeof contribution.id !== 'string' || contribution.id.length === 0) { + collector.error(nls.localize('invalid.id', "'configuration.{0}.id' must be defined and can not be empty", extensionPoint)); + return false; + } + if (!contribution.id.match(typeAndModifierIdPattern)) { + collector.error(nls.localize('invalid.id.format', "'configuration.{0}.id' must follow the letterOrDigit[-_letterOrDigit]*", extensionPoint)); + return false; + } + if (typeof contribution.description !== 'string' || contribution.id.length === 0) { + collector.error(nls.localize('invalid.description', "'configuration.{0}.description' must be defined and can not be empty", extensionPoint)); + return false; + } + return true; + } + + tokenTypeExtPoint.setHandler((extensions, delta) => { + for (const extension of delta.added) { + const extensionValue = extension.value; + const collector = extension.collector; + + if (!extensionValue || !Array.isArray(extensionValue)) { + collector.error(nls.localize('invalid.tokenTypeConfiguration', "'configuration.tokenType' must be a array")); + return; + } + for (const contribution of extensionValue) { + if (validate(contribution, 'tokenType', collector)) { + tokenClassificationRegistry.registerTokenType(contribution.id, contribution.description); + } + } + } + for (const extension of delta.removed) { + const extensionValue = extension.value; + for (const contribution of extensionValue) { + tokenClassificationRegistry.deregisterTokenType(contribution.id); + } + } + }); + tokenModifierExtPoint.setHandler((extensions, delta) => { + for (const extension of delta.added) { + const extensionValue = extension.value; + const collector = extension.collector; + + if (!extensionValue || !Array.isArray(extensionValue)) { + collector.error(nls.localize('invalid.tokenModifierConfiguration', "'configuration.tokenModifier' must be a array")); + return; + } + for (const contribution of extensionValue) { + if (validate(contribution, 'tokenModifier', collector)) { + tokenClassificationRegistry.registerTokenModifier(contribution.id, contribution.description); + } + } + } + for (const extension of delta.removed) { + const extensionValue = extension.value; + for (const contribution of extensionValue) { + tokenClassificationRegistry.deregisterTokenModifier(contribution.id); + } + } + }); + tokenStyleDefaultsExtPoint.setHandler((extensions, delta) => { + for (const extension of delta.added) { + const extensionValue = extension.value; + const collector = extension.collector; + + if (!extensionValue || !Array.isArray(extensionValue)) { + collector.error(nls.localize('invalid.tokenStyleDefaultConfiguration', "'configuration.tokenStyleDefaults' must be a array")); + return; + } + for (const contribution of extensionValue) { + if (typeof contribution.selector !== 'string' || contribution.selector.length === 0) { + collector.error(nls.localize('invalid.selector', "'configuration.tokenStyleDefaults.selector' must be defined and can not be empty")); + return; + } + // if (!contribution.selector.match()) { + // collector.error(nls.localize('invalid.id.format', "'configuration.{0}.id' must follow the letterOrDigit[-_letterOrDigit]*", extensionPoint)); + // return false; + // } + } + } + for (const extension of delta.removed) { + const extensionValue = extension.value; + for (const contribution of extensionValue) { + const [type, ...modifiers] = contribution.selector.split('.'); + const classification = tokenClassificationRegistry.getTokenClassification(type, modifiers); + if (classification) { + tokenClassificationRegistry.deregisterTokenStyleDefault(classification); + } + } + } + }); + } +} + + + From 272625b1fd34bfc8647511ab286f6449643be743 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 10 Dec 2019 15:11:28 -0800 Subject: [PATCH 316/637] Fix #86423, cleanup scm provider actions --- src/vs/workbench/contrib/scm/browser/media/scmViewlet.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vs/workbench/contrib/scm/browser/media/scmViewlet.css b/src/vs/workbench/contrib/scm/browser/media/scmViewlet.css index 1a56521f66e..5c4f41d1fdf 100644 --- a/src/vs/workbench/contrib/scm/browser/media/scmViewlet.css +++ b/src/vs/workbench/contrib/scm/browser/media/scmViewlet.css @@ -42,6 +42,7 @@ text-overflow: ellipsis; display: flex; align-items: center; + min-width: 14px; } .scm-viewlet .monaco-list-row > .scm-provider > .monaco-action-bar .action-label { @@ -53,6 +54,7 @@ .scm-viewlet .monaco-list-row > .scm-provider > .monaco-action-bar .action-label .codicon { font-size: 14px; vertical-align: sub; + display: inline-flex; } .scm-viewlet .monaco-list-row > .scm-provider > .monaco-action-bar .action-item:last-of-type { From b099d570ed4ac01c48fbdc1a9e80d0d33227131e Mon Sep 17 00:00:00 2001 From: romainHainaut Date: Wed, 11 Dec 2019 01:04:45 +0100 Subject: [PATCH 317/637] Fix #83644 (#86619) * Fix #83644 * correction for the PR, 24 is a constant and a comment in css * putting the constant only in searchWidget not in constants * forgot export keyword * change comment in the css, as the constant is not in constant anymore * missclick on erase export keyword, put it back * spelling mistake correction --- .../workbench/contrib/search/browser/media/searchview.css | 1 + src/vs/workbench/contrib/search/browser/searchWidget.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/media/searchview.css b/src/vs/workbench/contrib/search/browser/media/searchview.css index 36fb83e2602..c8f01bd98a3 100644 --- a/src/vs/workbench/contrib/search/browser/media/searchview.css +++ b/src/vs/workbench/contrib/search/browser/media/searchview.css @@ -42,6 +42,7 @@ max-height: 134px; } +/* NOTE: height is also used in searchWidget.ts as a constant*/ .search-view .search-widget .monaco-inputbox > .wrapper > textarea.input { overflow: initial; height: 24px; /* set initial height before measure */ diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index 3c9a7a6b1fd..86341c3a543 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -35,6 +35,8 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { isMacintosh } from 'vs/base/common/platform'; +export const OneLineHeight = 24; + export interface ISearchWidgetOptions { value?: string; replaceValue?: string; @@ -80,7 +82,7 @@ const ctrlKeyMod = (isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd); function stopPropagationForMultiLineUpwards(event: IKeyboardEvent, value: string, textarea: HTMLTextAreaElement | null) { const isMultiline = !!value.match(/\n/); - if (textarea && isMultiline && textarea.selectionStart > 0) { + if (textarea && (isMultiline || textarea.clientHeight > OneLineHeight) && textarea.selectionStart > 0) { event.stopPropagation(); return; } @@ -88,7 +90,7 @@ function stopPropagationForMultiLineUpwards(event: IKeyboardEvent, value: string function stopPropagationForMultiLineDownwards(event: IKeyboardEvent, value: string, textarea: HTMLTextAreaElement | null) { const isMultiline = !!value.match(/\n/); - if (textarea && isMultiline && textarea.selectionEnd < textarea.value.length) { + if (textarea && (isMultiline || textarea.clientHeight > OneLineHeight) && textarea.selectionEnd < textarea.value.length) { event.stopPropagation(); return; } From ec611a10b4ebbb59391e41cdd95dc4593c32d151 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 10 Dec 2019 16:08:13 -0800 Subject: [PATCH 318/637] Tweak search variable name (from #86619) --- src/vs/workbench/contrib/search/browser/searchWidget.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index 86341c3a543..b339428b977 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -35,7 +35,8 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { isMacintosh } from 'vs/base/common/platform'; -export const OneLineHeight = 24; +/** Specified in searchview.css */ +export const SingleLineInputHeight = 24; export interface ISearchWidgetOptions { value?: string; @@ -82,7 +83,7 @@ const ctrlKeyMod = (isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd); function stopPropagationForMultiLineUpwards(event: IKeyboardEvent, value: string, textarea: HTMLTextAreaElement | null) { const isMultiline = !!value.match(/\n/); - if (textarea && (isMultiline || textarea.clientHeight > OneLineHeight) && textarea.selectionStart > 0) { + if (textarea && (isMultiline || textarea.clientHeight > SingleLineInputHeight) && textarea.selectionStart > 0) { event.stopPropagation(); return; } @@ -90,7 +91,7 @@ function stopPropagationForMultiLineUpwards(event: IKeyboardEvent, value: string function stopPropagationForMultiLineDownwards(event: IKeyboardEvent, value: string, textarea: HTMLTextAreaElement | null) { const isMultiline = !!value.match(/\n/); - if (textarea && (isMultiline || textarea.clientHeight > OneLineHeight) && textarea.selectionEnd < textarea.value.length) { + if (textarea && (isMultiline || textarea.clientHeight > SingleLineInputHeight) && textarea.selectionEnd < textarea.value.length) { event.stopPropagation(); return; } From d9f023e573711a9b86bd5c1848e7775f5d0380aa Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 10 Dec 2019 17:36:14 -0800 Subject: [PATCH 319/637] fixes #86309 --- src/vs/base/browser/ui/dialog/dialog.css | 1 + src/vs/base/browser/ui/dialog/dialog.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vs/base/browser/ui/dialog/dialog.css b/src/vs/base/browser/ui/dialog/dialog.css index 0653f1dd4b1..ae230887742 100644 --- a/src/vs/base/browser/ui/dialog/dialog.css +++ b/src/vs/base/browser/ui/dialog/dialog.css @@ -28,6 +28,7 @@ max-width: 90%; min-height: 75px; padding: 10px; + transform: translate3d(0px, 0px, 0px); } /** Dialog: Title Actions Row */ diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts index f303021e744..8186a17296c 100644 --- a/src/vs/base/browser/ui/dialog/dialog.ts +++ b/src/vs/base/browser/ui/dialog/dialog.ts @@ -46,6 +46,7 @@ interface ButtonMapEntry { export class Dialog extends Disposable { private element: HTMLElement | undefined; + private shadowElement: HTMLElement | undefined; private modal: HTMLElement | undefined; private buttonsContainer: HTMLElement | undefined; private messageDetailElement: HTMLElement | undefined; @@ -61,7 +62,8 @@ export class Dialog extends Disposable { constructor(private container: HTMLElement, private message: string, buttons: string[], private options: IDialogOptions) { super(); this.modal = this.container.appendChild($(`.dialog-modal-block${options.type === 'pending' ? '.dimmed' : ''}`)); - this.element = this.modal.appendChild($('.dialog-box')); + this.shadowElement = this.modal.appendChild($('.dialog-shadow')); + this.element = this.shadowElement.appendChild($('.dialog-box')); hide(this.element); // If no button is provided, default to OK @@ -249,10 +251,13 @@ export class Dialog extends Disposable { const shadowColor = style.dialogShadow ? `0 0px 8px ${style.dialogShadow}` : ''; const border = style.dialogBorder ? `1px solid ${style.dialogBorder}` : ''; + if (this.shadowElement) { + this.shadowElement.style.boxShadow = shadowColor; + } + if (this.element) { this.element.style.color = fgColor; this.element.style.backgroundColor = bgColor; - this.element.style.boxShadow = shadowColor; this.element.style.border = border; if (this.buttonGroup) { From fb98d2303d0cde16dee5451de8fed7e809c14996 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Tue, 10 Dec 2019 17:46:19 -0800 Subject: [PATCH 320/637] fixes #85690 --- src/vs/base/browser/ui/menu/menu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index 815ee5fbffd..cec02ea3959 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -593,7 +593,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem { const isSelected = this.element && hasClass(this.element, 'focused'); const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor; - const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : this.menuStyle.backgroundColor; + const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : undefined; const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : ''; if (this.item) { From 235a57194c11c95ddd7a46e50750885256962b49 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 11 Dec 2019 07:41:02 +0100 Subject: [PATCH 321/637] address some strict function type errors (#81574) --- src/vs/platform/files/test/files.test.ts | 6 +++--- src/vs/workbench/common/editor/editorGroup.ts | 11 +++++------ .../editor/test/browser/editorService.test.ts | 4 ++-- .../textfile/common/textFileEditorModelManager.ts | 4 ++-- .../services/textfile/test/textFileService.test.ts | 2 +- src/vs/workbench/test/browser/quickopen.test.ts | 4 ++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/vs/platform/files/test/files.test.ts b/src/vs/platform/files/test/files.test.ts index 5fe13d177a2..153d4201ba6 100644 --- a/src/vs/platform/files/test/files.test.ts +++ b/src/vs/platform/files/test/files.test.ts @@ -42,7 +42,7 @@ suite('Files', () => { assert.strictEqual(true, r1.gotDeleted()); }); - function testIsEqual(testMethod: (pA: string | undefined, pB: string, ignoreCase: boolean) => boolean): void { + function testIsEqual(testMethod: (pA: string, pB: string, ignoreCase: boolean) => boolean): void { // corner cases assert(testMethod('', '', true)); @@ -136,7 +136,7 @@ suite('Files', () => { test('isEqualOrParent (ignorecase)', function () { // same assertions apply as with isEqual() - testIsEqual(isEqualOrParent); + testIsEqual(isEqualOrParent); // if (isWindows) { assert(isEqualOrParent('c:\\some\\path', 'c:\\', true)); @@ -182,4 +182,4 @@ suite('Files', () => { assert(!isEqualOrParent('foo/bar/test.ts', 'foo/BAR/test.', true)); } }); -}); \ No newline at end of file +}); diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index c8de4f91317..b929d86881d 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -477,13 +477,12 @@ export class EditorGroup extends Disposable { private splice(index: number, del: boolean, editor?: EditorInput): void { const editorToDeleteOrReplace = this.editors[index]; - const args: (number | EditorInput)[] = [index, del ? 1 : 0]; - if (editor) { - args.push(editor); - } - // Perform on editors array - this.editors.splice.apply(this.editors, args); + if (editor) { + this.editors.splice(index, del ? 1 : 0, editor); + } else { + this.editors.splice(index, del ? 1 : 0); + } // Add if (!del && editor) { diff --git a/src/vs/workbench/services/editor/test/browser/editorService.test.ts b/src/vs/workbench/services/editor/test/browser/editorService.test.ts index a6e1c34e790..a165316f92a 100644 --- a/src/vs/workbench/services/editor/test/browser/editorService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorService.test.ts @@ -7,7 +7,7 @@ import * as assert from 'assert'; import { IEditorModel, EditorActivation } from 'vs/platform/editor/common/editor'; import { URI } from 'vs/base/common/uri'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { EditorInput, EditorOptions, IFileEditorInput, IEditorInput, GroupIdentifier, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor'; +import { EditorInput, EditorOptions, IFileEditorInput, GroupIdentifier, ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor'; import { workbenchInstantiationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; @@ -354,7 +354,7 @@ suite('EditorService', () => { const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource-delegate'), undefined); const delegate = instantiationService.createInstance(DelegatingEditorService); - delegate.setEditorOpenHandler((delegate, group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => { + delegate.setEditorOpenHandler((delegate, group, input, options?) => { assert.strictEqual(input, inp); done(); diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts index 6a8d170d6e5..d7116508ca0 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts @@ -128,8 +128,8 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE } } - private debounce(event: Event): Event> { - return Event.debounce(event, (prev: TextFileModelChangeEvent[], cur: TextFileModelChangeEvent) => { + private debounce(event: Event): Event { + return Event.debounce(event, (prev, cur) => { if (!prev) { prev = [cur]; } else { diff --git a/src/vs/workbench/services/textfile/test/textFileService.test.ts b/src/vs/workbench/services/textfile/test/textFileService.test.ts index e0bb57aac5b..79c3a8052dc 100644 --- a/src/vs/workbench/services/textfile/test/textFileService.test.ts +++ b/src/vs/workbench/services/textfile/test/textFileService.test.ts @@ -414,7 +414,7 @@ suite('Files - TextFileService', () => { }); }); - async function hotExitTest(this: any, setting: string, shutdownReason: ShutdownReason, multipleWindows: boolean, workspace: true, shouldVeto: boolean): Promise { + async function hotExitTest(this: any, setting: string, shutdownReason: ShutdownReason, multipleWindows: boolean, workspace: boolean, shouldVeto: boolean): Promise { model = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/file.txt'), 'utf8', undefined); (accessor.textFileService.models).add(model.resource, model); diff --git a/src/vs/workbench/test/browser/quickopen.test.ts b/src/vs/workbench/test/browser/quickopen.test.ts index 696bb972574..cbd8854f8eb 100644 --- a/src/vs/workbench/test/browser/quickopen.test.ts +++ b/src/vs/workbench/test/browser/quickopen.test.ts @@ -71,8 +71,8 @@ suite('QuickOpen', () => { }); test('QuickOpen Action', () => { - let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService((prefix: string) => assert(!prefix))); - let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService((prefix: string) => assert(!!prefix))); + let defaultAction = new QuickOpenAction('id', 'label', (undefined)!, new TestQuickOpenService(prefix => assert(!prefix))); + let prefixAction = new QuickOpenAction('id', 'label', ',', new TestQuickOpenService(prefix => assert(!!prefix))); defaultAction.run(); prefixAction.run(); From 93f58e063efcb86960ec1f2529186a63e655ee6c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 11 Dec 2019 09:39:39 +0100 Subject: [PATCH 322/637] add types for electron.d.ts (#86721) --- package.json | 1 + src/typings/electron.d.ts | 10730 ---------------- src/vs/base/parts/ipc/node/ipc.cp.ts | 2 +- .../electron-browser/extensionHost.ts | 2 +- yarn.lock | 252 +- 5 files changed, 248 insertions(+), 10739 deletions(-) delete mode 100644 src/typings/electron.d.ts diff --git a/package.json b/package.json index a5a27d8dbe8..62646daa9a2 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "coveralls": "^2.11.11", "cson-parser": "^1.3.3", "debounce": "^1.0.0", + "electron": "6.1.5", "event-stream": "3.3.4", "express": "^4.13.1", "fancy-log": "^1.3.3", diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts deleted file mode 100644 index 369817dcd12..00000000000 --- a/src/typings/electron.d.ts +++ /dev/null @@ -1,10730 +0,0 @@ -// Type definitions for Electron 6.1.5 -// Project: http://electronjs.org/ -// Definitions by: The Electron Team -// Definitions: https://github.com/electron/electron-typescript-definitions - -/// - -type GlobalEvent = Event; - -declare namespace Electron { - // TODO: Replace this declaration with NodeJS.EventEmitter - class EventEmitter { - addListener(event: string, listener: Function): this; - on(event: string, listener: Function): this; - once(event: string, listener: Function): this; - removeListener(event: string, listener: Function): this; - removeAllListeners(event?: string): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - listeners(event: string): Function[]; - emit(event: string, ...args: any[]): boolean; - listenerCount(type: string): number; - prependListener(event: string, listener: Function): this; - prependOnceListener(event: string, listener: Function): this; - eventNames(): Array<(string | symbol)>; - } - - class Accelerator extends String { - - } - - interface CommonInterface { - clipboard: Clipboard; - crashReporter: CrashReporter; - nativeImage: typeof NativeImage; - shell: Shell; - } - - interface MainInterface extends CommonInterface { - app: App; - autoUpdater: AutoUpdater; - BrowserView: typeof BrowserView; - BrowserWindow: typeof BrowserWindow; - ClientRequest: typeof ClientRequest; - contentTracing: ContentTracing; - Cookies: typeof Cookies; - Debugger: typeof Debugger; - dialog: Dialog; - DownloadItem: typeof DownloadItem; - globalShortcut: GlobalShortcut; - inAppPurchase: InAppPurchase; - IncomingMessage: typeof IncomingMessage; - ipcMain: IpcMain; - Menu: typeof Menu; - MenuItem: typeof MenuItem; - net: Net; - netLog: NetLog; - Notification: typeof Notification; - powerMonitor: PowerMonitor; - powerSaveBlocker: PowerSaveBlocker; - protocol: Protocol; - screen: Screen; - session: typeof Session; - systemPreferences: SystemPreferences; - TouchBar: typeof TouchBar; - Tray: typeof Tray; - webContents: typeof WebContents; - WebRequest: typeof WebRequest; - } - - interface RendererInterface extends CommonInterface { - BrowserWindowProxy: typeof BrowserWindowProxy; - contextBridge: ContextBridge; - desktopCapturer: DesktopCapturer; - ipcRenderer: IpcRenderer; - remote: Remote; - webFrame: WebFrame; - webviewTag: WebviewTag; - } - - interface AllElectron extends MainInterface, RendererInterface { } - - const app: App; - const autoUpdater: AutoUpdater; - const clipboard: Clipboard; - const contentTracing: ContentTracing; - const contextBridge: ContextBridge; - const crashReporter: CrashReporter; - const desktopCapturer: DesktopCapturer; - const dialog: Dialog; - const globalShortcut: GlobalShortcut; - const inAppPurchase: InAppPurchase; - const ipcMain: IpcMain; - const ipcRenderer: IpcRenderer; - type nativeImage = NativeImage; - const nativeImage: typeof NativeImage; - const net: Net; - const netLog: NetLog; - const powerMonitor: PowerMonitor; - const powerSaveBlocker: PowerSaveBlocker; - const protocol: Protocol; - // const remote: Remote; ### VSCODE CHANGE (we do not want to use remote) - const screen: Screen; - type session = Session; - const session: typeof Session; - const shell: Shell; - const systemPreferences: SystemPreferences; - type webContents = WebContents; - const webContents: typeof WebContents; - const webFrame: WebFrame; - const webviewTag: WebviewTag; - - interface App extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/app - - /** - * Emitted when Chrome's accessibility support changes. This event fires when - * assistive technologies, such as screen readers, are enabled or disabled. See - * https://www.chromium.org/developers/design-documents/accessibility for more - * details. - */ - on(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - once(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - addListener(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - removeListener(event: 'accessibility-support-changed', listener: (event: Event, - /** - * `true` when Chrome's accessibility support is enabled, `false` otherwise. - */ - accessibilitySupportEnabled: boolean) => void): this; - /** - * Emitted when the application is activated. Various actions can trigger this - * event, such as launching the application for the first time, attempting to - * re-launch the application when it's already running, or clicking on the - * application's dock or taskbar icon. - */ - on(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - once(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - addListener(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - removeListener(event: 'activate', listener: (event: Event, - hasVisibleWindows: boolean) => void): this; - /** - * Emitted during Handoff after an activity from this device was successfully - * resumed on another one. - */ - on(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - once(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - addListener(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - removeListener(event: 'activity-was-continued', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - /** - * Emitted before the application starts closing its windows. Calling - * event.preventDefault() will prevent the default behavior, which is terminating - * the application. Note: If application quit was initiated by - * autoUpdater.quitAndInstall(), then before-quit is emitted after emitting close - * event on all windows and closing them. Note: On Windows, this event will not be - * emitted if the app is closed due to a shutdown/restart of the system or a user - * logout. - */ - on(event: 'before-quit', listener: (event: Event) => void): this; - once(event: 'before-quit', listener: (event: Event) => void): this; - addListener(event: 'before-quit', listener: (event: Event) => void): this; - removeListener(event: 'before-quit', listener: (event: Event) => void): this; - /** - * Emitted when a browserWindow gets blurred. - */ - on(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-blur', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when a new browserWindow is created. - */ - on(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-created', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when a browserWindow gets focused. - */ - on(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - once(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - addListener(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - removeListener(event: 'browser-window-focus', listener: (event: Event, - window: BrowserWindow) => void): this; - /** - * Emitted when failed to verify the certificate for url, to trust the certificate - * you should prevent the default behavior with event.preventDefault() and call - * callback(true). - */ - on(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event: Event, - webContents: WebContents, - url: string, - /** - * The error code - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - /** - * Emitted during Handoff when an activity from a different device wants to be - * resumed. You should call event.preventDefault() if you want to handle this - * event. A user activity can be continued only in an app that has the same - * developer Team ID as the activity's source app and that supports the activity's - * type. Supported activity types are specified in the app's Info.plist under the - * NSUserActivityTypes key. - */ - on(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - once(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - addListener(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - removeListener(event: 'continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity on another device. - */ - userInfo: any) => void): this; - /** - * Emitted during Handoff when an activity from a different device fails to be - * resumed. - */ - on(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - once(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - addListener(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - removeListener(event: 'continue-activity-error', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * A string with the error's localized description. - */ - error: string) => void): this; - /** - * Emitted when desktopCapturer.getSources() is called in the renderer process of - * webContents. Calling event.preventDefault() will make it return empty sources. - */ - on(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when the gpu process crashes or is killed. - */ - on(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - once(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - addListener(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - removeListener(event: 'gpu-process-crashed', listener: (event: Event, - killed: boolean) => void): this; - /** - * Emitted when webContents wants to do basic auth. The default behavior is to - * cancel all authentications. To override this you should prevent the default - * behavior with event.preventDefault() and call callback(username, password) with - * the credentials. - */ - on(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (event: Event, - webContents: WebContents, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when the user clicks the native macOS new tab button. The new tab button - * is only visible if the current BrowserWindow has a tabbingIdentifier - */ - on(event: 'new-window-for-tab', listener: (event: Event) => void): this; - once(event: 'new-window-for-tab', listener: (event: Event) => void): this; - addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; - removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this; - /** - * Emitted when the user wants to open a file with the application. The open-file - * event is usually emitted when the application is already open and the OS wants - * to reuse the application to open the file. open-file is also emitted when a file - * is dropped onto the dock and the application is not yet running. Make sure to - * listen for the open-file event very early in your application startup to handle - * this case (even before the ready event is emitted). You should call - * event.preventDefault() if you want to handle this event. On Windows, you have to - * parse process.argv (in the main process) to get the filepath. - */ - on(event: 'open-file', listener: (event: Event, - path: string) => void): this; - once(event: 'open-file', listener: (event: Event, - path: string) => void): this; - addListener(event: 'open-file', listener: (event: Event, - path: string) => void): this; - removeListener(event: 'open-file', listener: (event: Event, - path: string) => void): this; - /** - * Emitted when the user wants to open a URL with the application. Your - * application's Info.plist file must define the url scheme within the - * CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should - * call event.preventDefault() if you want to handle this event. - */ - on(event: 'open-url', listener: (event: Event, - url: string) => void): this; - once(event: 'open-url', listener: (event: Event, - url: string) => void): this; - addListener(event: 'open-url', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'open-url', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when the application is quitting. Note: On Windows, this event will not - * be emitted if the app is closed due to a shutdown/restart of the system or a - * user logout. - */ - on(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - once(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - addListener(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - removeListener(event: 'quit', listener: (event: Event, - exitCode: number) => void): this; - /** - * Emitted when Electron has finished initializing. On macOS, launchInfo holds the - * userInfo of the NSUserNotification that was used to open the application, if it - * was launched from Notification Center. You can call app.isReady() to check if - * this event has already fired. - */ - on(event: 'ready', listener: (launchInfo: any) => void): this; - once(event: 'ready', listener: (launchInfo: any) => void): this; - addListener(event: 'ready', listener: (launchInfo: any) => void): this; - removeListener(event: 'ready', listener: (launchInfo: any) => void): this; - /** - * Emitted when remote.getBuiltin() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the module from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - once(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - addListener(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - removeListener(event: 'remote-get-builtin', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - /** - * Emitted when remote.getCurrentWebContents() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'remote-get-current-web-contents', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when remote.getCurrentWindow() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'remote-get-current-window', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted when remote.getGlobal() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the global from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - once(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - addListener(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - removeListener(event: 'remote-get-global', listener: (event: Event, - webContents: WebContents, - globalName: string) => void): this; - /** - * Emitted when .getWebContents() is called in the renderer process of - * webContents. Calling event.preventDefault() will prevent the object from being - * returned. Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - once(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - addListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - webContents: WebContents, - guestWebContents: WebContents) => void): this; - /** - * Emitted when remote.require() is called in the renderer process of webContents. - * Calling event.preventDefault() will prevent the module from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - once(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - addListener(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - removeListener(event: 'remote-require', listener: (event: Event, - webContents: WebContents, - moduleName: string) => void): this; - /** - * Emitted when the renderer process of webContents crashes or is killed. - */ - on(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - once(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - addListener(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - removeListener(event: 'renderer-process-crashed', listener: (event: Event, - webContents: WebContents, - killed: boolean) => void): this; - /** - * This event will be emitted inside the primary instance of your application when - * a second instance has been executed and calls app.requestSingleInstanceLock(). - * argv is an Array of the second instance's command line arguments, and - * workingDirectory is its current working directory. Usually applications respond - * to this by making their primary window focused and non-minimized. This event is - * guaranteed to be emitted after the ready event of app gets emitted. Note: Extra - * command line arguments might be added by Chromium, such as - * --original-process-start-time. - */ - on(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - once(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - addListener(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - removeListener(event: 'second-instance', listener: (event: Event, - /** - * An array of the second instance's command line arguments - */ - argv: string[], - /** - * The second instance's working directory - */ - workingDirectory: string) => void): this; - /** - * Emitted when a client certificate is requested. The url corresponds to the - * navigation entry requesting the client certificate and callback can be called - * with an entry filtered from the list. Using event.preventDefault() prevents the - * application from using the first certificate from the store. - */ - on(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event: Event, - webContents: WebContents, - url: string, - certificateList: Certificate[], - callback: (certificate?: Certificate) => void) => void): this; - /** - * Emitted when Electron has created a new session. - */ - on(event: 'session-created', listener: (session: Session) => void): this; - once(event: 'session-created', listener: (session: Session) => void): this; - addListener(event: 'session-created', listener: (session: Session) => void): this; - removeListener(event: 'session-created', listener: (session: Session) => void): this; - /** - * Emitted when Handoff is about to be resumed on another device. If you need to - * update the state to be transferred, you should call event.preventDefault() - * immediately, construct a new userInfo dictionary and call - * app.updateCurrentActiviy() in a timely manner. Otherwise, the operation will - * fail and continue-activity-error will be called. - */ - on(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - once(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - addListener(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - removeListener(event: 'update-activity-state', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string, - /** - * Contains app-specific state stored by the activity. - */ - userInfo: any) => void): this; - /** - * Emitted when a new webContents is created. - */ - on(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - once(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - addListener(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - removeListener(event: 'web-contents-created', listener: (event: Event, - webContents: WebContents) => void): this; - /** - * Emitted during Handoff before an activity from a different device wants to be - * resumed. You should call event.preventDefault() if you want to handle this - * event. - */ - on(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - once(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - addListener(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - removeListener(event: 'will-continue-activity', listener: (event: Event, - /** - * A string identifying the activity. Maps to . - */ - type: string) => void): this; - /** - * Emitted when the application has finished basic startup. On Windows and Linux, - * the will-finish-launching event is the same as the ready event; on macOS, this - * event represents the applicationWillFinishLaunching notification of - * NSApplication. You would usually set up listeners for the open-file and open-url - * events here, and start the crash reporter and auto updater. In most cases, you - * should do everything in the ready event handler. - */ - on(event: 'will-finish-launching', listener: Function): this; - once(event: 'will-finish-launching', listener: Function): this; - addListener(event: 'will-finish-launching', listener: Function): this; - removeListener(event: 'will-finish-launching', listener: Function): this; - /** - * Emitted when all windows have been closed and the application will quit. Calling - * event.preventDefault() will prevent the default behaviour, which is terminating - * the application. See the description of the window-all-closed event for the - * differences between the will-quit and window-all-closed events. Note: On - * Windows, this event will not be emitted if the app is closed due to a - * shutdown/restart of the system or a user logout. - */ - on(event: 'will-quit', listener: (event: Event) => void): this; - once(event: 'will-quit', listener: (event: Event) => void): this; - addListener(event: 'will-quit', listener: (event: Event) => void): this; - removeListener(event: 'will-quit', listener: (event: Event) => void): this; - /** - * Emitted when all windows have been closed. If you do not subscribe to this event - * and all windows are closed, the default behavior is to quit the app; however, if - * you subscribe, you control whether the app quits or not. If the user pressed Cmd - * + Q, or the developer called app.quit(), Electron will first try to close all - * the windows and then emit the will-quit event, and in this case the - * window-all-closed event would not be emitted. - */ - on(event: 'window-all-closed', listener: Function): this; - once(event: 'window-all-closed', listener: Function): this; - addListener(event: 'window-all-closed', listener: Function): this; - removeListener(event: 'window-all-closed', listener: Function): this; - /** - * Adds path to the recent documents list. This list is managed by the OS. On - * Windows, you can visit the list from the task bar, and on macOS, you can visit - * it from dock menu. - */ - addRecentDocument(path: string): void; - /** - * Clears the recent documents list. - */ - clearRecentDocuments(): void; - /** - * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain - * basis if the GPU processes crashes too frequently. This function disables that - * behaviour. This method can only be called before app is ready. - */ - disableDomainBlockingFor3DAPIs(): void; - /** - * Disables hardware acceleration for current app. This method can only be called - * before app is ready. - */ - disableHardwareAcceleration(): void; - /** - * Enables full sandbox mode on the app. This method can only be called before app - * is ready. - */ - enableSandbox(): void; - /** - * Exits immediately with exitCode. exitCode defaults to 0. All windows will be - * closed immediately without asking the user, and the before-quit and will-quit - * events will not be emitted. - */ - exit(exitCode?: number): void; - /** - * On Linux, focuses on the first visible window. On macOS, makes the application - * the active app. On Windows, focuses on the application's first window. - */ - focus(): void; - getAppMetrics(): ProcessMetric[]; - getAppPath(): string; - getBadgeCount(): number; - getCurrentActivityType(): string; - /** - * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux - * and macOS, icons depend on the application associated with file mime type. - */ - getFileIcon(path: string, options?: FileIconOptions): Promise; - /** - * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On - * Linux and macOS, icons depend on the application associated with file mime type. - * Deprecated Soon - */ - getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; - /** - * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On - * Linux and macOS, icons depend on the application associated with file mime type. - * Deprecated Soon - */ - getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; - getGPUFeatureStatus(): GPUFeatureStatus; - /** - * For infoType equal to complete: Promise is fulfilled with Object containing all - * the GPU Information as in chromium's GPUInfo object. This includes the version - * and driver information that's shown on chrome://gpu page. For infoType equal to - * basic: Promise is fulfilled with Object containing fewer attributes than when - * requested with complete. Here's an example of basic response: Using basic should - * be preferred if only basic information like vendorId or driverId is needed. - */ - getGPUInfo(infoType: string): Promise; - getJumpListSettings(): JumpListSettings; - /** - * To set the locale, you'll want to use a command line switch at app startup, - * which may be found here. Note: When distributing your packaged app, you have to - * also ship the locales folder. Note: On Windows, you have to call it after the - * ready events gets emitted. - */ - getLocale(): string; - /** - * Note: When unable to detect locale country code, it returns empty string. - */ - getLocaleCountryCode(): string; - /** - * If you provided path and args options to app.setLoginItemSettings, then you need - * to pass the same arguments here for openAtLogin to be set correctly. - */ - getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings; - /** - * Usually the name field of package.json is a short lowercased name, according to - * the npm modules spec. You should usually also specify a productName field, which - * is your application's full capitalized name, and which will be preferred over - * name by Electron. - */ - getName(): string; - /** - * You can request the following paths by the name: - */ - getPath(name: string): string; - getVersion(): string; - /** - * This method returns whether or not this instance of your app is currently - * holding the single instance lock. You can request the lock with - * app.requestSingleInstanceLock() and release with app.releaseSingleInstanceLock() - */ - hasSingleInstanceLock(): boolean; - /** - * Hides all application windows without minimizing them. - */ - hide(): void; - /** - * Imports the certificate in pkcs12 format into the platform certificate store. - * callback is called with the result of import operation, a value of 0 indicates - * success while any other value indicates failure according to Chromium - * net_error_list. - */ - importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; - /** - * Invalidates the current Handoff user activity. - */ - invalidateCurrentActivity(type: string): void; - /** - * Deprecated Soon - */ - isAccessibilitySupportEnabled(): boolean; - /** - * This method checks if the current executable is the default handler for a - * protocol (aka URI scheme). If so, it will return true. Otherwise, it will return - * false. Note: On macOS, you can use this method to check if the app has been - * registered as the default protocol handler for a protocol. You can also verify - * this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the - * macOS machine. Please refer to Apple's documentation for details. The API uses - * the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. - */ - isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - isEmojiPanelSupported(): boolean; - isInApplicationsFolder(): boolean; - isReady(): boolean; - isUnityRunning(): boolean; - /** - * No confirmation dialog will be presented by default. If you wish to allow the - * user to confirm the operation, you may do so using the dialog API. NOTE: This - * method throws errors if anything other than the user causes the move to fail. - * For instance if the user cancels the authorization dialog, this method returns - * false. If we fail to perform the copy, then this method will throw an error. The - * message in the error should be informative and tell you exactly what went wrong - */ - moveToApplicationsFolder(): boolean; - /** - * Try to close all windows. The before-quit event will be emitted first. If all - * windows are successfully closed, the will-quit event will be emitted and by - * default the application will terminate. This method guarantees that all - * beforeunload and unload event handlers are correctly executed. It is possible - * that a window cancels the quitting by returning false in the beforeunload event - * handler. - */ - quit(): void; - /** - * Relaunches the app when current instance exits. By default, the new instance - * will use the same working directory and command line arguments with current - * instance. When args is specified, the args will be passed as command line - * arguments instead. When execPath is specified, the execPath will be executed for - * relaunch instead of current app. Note that this method does not quit the app - * when executed, you have to call app.quit or app.exit after calling app.relaunch - * to make the app restart. When app.relaunch is called for multiple times, - * multiple instances will be started after current instance exited. An example of - * restarting current instance immediately and adding a new command line argument - * to the new instance: - */ - relaunch(options?: RelaunchOptions): void; - /** - * Releases all locks that were created by requestSingleInstanceLock. This will - * allow multiple instances of the application to once again run side by side. - */ - releaseSingleInstanceLock(): void; - /** - * This method checks if the current executable as the default handler for a - * protocol (aka URI scheme). If so, it will remove the app as the default handler. - */ - removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - /** - * The return value of this method indicates whether or not this instance of your - * application successfully obtained the lock. If it failed to obtain the lock, - * you can assume that another instance of your application is already running with - * the lock and exit immediately. I.e. This method returns true if your process is - * the primary instance of your application and your app should continue loading. - * It returns false if your process should immediately quit as it has sent its - * parameters to another instance that has already acquired the lock. On macOS, the - * system enforces single instance automatically when users try to open a second - * instance of your app in Finder, and the open-file and open-url events will be - * emitted for that. However when users start your app in command line, the - * system's single instance mechanism will be bypassed, and you have to use this - * method to ensure single instance. An example of activating the window of primary - * instance when a second instance starts: - */ - requestSingleInstanceLock(): boolean; - /** - * Set the about panel options. This will override the values defined in the app's - * .plist file on MacOS. See the Apple docs for more details. On Linux, values must - * be set in order to be shown; there are no defaults. - */ - setAboutPanelOptions(options: AboutPanelOptionsOptions): void; - /** - * Manually enables Chrome's accessibility support, allowing to expose - * accessibility switch to users in application settings. See Chromium's - * accessibility docs for more details. Disabled by default. This API must be - * called after the ready event is emitted. Note: Rendering accessibility tree can - * significantly affect the performance of your app. It should not be enabled by - * default. Deprecated Soon - */ - setAccessibilitySupportEnabled(enabled: boolean): void; - /** - * Sets or creates a directory your app's logs which can then be manipulated with - * app.getPath() or app.setPath(pathName, newPath). Calling app.setAppLogsPath() - * without a path parameter will result in this directory being set to - * /Library/Logs/YourAppName on macOS, and inside the userData directory on Linux - * and Windows. - */ - setAppLogsPath(path?: string): void; - /** - * Changes the Application User Model ID to id. - */ - setAppUserModelId(id: string): void; - /** - * This method sets the current executable as the default handler for a protocol - * (aka URI scheme). It allows you to integrate your app deeper into the operating - * system. Once registered, all links with your-protocol:// will be opened with the - * current executable. The whole link, including protocol, will be passed to your - * application as a parameter. On Windows, you can provide optional parameters - * path, the path to your executable, and args, an array of arguments to be passed - * to your executable when it launches. Note: On macOS, you can only register - * protocols that have been added to your app's info.plist, which can not be - * modified at runtime. You can however change the file with a simple text editor - * or script during build time. Please refer to Apple's documentation for details. - * Note: In a Windows Store environment (when packaged as an appx) this API will - * return true for all calls but the registry key it sets won't be accessible by - * other applications. In order to register your Windows Store application as a - * default protocol handler you must declare the protocol in your manifest. The API - * uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally. - */ - setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; - /** - * Sets the counter badge for current app. Setting the count to 0 will hide the - * badge. On macOS, it shows on the dock icon. On Linux, it only works for Unity - * launcher. Note: Unity launcher requires the existence of a .desktop file to - * work, for more information please read Desktop Environment Integration. - */ - setBadgeCount(count: number): boolean; - /** - * Sets or removes a custom Jump List for the application, and returns one of the - * following strings: If categories is null the previously set custom Jump List (if - * any) will be replaced by the standard Jump List for the app (managed by - * Windows). Note: If a JumpListCategory object has neither the type nor the name - * property set then its type is assumed to be tasks. If the name property is set - * but the type property is omitted then the type is assumed to be custom. Note: - * Users can remove items from custom categories, and Windows will not allow a - * removed item to be added back into a custom category until after the next - * successful call to app.setJumpList(categories). Any attempt to re-add a removed - * item to a custom category earlier than that will result in the entire custom - * category being omitted from the Jump List. The list of removed items can be - * obtained using app.getJumpListSettings(). Here's a very simple example of - * creating a custom Jump List: - */ - setJumpList(categories: JumpListCategory[]): void; - /** - * Set the app's login item settings. To work with Electron's autoUpdater on - * Windows, which uses Squirrel, you'll want to set the launch path to Update.exe, - * and pass arguments that specify your application name. For example: - */ - setLoginItemSettings(settings: Settings): void; - /** - * Overrides the current application's name. - */ - setName(name: string): void; - /** - * Overrides the path to a special directory or file associated with name. If the - * path specifies a directory that does not exist, an Error is thrown. In that - * case, the directory should be created with fs.mkdirSync or similar. You can only - * override paths of a name defined in app.getPath. By default, web pages' cookies - * and caches will be stored under the userData directory. If you want to change - * this location, you have to override the userData path before the ready event of - * the app module is emitted. - */ - setPath(name: string, path: string): void; - /** - * Creates an NSUserActivity and sets it as the current activity. The activity is - * eligible for Handoff to another device afterward. - */ - setUserActivity(type: string, userInfo: any, webpageURL?: string): void; - /** - * Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array - * of Task objects. Note: If you'd like to customize the Jump List even more use - * app.setJumpList(categories) instead. - */ - setUserTasks(tasks: Task[]): boolean; - /** - * Shows application windows after they were hidden. Does not automatically focus - * them. - */ - show(): void; - /** - * Show the app's about panel options. These options can be overridden with - * app.setAboutPanelOptions(options). - */ - showAboutPanel(): void; - /** - * Show the platform's native emoji picker. - */ - showEmojiPanel(): void; - /** - * Start accessing a security scoped resource. With this method Electron - * applications that are packaged for the Mac App Store may reach outside their - * sandbox to access files chosen by the user. See Apple's documentation for a - * description of how this system works. - */ - startAccessingSecurityScopedResource(bookmarkData: string): Function; - /** - * Updates the current activity if its type matches type, merging the entries from - * userInfo into its current userInfo dictionary. - */ - updateCurrentActivity(type: string, userInfo: any): void; - whenReady(): Promise; - /** - * A Boolean property that's true if Chrome's accessibility support is enabled, - * false otherwise. This property will be true if the use of assistive - * technologies, such as screen readers, has been detected. Setting this property - * to true manually enables Chrome's accessibility support, allowing developers to - * expose accessibility switch to users in application settings. See Chromium's - * accessibility docs for more details. Disabled by default. This API must be - * called after the ready event is emitted. Note: Rendering accessibility tree can - * significantly affect the performance of your app. It should not be enabled by - * default. - */ - accessibilitySupportEnabled?: boolean; - /** - * A Boolean which when true disables the overrides that Electron has in place to - * ensure renderer processes are restarted on every navigation. The current - * default value for this property is false. The intention is for these overrides - * to become disabled by default and then at some point in the future this property - * will be removed. This property impacts which native modules you can use in the - * renderer process. For more information on the direction Electron is going with - * renderer process restarts and usage of native modules in the renderer process - * please check out this Tracking Issue. - */ - allowRendererProcessReuse?: boolean; - /** - * A Menu property that return Menu if one has been set and null otherwise. Users - * can pass a Menu to set this property. - */ - applicationMenu?: Menu; - commandLine: CommandLine; - dock: Dock; - /** - * A Boolean property that returns true if the app is packaged, false otherwise. - * For many apps, this property can be used to distinguish development and - * production environments. - */ - isPackaged?: boolean; - /** - * A String which is the user agent string Electron will use as a global fallback. - * This is the user agent that will be used when no user agent is set at the - * webContents or session level. Useful for ensuring your entire app has the same - * user agent. Set to a custom value as early as possible in your apps - * initialization to ensure that your overridden value is used. - */ - userAgentFallback?: string; - } - - interface AutoUpdater extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/auto-updater - - /** - * This event is emitted after a user calls quitAndInstall(). When this API is - * called, the before-quit event is not emitted before all windows are closed. As a - * result you should listen to this event if you wish to perform actions before the - * windows are closed while a process is quitting, as well as listening to - * before-quit. - */ - on(event: 'before-quit-for-update', listener: Function): this; - once(event: 'before-quit-for-update', listener: Function): this; - addListener(event: 'before-quit-for-update', listener: Function): this; - removeListener(event: 'before-quit-for-update', listener: Function): this; - /** - * Emitted when checking if an update has started. - */ - on(event: 'checking-for-update', listener: Function): this; - once(event: 'checking-for-update', listener: Function): this; - addListener(event: 'checking-for-update', listener: Function): this; - removeListener(event: 'checking-for-update', listener: Function): this; - /** - * Emitted when there is an error while updating. - */ - on(event: 'error', listener: (error: Error) => void): this; - once(event: 'error', listener: (error: Error) => void): this; - addListener(event: 'error', listener: (error: Error) => void): this; - removeListener(event: 'error', listener: (error: Error) => void): this; - /** - * Emitted when there is an available update. The update is downloaded - * automatically. - */ - on(event: 'update-available', listener: Function): this; - once(event: 'update-available', listener: Function): this; - addListener(event: 'update-available', listener: Function): this; - removeListener(event: 'update-available', listener: Function): this; - /** - * Emitted when an update has been downloaded. On Windows only releaseName is - * available. Note: It is not strictly necessary to handle this event. A - * successfully downloaded update will still be applied the next time the - * application starts. - */ - on(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - once(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - addListener(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - removeListener(event: 'update-downloaded', listener: (event: Event, - releaseNotes: string, - releaseName: string, - releaseDate: Date, - updateURL: string) => void): this; - /** - * Emitted when there is no available update. - */ - on(event: 'update-not-available', listener: Function): this; - once(event: 'update-not-available', listener: Function): this; - addListener(event: 'update-not-available', listener: Function): this; - removeListener(event: 'update-not-available', listener: Function): this; - /** - * Asks the server whether there is an update. You must call setFeedURL before - * using this API. - */ - checkForUpdates(): void; - getFeedURL(): string; - /** - * Restarts the app and installs the update after it has been downloaded. It should - * only be called after update-downloaded has been emitted. Under the hood calling - * autoUpdater.quitAndInstall() will close all application windows first, and - * automatically call app.quit() after all windows have been closed. Note: It is - * not strictly necessary to call this function to apply an update, as a - * successfully downloaded update will always be applied the next time the - * application starts. - */ - quitAndInstall(): void; - /** - * Sets the url and initialize the auto updater. - */ - setFeedURL(options: FeedURLOptions): void; - } - - interface BluetoothDevice { - - // Docs: http://electronjs.org/docs/api/structures/bluetooth-device - - deviceId: string; - deviceName: string; - } - - class BrowserView extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-view - - constructor(options?: BrowserViewConstructorOptions); - static fromId(id: number): BrowserView; - static fromWebContents(webContents: WebContents): (BrowserView) | (null); - static getAllViews(): BrowserView[]; - /** - * Force closing the view, the unload and beforeunload events won't be emitted for - * the web page. After you're done with a view, call this function in order to free - * memory and other resources as soon as possible. - */ - destroy(): void; - isDestroyed(): boolean; - setAutoResize(options: AutoResizeOptions): void; - setBackgroundColor(color: string): void; - /** - * Resizes and moves the view to the supplied bounds relative to the window. - */ - setBounds(bounds: Rectangle): void; - id: number; - webContents: WebContents; - } - - class BrowserWindow extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-window - - /** - * Emitted when the window is set or unset to show always on top of other windows. - */ - on(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - once(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - addListener(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - removeListener(event: 'always-on-top-changed', listener: (event: Event, - isAlwaysOnTop: boolean) => void): this; - /** - * Emitted when an App Command is invoked. These are typically related to keyboard - * media keys or browser commands, as well as the "Back" button built into some - * mice on Windows. Commands are lowercased, underscores are replaced with hyphens, - * and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is - * emitted as browser-backward. The following app commands are explictly supported - * on Linux: - */ - on(event: 'app-command', listener: (event: Event, - command: string) => void): this; - once(event: 'app-command', listener: (event: Event, - command: string) => void): this; - addListener(event: 'app-command', listener: (event: Event, - command: string) => void): this; - removeListener(event: 'app-command', listener: (event: Event, - command: string) => void): this; - /** - * Emitted when the window loses focus. - */ - on(event: 'blur', listener: Function): this; - once(event: 'blur', listener: Function): this; - addListener(event: 'blur', listener: Function): this; - removeListener(event: 'blur', listener: Function): this; - /** - * Emitted when the window is going to be closed. It's emitted before the - * beforeunload and unload event of the DOM. Calling event.preventDefault() will - * cancel the close. Usually you would want to use the beforeunload handler to - * decide whether the window should be closed, which will also be called when the - * window is reloaded. In Electron, returning any value other than undefined would - * cancel the close. For example: Note: There is a subtle difference between the - * behaviors of window.onbeforeunload = handler and - * window.addEventListener('beforeunload', handler). It is recommended to always - * set the event.returnValue explicitly, instead of only returning a value, as the - * former works more consistently within Electron. - */ - on(event: 'close', listener: (event: Event) => void): this; - once(event: 'close', listener: (event: Event) => void): this; - addListener(event: 'close', listener: (event: Event) => void): this; - removeListener(event: 'close', listener: (event: Event) => void): this; - /** - * Emitted when the window is closed. After you have received this event you should - * remove the reference to the window and avoid using it any more. - */ - on(event: 'closed', listener: Function): this; - once(event: 'closed', listener: Function): this; - addListener(event: 'closed', listener: Function): this; - removeListener(event: 'closed', listener: Function): this; - /** - * Emitted when the window enters a full-screen state. - */ - on(event: 'enter-full-screen', listener: Function): this; - once(event: 'enter-full-screen', listener: Function): this; - addListener(event: 'enter-full-screen', listener: Function): this; - removeListener(event: 'enter-full-screen', listener: Function): this; - /** - * Emitted when the window enters a full-screen state triggered by HTML API. - */ - on(event: 'enter-html-full-screen', listener: Function): this; - once(event: 'enter-html-full-screen', listener: Function): this; - addListener(event: 'enter-html-full-screen', listener: Function): this; - removeListener(event: 'enter-html-full-screen', listener: Function): this; - /** - * Emitted when the window gains focus. - */ - on(event: 'focus', listener: Function): this; - once(event: 'focus', listener: Function): this; - addListener(event: 'focus', listener: Function): this; - removeListener(event: 'focus', listener: Function): this; - /** - * Emitted when the window is hidden. - */ - on(event: 'hide', listener: Function): this; - once(event: 'hide', listener: Function): this; - addListener(event: 'hide', listener: Function): this; - removeListener(event: 'hide', listener: Function): this; - /** - * Emitted when the window leaves a full-screen state. - */ - on(event: 'leave-full-screen', listener: Function): this; - once(event: 'leave-full-screen', listener: Function): this; - addListener(event: 'leave-full-screen', listener: Function): this; - removeListener(event: 'leave-full-screen', listener: Function): this; - /** - * Emitted when the window leaves a full-screen state triggered by HTML API. - */ - on(event: 'leave-html-full-screen', listener: Function): this; - once(event: 'leave-html-full-screen', listener: Function): this; - addListener(event: 'leave-html-full-screen', listener: Function): this; - removeListener(event: 'leave-html-full-screen', listener: Function): this; - /** - * Emitted when window is maximized. - */ - on(event: 'maximize', listener: Function): this; - once(event: 'maximize', listener: Function): this; - addListener(event: 'maximize', listener: Function): this; - removeListener(event: 'maximize', listener: Function): this; - /** - * Emitted when the window is minimized. - */ - on(event: 'minimize', listener: Function): this; - once(event: 'minimize', listener: Function): this; - addListener(event: 'minimize', listener: Function): this; - removeListener(event: 'minimize', listener: Function): this; - /** - * Emitted when the window is being moved to a new position. Note: On macOS this - * event is an alias of moved. - */ - on(event: 'move', listener: Function): this; - once(event: 'move', listener: Function): this; - addListener(event: 'move', listener: Function): this; - removeListener(event: 'move', listener: Function): this; - /** - * Emitted once when the window is moved to a new position. - */ - on(event: 'moved', listener: Function): this; - once(event: 'moved', listener: Function): this; - addListener(event: 'moved', listener: Function): this; - removeListener(event: 'moved', listener: Function): this; - /** - * Emitted when the native new tab button is clicked. - */ - on(event: 'new-window-for-tab', listener: Function): this; - once(event: 'new-window-for-tab', listener: Function): this; - addListener(event: 'new-window-for-tab', listener: Function): this; - removeListener(event: 'new-window-for-tab', listener: Function): this; - /** - * Emitted when the document changed its title, calling event.preventDefault() will - * prevent the native window's title from changing. explicitSet is false when title - * is synthesized from file url. - */ - on(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - once(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - addListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - removeListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - /** - * Emitted when the web page has been rendered (while not being shown) and window - * can be displayed without a visual flash. - */ - on(event: 'ready-to-show', listener: Function): this; - once(event: 'ready-to-show', listener: Function): this; - addListener(event: 'ready-to-show', listener: Function): this; - removeListener(event: 'ready-to-show', listener: Function): this; - /** - * Emitted after the window has been resized. - */ - on(event: 'resize', listener: Function): this; - once(event: 'resize', listener: Function): this; - addListener(event: 'resize', listener: Function): this; - removeListener(event: 'resize', listener: Function): this; - /** - * Emitted when the unresponsive web page becomes responsive again. - */ - on(event: 'responsive', listener: Function): this; - once(event: 'responsive', listener: Function): this; - addListener(event: 'responsive', listener: Function): this; - removeListener(event: 'responsive', listener: Function): this; - /** - * Emitted when the window is restored from a minimized state. - */ - on(event: 'restore', listener: Function): this; - once(event: 'restore', listener: Function): this; - addListener(event: 'restore', listener: Function): this; - removeListener(event: 'restore', listener: Function): this; - /** - * Emitted when scroll wheel event phase has begun. - */ - on(event: 'scroll-touch-begin', listener: Function): this; - once(event: 'scroll-touch-begin', listener: Function): this; - addListener(event: 'scroll-touch-begin', listener: Function): this; - removeListener(event: 'scroll-touch-begin', listener: Function): this; - /** - * Emitted when scroll wheel event phase filed upon reaching the edge of element. - */ - on(event: 'scroll-touch-edge', listener: Function): this; - once(event: 'scroll-touch-edge', listener: Function): this; - addListener(event: 'scroll-touch-edge', listener: Function): this; - removeListener(event: 'scroll-touch-edge', listener: Function): this; - /** - * Emitted when scroll wheel event phase has ended. - */ - on(event: 'scroll-touch-end', listener: Function): this; - once(event: 'scroll-touch-end', listener: Function): this; - addListener(event: 'scroll-touch-end', listener: Function): this; - removeListener(event: 'scroll-touch-end', listener: Function): this; - /** - * Emitted when window session is going to end due to force shutdown or machine - * restart or session log off. - */ - on(event: 'session-end', listener: Function): this; - once(event: 'session-end', listener: Function): this; - addListener(event: 'session-end', listener: Function): this; - removeListener(event: 'session-end', listener: Function): this; - /** - * Emitted when the window opens a sheet. - */ - on(event: 'sheet-begin', listener: Function): this; - once(event: 'sheet-begin', listener: Function): this; - addListener(event: 'sheet-begin', listener: Function): this; - removeListener(event: 'sheet-begin', listener: Function): this; - /** - * Emitted when the window has closed a sheet. - */ - on(event: 'sheet-end', listener: Function): this; - once(event: 'sheet-end', listener: Function): this; - addListener(event: 'sheet-end', listener: Function): this; - removeListener(event: 'sheet-end', listener: Function): this; - /** - * Emitted when the window is shown. - */ - on(event: 'show', listener: Function): this; - once(event: 'show', listener: Function): this; - addListener(event: 'show', listener: Function): this; - removeListener(event: 'show', listener: Function): this; - /** - * Emitted on 3-finger swipe. Possible directions are up, right, down, left. - */ - on(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - once(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - addListener(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - removeListener(event: 'swipe', listener: (event: Event, - direction: string) => void): this; - /** - * Emitted when the window exits from a maximized state. - */ - on(event: 'unmaximize', listener: Function): this; - once(event: 'unmaximize', listener: Function): this; - addListener(event: 'unmaximize', listener: Function): this; - removeListener(event: 'unmaximize', listener: Function): this; - /** - * Emitted when the web page becomes unresponsive. - */ - on(event: 'unresponsive', listener: Function): this; - once(event: 'unresponsive', listener: Function): this; - addListener(event: 'unresponsive', listener: Function): this; - removeListener(event: 'unresponsive', listener: Function): this; - /** - * Emitted before the window is moved. Calling event.preventDefault() will prevent - * the window from being moved. Note that this is only emitted when the window is - * being resized manually. Resizing the window with setBounds/setSize will not emit - * this event. - */ - on(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - once(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - addListener(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - removeListener(event: 'will-move', listener: (event: Event, - /** - * ` Location the window is being moved to. - */ - newBounds: Rectangle) => void): this; - /** - * Emitted before the window is resized. Calling event.preventDefault() will - * prevent the window from being resized. Note that this is only emitted when the - * window is being resized manually. Resizing the window with setBounds/setSize - * will not emit this event. - */ - on(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - once(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - addListener(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - removeListener(event: 'will-resize', listener: (event: Event, - /** - * ` Size the window is being resized to. - */ - newBounds: Rectangle) => void): this; - constructor(options?: BrowserWindowConstructorOptions); - /** - * Adds DevTools extension located at path, and returns extension's name. The - * extension will be remembered so you only need to call this API once, this API is - * not for programming use. If you try to add an extension that has already been - * loaded, this method will not return and instead log a warning to the console. - * The method will also not return if the extension's manifest is missing or - * incomplete. Note: This API cannot be called before the ready event of the app - * module is emitted. - */ - static addDevToolsExtension(path: string): void; - /** - * Adds Chrome extension located at path, and returns extension's name. The method - * will also not return if the extension's manifest is missing or incomplete. Note: - * This API cannot be called before the ready event of the app module is emitted. - */ - static addExtension(path: string): void; - static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null); - static fromId(id: number): BrowserWindow; - static fromWebContents(webContents: WebContents): BrowserWindow; - static getAllWindows(): BrowserWindow[]; - /** - * To check if a DevTools extension is installed you can run the following: Note: - * This API cannot be called before the ready event of the app module is emitted. - */ - static getDevToolsExtensions(): DevToolsExtensions; - /** - * Note: This API cannot be called before the ready event of the app module is - * emitted. - */ - static getExtensions(): Extensions; - static getFocusedWindow(): (BrowserWindow) | (null); - /** - * Remove a DevTools extension by name. Note: This API cannot be called before the - * ready event of the app module is emitted. - */ - static removeDevToolsExtension(name: string): void; - /** - * Remove a Chrome extension by name. Note: This API cannot be called before the - * ready event of the app module is emitted. - */ - static removeExtension(name: string): void; - /** - * Replacement API for setBrowserView supporting work with multi browser views. - */ - addBrowserView(browserView: BrowserView): void; - /** - * Adds a window as a tab on this window, after the tab for the window instance. - */ - addTabbedWindow(browserWindow: BrowserWindow): void; - /** - * Removes focus from the window. - */ - blur(): void; - blurWebView(): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Moves window to the center of the screen. - */ - center(): void; - /** - * Try to close the window. This has the same effect as a user manually clicking - * the close button of the window. The web page may cancel the close though. See - * the close event. - */ - close(): void; - /** - * Closes the currently open Quick Look panel. - */ - closeFilePreview(): void; - /** - * Force closing the window, the unload and beforeunload event won't be emitted for - * the web page, and close event will also not be emitted for this window, but it - * guarantees the closed event will be emitted. - */ - destroy(): void; - /** - * Starts or stops flashing the window to attract user's attention. - */ - flashFrame(flag: boolean): void; - /** - * Focuses on the window. - */ - focus(): void; - focusOnWebView(): void; - getBounds(): Rectangle; - getBrowserView(): (BrowserView) | (null); - /** - * Returns array of BrowserView what was an attached with addBrowserView or - * setBrowserView. Note: The BrowserView API is currently experimental and may - * change or be removed in future Electron releases. - */ - getBrowserViews(): void; - getChildWindows(): BrowserWindow[]; - getContentBounds(): Rectangle; - getContentSize(): number[]; - getMaximumSize(): number[]; - getMinimumSize(): number[]; - /** - * The native type of the handle is HWND on Windows, NSView* on macOS, and Window - * (unsigned long) on Linux. - */ - getNativeWindowHandle(): Buffer; - /** - * Note: whatever the current state of the window : maximized, minimized or in - * fullscreen, this function always returns the position and size of the window in - * normal state. In normal state, getBounds and getNormalBounds returns the same - * Rectangle. - */ - getNormalBounds(): Rectangle; - getOpacity(): number; - getParentWindow(): BrowserWindow; - getPosition(): number[]; - getRepresentedFilename(): string; - getSize(): number[]; - /** - * Note: The title of the web page can be different from the title of the native - * window. - */ - getTitle(): string; - hasShadow(): boolean; - /** - * Hides the window. - */ - hide(): void; - /** - * Hooks a windows message. The callback is called when the message is received in - * the WndProc. - */ - hookWindowMessage(message: number, callback: Function): void; - isAlwaysOnTop(): boolean; - /** - * On Linux always returns true. - */ - isClosable(): boolean; - isDestroyed(): boolean; - isDocumentEdited(): boolean; - isFocused(): boolean; - isFullScreen(): boolean; - isFullScreenable(): boolean; - isKiosk(): boolean; - /** - * On Linux always returns true. - */ - isMaximizable(): boolean; - isMaximized(): boolean; - isMenuBarAutoHide(): boolean; - isMenuBarVisible(): boolean; - /** - * On Linux always returns true. - */ - isMinimizable(): boolean; - isMinimized(): boolean; - isModal(): boolean; - /** - * On Linux always returns true. - */ - isMovable(): boolean; - isNormal(): boolean; - isResizable(): boolean; - isSimpleFullScreen(): boolean; - isVisible(): boolean; - /** - * Note: This API always returns false on Windows. - */ - isVisibleOnAllWorkspaces(): boolean; - isWindowMessageHooked(message: number): boolean; - /** - * Same as webContents.loadFile, filePath should be a path to an HTML file relative - * to the root of your application. See the webContents docs for more information. - */ - loadFile(filePath: string, options?: LoadFileOptions): Promise; - /** - * Same as webContents.loadURL(url[, options]). The url can be a remote address - * (e.g. http://) or a path to a local HTML file using the file:// protocol. To - * ensure that file URLs are properly formatted, it is recommended to use Node's - * url.format method: You can load a URL using a POST request with URL-encoded data - * by doing the following: - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Maximizes the window. This will also show (but not focus) the window if it isn't - * being displayed already. - */ - maximize(): void; - /** - * Merges all windows into one window with multiple tabs when native tabs are - * enabled and there is more than one open window. - */ - mergeAllWindows(): void; - /** - * Minimizes the window. On some platforms the minimized window will be shown in - * the Dock. - */ - minimize(): void; - /** - * Moves the current tab into a new window if native tabs are enabled and there is - * more than one tab in the current window. - */ - moveTabToNewWindow(): void; - /** - * Moves window to top(z-order) regardless of focus - */ - moveTop(): void; - /** - * Uses Quick Look to preview a file at a given path. - */ - previewFile(path: string, displayName?: string): void; - /** - * Same as webContents.reload. - */ - reload(): void; - removeBrowserView(browserView: BrowserView): void; - /** - * Remove the window's menu bar. - */ - removeMenu(): void; - /** - * Restores the window from minimized state to its previous state. - */ - restore(): void; - /** - * Selects the next tab when native tabs are enabled and there are other tabs in - * the window. - */ - selectNextTab(): void; - /** - * Selects the previous tab when native tabs are enabled and there are other tabs - * in the window. - */ - selectPreviousTab(): void; - /** - * Sets whether the window should show always on top of other windows. After - * setting this, the window is still a normal window, not a toolbox window which - * can not be focused on. - */ - setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void; - /** - * Sets the properties for the window's taskbar button. Note: relaunchCommand and - * relaunchDisplayName must always be set together. If one of those properties is - * not set, then neither will be used. - */ - setAppDetails(options: AppDetailsOptions): void; - /** - * This will make a window maintain an aspect ratio. The extra size allows a - * developer to have space, specified in pixels, not included within the aspect - * ratio calculations. This API already takes into account the difference between a - * window's size and its content size. Consider a normal window with an HD video - * player and associated controls. Perhaps there are 15 pixels of controls on the - * left edge, 25 pixels of controls on the right edge and 50 pixels of controls - * below the player. In order to maintain a 16:9 aspect ratio (standard aspect - * ratio for HD @1920x1080) within the player itself we would call this function - * with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where - * the extra width and height are within the content view--only that they exist. - * Sum any extra width and height areas you have within the overall content view. - * Calling this function with a value of 0 will remove any previously set aspect - * ratios. - */ - setAspectRatio(aspectRatio: number, extraSize: Size): void; - /** - * Controls whether to hide cursor when typing. - */ - setAutoHideCursor(autoHide: boolean): void; - /** - * Sets whether the window menu bar should hide itself automatically. Once set the - * menu bar will only show when users press the single Alt key. If the menu bar is - * already visible, calling setAutoHideMenuBar(true) won't hide it immediately. - */ - setAutoHideMenuBar(hide: boolean): void; - /** - * Sets the background color of the window. See Setting backgroundColor. - */ - setBackgroundColor(backgroundColor: string): void; - /** - * Resizes and moves the window to the supplied bounds. Any properties that are not - * supplied will default to their current values. - */ - setBounds(bounds: Rectangle, animate?: boolean): void; - setBrowserView(browserView: BrowserView): void; - /** - * Sets whether the window can be manually closed by user. On Linux does nothing. - */ - setClosable(closable: boolean): void; - /** - * Resizes and moves the window's client area (e.g. the web page) to the supplied - * bounds. - */ - setContentBounds(bounds: Rectangle, animate?: boolean): void; - /** - * Prevents the window contents from being captured by other apps. On macOS it sets - * the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls - * SetWindowDisplayAffinity with WDA_MONITOR. - */ - setContentProtection(enable: boolean): void; - /** - * Resizes the window's client area (e.g. the web page) to width and height. - */ - setContentSize(width: number, height: number, animate?: boolean): void; - /** - * Specifies whether the window’s document has been edited, and the icon in title - * bar will become gray when set to true. - */ - setDocumentEdited(edited: boolean): void; - /** - * Disable or enable the window. - */ - setEnabled(enable: boolean): void; - /** - * Changes whether the window can be focused. - */ - setFocusable(focusable: boolean): void; - /** - * Sets whether the window should be in fullscreen mode. - */ - setFullScreen(flag: boolean): void; - /** - * Sets whether the maximize/zoom window button toggles fullscreen mode or - * maximizes the window. - */ - setFullScreenable(fullscreenable: boolean): void; - /** - * Sets whether the window should have a shadow. - */ - setHasShadow(hasShadow: boolean): void; - /** - * Changes window icon. - */ - setIcon(icon: NativeImage): void; - /** - * Makes the window ignore all mouse events. All mouse events happened in this - * window will be passed to the window below this window, but if this window has - * focus, it will still receive keyboard events. - */ - setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void; - /** - * Enters or leaves the kiosk mode. - */ - setKiosk(flag: boolean): void; - /** - * Sets whether the window can be manually maximized by user. On Linux does - * nothing. - */ - setMaximizable(maximizable: boolean): void; - /** - * Sets the maximum size of window to width and height. - */ - setMaximumSize(width: number, height: number): void; - /** - * Sets the menu as the window's menu bar. - */ - setMenu(menu: (Menu) | (null)): void; - /** - * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users - * can still bring up the menu bar by pressing the single Alt key. - */ - setMenuBarVisibility(visible: boolean): void; - /** - * Sets whether the window can be manually minimized by user. On Linux does - * nothing. - */ - setMinimizable(minimizable: boolean): void; - /** - * Sets the minimum size of window to width and height. - */ - setMinimumSize(width: number, height: number): void; - /** - * Sets whether the window can be moved by user. On Linux does nothing. - */ - setMovable(movable: boolean): void; - /** - * Sets the opacity of the window. On Linux does nothing. - */ - setOpacity(opacity: number): void; - /** - * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to - * convey some sort of application status or to passively notify the user. - */ - setOverlayIcon(overlay: (NativeImage) | (null), description: string): void; - /** - * Sets parent as current window's parent window, passing null will turn current - * window into a top-level window. - */ - setParentWindow(parent: BrowserWindow): void; - /** - * Moves window to x and y. - */ - setPosition(x: number, y: number, animate?: boolean): void; - /** - * Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress - * bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux - * platform, only supports Unity desktop environment, you need to specify the - * *.desktop file name to desktopName field in package.json. By default, it will - * assume app.getName().desktop. On Windows, a mode can be passed. Accepted values - * are none, normal, indeterminate, error, and paused. If you call setProgressBar - * without a mode set (but with a value within the valid range), normal will be - * assumed. - */ - setProgressBar(progress: number, options?: ProgressBarOptions): void; - /** - * Sets the pathname of the file the window represents, and the icon of the file - * will show in window's title bar. - */ - setRepresentedFilename(filename: string): void; - /** - * Sets whether the window can be manually resized by user. - */ - setResizable(resizable: boolean): void; - /** - * Setting a window shape determines the area within the window where the system - * permits drawing and user interaction. Outside of the given region, no pixels - * will be drawn and no mouse events will be registered. Mouse events outside of - * the region will not be received by that window, but will fall through to - * whatever is behind the window. - */ - setShape(rects: Rectangle[]): void; - /** - * Changes the attachment point for sheets on macOS. By default, sheets are - * attached just below the window frame, but you may want to display them beneath a - * HTML-rendered toolbar. For example: - */ - setSheetOffset(offsetY: number, offsetX?: number): void; - /** - * Enters or leaves simple fullscreen mode. Simple fullscreen mode emulates the - * native fullscreen behavior found in versions of Mac OS X prior to Lion (10.7). - */ - setSimpleFullScreen(flag: boolean): void; - /** - * Resizes the window to width and height. If width or height are below any set - * minimum size constraints the window will snap to its minimum size. - */ - setSize(width: number, height: number, animate?: boolean): void; - /** - * Makes the window not show in the taskbar. - */ - setSkipTaskbar(skip: boolean): void; - /** - * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image - * of a window in a taskbar button layout. Returns a Boolean object indicates - * whether the thumbnail has been added successfully. The number of buttons in - * thumbnail toolbar should be no greater than 7 due to the limited room. Once you - * setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's - * limitation. But you can call the API with an empty array to clean the buttons. - * The buttons is an array of Button objects: The flags is an array that can - * include following Strings: - */ - setThumbarButtons(buttons: ThumbarButton[]): boolean; - /** - * Sets the region of the window to show as the thumbnail image displayed when - * hovering over the window in the taskbar. You can reset the thumbnail to be the - * entire window by specifying an empty region: { x: 0, y: 0, width: 0, height: 0 - * }. - */ - setThumbnailClip(region: Rectangle): void; - /** - * Sets the toolTip that is displayed when hovering over the window thumbnail in - * the taskbar. - */ - setThumbnailToolTip(toolTip: string): void; - /** - * Changes the title of native window to title. - */ - setTitle(title: string): void; - /** - * Sets the touchBar layout for the current window. Specifying null or undefined - * clears the touch bar. This method only has an effect if the machine has a touch - * bar and is running on macOS 10.12.1+. Note: The TouchBar API is currently - * experimental and may change or be removed in future Electron releases. - */ - setTouchBar(touchBar: TouchBar): void; - /** - * Adds a vibrancy effect to the browser window. Passing null or an empty string - * will remove the vibrancy effect on the window. - */ - setVibrancy(type: 'appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'): void; - /** - * Sets whether the window should be visible on all workspaces. Note: This API does - * nothing on Windows. - */ - setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void; - /** - * Sets whether the window traffic light buttons should be visible. This cannot be - * called when titleBarStyle is set to customButtonsOnHover. - */ - setWindowButtonVisibility(visible: boolean): void; - /** - * Shows and gives focus to the window. - */ - show(): void; - /** - * Same as webContents.showDefinitionForSelection(). - */ - showDefinitionForSelection(): void; - /** - * Shows the window but doesn't focus on it. - */ - showInactive(): void; - /** - * Toggles the visibility of the tab bar if native tabs are enabled and there is - * only one tab in the current window. - */ - toggleTabBar(): void; - /** - * Unhooks all of the window messages. - */ - unhookAllWindowMessages(): void; - /** - * Unhook the window message. - */ - unhookWindowMessage(message: number): void; - /** - * Unmaximizes the window. - */ - unmaximize(): void; - id: number; - webContents: WebContents; - } - - class BrowserWindowProxy extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/browser-window-proxy - - /** - * Removes focus from the child window. - */ - blur(): void; - /** - * Forcefully closes the child window without calling its unload event. - */ - close(): void; - /** - * Evaluates the code in the child window. - */ - eval(code: string): void; - /** - * Focuses the child window (brings the window to front). - */ - focus(): void; - /** - * Sends a message to the child window with the specified origin or * for no origin - * preference. In addition to these methods, the child window implements - * window.opener object with no properties and a single method. - */ - postMessage(message: string, targetOrigin: string): void; - /** - * Invokes the print dialog on the child window. - */ - print(): void; - closed: boolean; - } - - interface Certificate { - - // Docs: http://electronjs.org/docs/api/structures/certificate - - /** - * PEM encoded data - */ - data: string; - /** - * Fingerprint of the certificate - */ - fingerprint: string; - /** - * Issuer principal - */ - issuer: CertificatePrincipal; - /** - * Issuer certificate (if not self-signed) - */ - issuerCert: Certificate; - /** - * Issuer's Common Name - */ - issuerName: string; - /** - * Hex value represented string - */ - serialNumber: string; - /** - * Subject principal - */ - subject: CertificatePrincipal; - /** - * Subject's Common Name - */ - subjectName: string; - /** - * End date of the certificate being valid in seconds - */ - validExpiry: number; - /** - * Start date of the certificate being valid in seconds - */ - validStart: number; - } - - interface CertificatePrincipal { - - // Docs: http://electronjs.org/docs/api/structures/certificate-principal - - /** - * Common Name. - */ - commonName: string; - /** - * Country or region. - */ - country: string; - /** - * Locality. - */ - locality: string; - /** - * Organization names. - */ - organizations: string[]; - /** - * Organization Unit names. - */ - organizationUnits: string[]; - /** - * State or province. - */ - state: string; - } - - class ClientRequest extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/client-request - - /** - * Emitted when the request is aborted. The abort event will not be fired if the - * request is already closed. - */ - on(event: 'abort', listener: Function): this; - once(event: 'abort', listener: Function): this; - addListener(event: 'abort', listener: Function): this; - removeListener(event: 'abort', listener: Function): this; - /** - * Emitted as the last event in the HTTP request-response transaction. The close - * event indicates that no more events will be emitted on either the request or - * response objects. - */ - on(event: 'close', listener: Function): this; - once(event: 'close', listener: Function): this; - addListener(event: 'close', listener: Function): this; - removeListener(event: 'close', listener: Function): this; - /** - * Emitted when the net module fails to issue a network request. Typically when the - * request object emits an error event, a close event will subsequently follow and - * no response object will be provided. - */ - on(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - once(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - addListener(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - removeListener(event: 'error', listener: ( - /** - * an error object providing some information about the failure. - */ - error: Error) => void): this; - /** - * Emitted just after the last chunk of the request's data has been written into - * the request object. - */ - on(event: 'finish', listener: Function): this; - once(event: 'finish', listener: Function): this; - addListener(event: 'finish', listener: Function): this; - removeListener(event: 'finish', listener: Function): this; - /** - * Emitted when an authenticating proxy is asking for user credentials. The - * callback function is expected to be called back with user credentials: Providing - * empty credentials will cancel the request and report an authentication error on - * the response object: - */ - on(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when there is redirection and the mode is manual. Calling - * request.followRedirect will continue with the redirection. - */ - on(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - once(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - addListener(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - removeListener(event: 'redirect', listener: (statusCode: number, - method: string, - redirectUrl: string, - responseHeaders: any) => void): this; - on(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - once(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - addListener(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - removeListener(event: 'response', listener: ( - /** - * An object representing the HTTP response message. - */ - response: IncomingMessage) => void): this; - constructor(options: 'method' | 'url' | 'session' | 'partition' | 'protocol' | 'host' | 'hostname' | 'port' | 'path' | 'redirect'); - /** - * Cancels an ongoing HTTP transaction. If the request has already emitted the - * close event, the abort operation will have no effect. Otherwise an ongoing event - * will emit abort and close events. Additionally, if there is an ongoing response - * object,it will emit the aborted event. - */ - abort(): void; - /** - * Sends the last chunk of the request data. Subsequent write or end operations - * will not be allowed. The finish event is emitted just after the end operation. - */ - end(chunk?: (string) | (Buffer), encoding?: string, callback?: Function): void; - /** - * Continues any deferred redirection request when the redirection mode is manual. - */ - followRedirect(): void; - getHeader(name: string): Header; - /** - * You can use this method in conjunction with POST requests to get the progress of - * a file upload or other data transfer. - */ - getUploadProgress(): UploadProgress; - /** - * Removes a previously set extra header name. This method can be called only - * before first write. Trying to call it after the first write will throw an error. - */ - removeHeader(name: string): void; - /** - * Adds an extra HTTP header. The header name will issued as it is without - * lowercasing. It can be called only before first write. Calling this method after - * the first write will throw an error. If the passed value is not a String, its - * toString() method will be called to obtain the final value. - */ - setHeader(name: string, value: any): void; - /** - * callback is essentially a dummy function introduced in the purpose of keeping - * similarity with the Node.js API. It is called asynchronously in the next tick - * after chunk content have been delivered to the Chromium networking layer. - * Contrary to the Node.js implementation, it is not guaranteed that chunk content - * have been flushed on the wire before callback is called. Adds a chunk of data to - * the request body. The first write operation may cause the request headers to be - * issued on the wire. After the first write operation, it is not allowed to add or - * remove a custom header. - */ - write(chunk: (string) | (Buffer), encoding?: string, callback?: Function): void; - chunkedEncoding: boolean; - } - - interface Clipboard extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/clipboard - - availableFormats(type?: 'selection' | 'clipboard'): string[]; - /** - * Clears the clipboard content. - */ - clear(type?: 'selection' | 'clipboard'): void; - has(format: string, type?: 'selection' | 'clipboard'): boolean; - read(format: string): string; - /** - * Returns an Object containing title and url keys representing the bookmark in the - * clipboard. The title and url values will be empty strings when the bookmark is - * unavailable. - */ - readBookmark(): ReadBookmark; - readBuffer(format: string): Buffer; - /** - * This method uses synchronous IPC when called from the renderer process. The - * cached value is reread from the find pasteboard whenever the application is - * activated. - */ - readFindText(): string; - readHTML(type?: 'selection' | 'clipboard'): string; - readImage(type?: 'selection' | 'clipboard'): NativeImage; - readRTF(type?: 'selection' | 'clipboard'): string; - readText(type?: 'selection' | 'clipboard'): string; - /** - * Writes data to the clipboard. - */ - write(data: Data, type?: 'selection' | 'clipboard'): void; - /** - * Writes the title and url into the clipboard as a bookmark. Note: Most apps on - * Windows don't support pasting bookmarks into them so you can use clipboard.write - * to write both a bookmark and fallback text to the clipboard. - */ - writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes the buffer into the clipboard as format. - */ - writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the find pasteboard (the pasteboard that holds information - * about the current state of the active application’s find panel) as plain text. - * This method uses synchronous IPC when called from the renderer process. - */ - writeFindText(text: string): void; - /** - * Writes markup to the clipboard. - */ - writeHTML(markup: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes image to the clipboard. - */ - writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the clipboard in RTF. - */ - writeRTF(text: string, type?: 'selection' | 'clipboard'): void; - /** - * Writes the text into the clipboard as plain text. - */ - writeText(text: string, type?: 'selection' | 'clipboard'): void; - } - - interface ContentTracing extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/content-tracing - - /** - * Get a set of category groups. The category groups can change as new code paths - * are reached. Once all child processes have acknowledged the getCategories - * request the callback is invoked with an array of category groups. Deprecated - * Soon - */ - getCategories(callback: (categories: string[]) => void): void; - /** - * Get a set of category groups. The category groups can change as new code paths - * are reached. - */ - getCategories(): Promise; - /** - * Get the maximum usage across processes of trace buffer as a percentage of the - * full state. When the TraceBufferUsage value is determined the callback is - * called. Deprecated Soon - */ - getTraceBufferUsage(callback: (value: number) => void): void; - /** - * Get the maximum usage across processes of trace buffer as a percentage of the - * full state. - */ - getTraceBufferUsage(): Promise; - /** - * Start recording on all processes. Recording begins immediately locally and - * asynchronously on child processes as soon as they receive the EnableRecording - * request. The callback will be called once all child processes have acknowledged - * the startRecording request. Deprecated Soon - */ - startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig), callback: Function): void; - /** - * Start recording on all processes. Recording begins immediately locally and - * asynchronously on child processes as soon as they receive the EnableRecording - * request. - */ - startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig)): Promise; - /** - * Stop recording on all processes. Child processes typically cache trace data and - * only rarely flush and send trace data back to the main process. This helps to - * minimize the runtime overhead of tracing since sending trace data over IPC can - * be an expensive operation. So, to end tracing, we must asynchronously ask all - * child processes to flush any pending trace data. Once all child processes have - * acknowledged the stopRecording request, callback will be called with a file that - * contains the traced data. Trace data will be written into resultFilePath if it - * is not empty or into a temporary file. The actual file path will be passed to - * callback if it's not null. Deprecated Soon - */ - stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void; - /** - * Stop recording on all processes. Child processes typically cache trace data and - * only rarely flush and send trace data back to the main process. This helps to - * minimize the runtime overhead of tracing since sending trace data over IPC can - * be an expensive operation. So, to end tracing, we must asynchronously ask all - * child processes to flush any pending trace data. Trace data will be written into - * resultFilePath if it is not empty or into a temporary file. - */ - stopRecording(resultFilePath: string): Promise; - } - - interface ContextBridge extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/context-bridge - - exposeInMainWorld(apiKey: string, api: Record): void; - } - - interface Cookie { - - // Docs: http://electronjs.org/docs/api/structures/cookie - - /** - * The domain of the cookie; this will be normalized with a preceding dot so that - * it's also valid for subdomains. - */ - domain?: string; - /** - * The expiration date of the cookie as the number of seconds since the UNIX epoch. - * Not provided for session cookies. - */ - expirationDate?: number; - /** - * Whether the cookie is a host-only cookie; this will only be true if no domain - * was passed. - */ - hostOnly?: boolean; - /** - * Whether the cookie is marked as HTTP only. - */ - httpOnly?: boolean; - /** - * The name of the cookie. - */ - name: string; - /** - * The path of the cookie. - */ - path?: string; - /** - * Whether the cookie is marked as secure. - */ - secure?: boolean; - /** - * Whether the cookie is a session cookie or a persistent cookie with an expiration - * date. - */ - session?: boolean; - /** - * The value of the cookie. - */ - value: string; - } - - class Cookies extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/cookies - - /** - * Emitted when a cookie is changed because it was added, edited, removed, or - * expired. - */ - on(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - once(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - addListener(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - removeListener(event: 'changed', listener: (event: Event, - /** - * The cookie that was changed. - */ - cookie: Cookie, - /** - * The cause of the change with one of the following values: - */ - cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'), - /** - * `true` if the cookie was removed, `false` otherwise. - */ - removed: boolean) => void): this; - /** - * Writes any unwritten cookies data to disk. - */ - flushStore(): Promise; - /** - * Writes any unwritten cookies data to disk. Deprecated Soon - */ - flushStore(callback: Function): void; - /** - * Sends a request to get all cookies matching filter, and resolves a promise with - * the response. - */ - get(filter: Filter): Promise; - /** - * Sends a request to get all cookies matching filter, callback will be called with - * callback(error, cookies) on complete. Deprecated Soon - */ - get(filter: Filter, callback: (error: Error, cookies: Cookie[]) => void): void; - /** - * Removes the cookies matching url and name - */ - remove(url: string, name: string): Promise; - /** - * Removes the cookies matching url and name, callback will called with callback() - * on complete. Deprecated Soon - */ - remove(url: string, name: string, callback: Function): void; - /** - * Sets a cookie with details. - */ - set(details: Details): Promise; - /** - * Sets a cookie with details, callback will be called with callback(error) on - * complete. Deprecated Soon - */ - set(details: Details, callback: (error: Error) => void): void; - } - - interface CPUUsage { - - // Docs: http://electronjs.org/docs/api/structures/cpu-usage - - /** - * The number of average idle cpu wakeups per second since the last call to - * getCPUUsage. First call returns 0. Will always return 0 on Windows. - */ - idleWakeupsPerSecond: number; - /** - * Percentage of CPU used since the last call to getCPUUsage. First call returns 0. - */ - percentCPUUsage: number; - } - - interface CrashReport { - - // Docs: http://electronjs.org/docs/api/structures/crash-report - - date: Date; - id: string; - } - - interface CrashReporter { - - // Docs: http://electronjs.org/docs/api/crash-reporter - - /** - * Set an extra parameter to be sent with the crash report. The values specified - * here will be sent in addition to any values set via the extra option when start - * was called. This API is only available on macOS and windows, if you need to - * add/update extra parameters on Linux after your first call to start you can call - * start again with the updated extra options. - */ - addExtraParameter(key: string, value: string): void; - /** - * Returns the date and ID of the last crash report. Only crash reports that have - * been uploaded will be returned; even if a crash report is present on disk it - * will not be returned until it is uploaded. In the case that there are no - * uploaded reports, null is returned. - */ - getLastCrashReport(): CrashReport; - /** - * See all of the current parameters being passed to the crash reporter. - */ - getParameters(): void; - /** - * Returns all uploaded crash reports. Each report contains the date and uploaded - * ID. - */ - getUploadedReports(): CrashReport[]; - /** - * Note: This API can only be called from the main process. - */ - getUploadToServer(): boolean; - /** - * Remove a extra parameter from the current set of parameters so that it will not - * be sent with the crash report. - */ - removeExtraParameter(key: string): void; - /** - * This would normally be controlled by user preferences. This has no effect if - * called before start is called. Note: This API can only be called from the main - * process. - */ - setUploadToServer(uploadToServer: boolean): void; - /** - * You are required to call this method before using any other crashReporter APIs - * and in each process (main/renderer) from which you want to collect crash - * reports. You can pass different options to crashReporter.start when calling from - * different processes. Note Child processes created via the child_process module - * will not have access to the Electron modules. Therefore, to collect crash - * reports from them, use process.crashReporter.start instead. Pass the same - * options as above along with an additional one called crashesDirectory that - * should point to a directory to store the crash reports temporarily. You can test - * this out by calling process.crash() to crash the child process. Note: If you - * need send additional/updated extra parameters after your first call start you - * can call addExtraParameter on macOS or call start again with the new/updated - * extra parameters on Linux and Windows. Note: On macOS and windows, Electron uses - * a new crashpad client for crash collection and reporting. If you want to enable - * crash reporting, initializing crashpad from the main process using - * crashReporter.start is required regardless of which process you want to collect - * crashes from. Once initialized this way, the crashpad handler collects crashes - * from all processes. You still have to call crashReporter.start from the renderer - * or child process, otherwise crashes from them will get reported without - * companyName, productName or any of the extra information. - */ - start(options: CrashReporterStartOptions): void; - } - - interface CustomScheme { - - // Docs: http://electronjs.org/docs/api/structures/custom-scheme - - privileges?: Privileges; - /** - * Custom schemes to be registered with options. - */ - scheme: string; - } - - class Debugger extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/debugger - - /** - * Emitted when debugging session is terminated. This happens either when - * webContents is closed or devtools is invoked for the attached webContents. - */ - on(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - once(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - addListener(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - removeListener(event: 'detach', listener: (event: Event, - /** - * Reason for detaching debugger. - */ - reason: string) => void): this; - /** - * Emitted whenever debugging target issues instrumentation event. - */ - on(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - once(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - addListener(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - removeListener(event: 'message', listener: (event: Event, - /** - * Method name. - */ - method: string, - /** - * Event parameters defined by the 'parameters' attribute in the remote debugging - * protocol. - */ - params: any) => void): this; - /** - * Attaches the debugger to the webContents. - */ - attach(protocolVersion?: string): void; - /** - * Detaches the debugger from the webContents. - */ - detach(): void; - isAttached(): boolean; - /** - * Send given command to the debugging target. Deprecated Soon - */ - sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void; - /** - * Send given command to the debugging target. - */ - sendCommand(method: string, commandParams?: any): Promise; - } - - interface DesktopCapturer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/desktop-capturer - - /** - * Starts gathering information about all available desktop media sources, and - * calls callback(error, sources) when finished. sources is an array of - * DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or - * an individual window that can be captured. Deprecated Soon - */ - getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void; - getSources(options: SourcesOptions): Promise; - } - - interface DesktopCapturerSource { - - // Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source - - /** - * An icon image of the application that owns the window or null if the source has - * a type screen. The size of the icon is not known in advance and depends on what - * the the application provides. - */ - appIcon: NativeImage; - /** - * A unique identifier that will correspond to the id of the matching returned by - * the . On some platforms, this is equivalent to the XX portion of the id field - * above and on others it will differ. It will be an empty string if not available. - */ - display_id: string; - /** - * The identifier of a window or screen that can be used as a chromeMediaSourceId - * constraint when calling [navigator.webkitGetUserMedia]. The format of the - * identifier will be window:XX or screen:XX, where XX is a random generated - * number. - */ - id: string; - /** - * A screen source will be named either Entire Screen or Screen , while the name of - * a window source will match the window title. - */ - name: string; - /** - * A thumbnail image. There is no guarantee that the size of the thumbnail is the - * same as the thumbnailSize specified in the options passed to - * desktopCapturer.getSources. The actual size depends on the scale of the screen - * or window. - */ - thumbnail: NativeImage; - } - - interface Dialog extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/dialog - - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: - */ - showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(options: CertificateTrustDialogOptions, callback: Function): void; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise; - /** - * On macOS, this displays a modal dialog that shows a message and certificate - * information, and gives the user the option of trusting/importing the - * certificate. If you provide a browserWindow argument the dialog will be attached - * to the parent window, making it modal. On Windows the options are more limited, - * due to the Win32 APIs used: Deprecated Soon - */ - showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void; - /** - * Displays a modal dialog that shows an error message. This API can be called - * safely before the ready event the app module emits, it is usually used to report - * errors in early stage of startup. If called before the app readyevent on Linux, - * the message will be emitted to stderr, and no GUI dialog will appear. - */ - showErrorBox(title: string, content: string): void; - /** - * Shows a message box, it will block the process until the message box is closed. - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. - */ - showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise; - /** - * Shows a message box, it will block the process until the message box is closed. - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. - */ - showMessageBox(options: MessageBoxOptions): Promise; - /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. The browserWindow argument allows - * the dialog to attach itself to a parent window, making it modal. - */ - showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number; - /** - * Shows a message box, it will block the process until the message box is closed. - * It returns the index of the clicked button. The browserWindow argument allows - * the dialog to attach itself to a parent window, making it modal. - */ - showMessageBoxSync(options: MessageBoxSyncOptions): number; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: Function): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialog(options: OpenDialogOptions, callback?: Function): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed or selected when you want to limit the user to a specific type. For - * example: The extensions array should contain extensions without wildcards or - * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use - * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an - * open dialog can not be both a file selector and a directory selector, so if you - * set properties to ['openFile', 'openDirectory'] on these platforms, a directory - * selector will be shown. - */ - showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using - * the asynchronous version is recommended to avoid issues when expanding and - * collapsing the dialog. - */ - showSaveDialog(options: SaveDialogOptions): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using - * the asynchronous version is recommended to avoid issues when expanding and - * collapsing the dialog. - */ - showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise; - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. - */ - showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined); - /** - * The browserWindow argument allows the dialog to attach itself to a parent - * window, making it modal. The filters specifies an array of file types that can - * be displayed, see dialog.showOpenDialog for an example. - */ - showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined); - } - - interface Display { - - // Docs: http://electronjs.org/docs/api/structures/display - - /** - * Can be available, unavailable, unknown. - */ - accelerometerSupport: ('available' | 'unavailable' | 'unknown'); - bounds: Rectangle; - /** - * The number of bits per pixel. - */ - colorDepth: number; - /** - * represent a color space (three-dimensional object which contains all realizable - * color combinations) for the purpose of color conversions - */ - colorSpace: string; - /** - * The number of bits per color component. - */ - depthPerComponent: number; - /** - * Unique identifier associated with the display. - */ - id: number; - /** - * true for an internal display and false for an external display - */ - internal: boolean; - /** - * Whether or not the display is a monochrome display. - */ - monochrome: boolean; - /** - * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. - */ - rotation: number; - /** - * Output device's pixel scale factor. - */ - scaleFactor: number; - size: Size; - /** - * Can be available, unavailable, unknown. - */ - touchSupport: ('available' | 'unavailable' | 'unknown'); - workArea: Rectangle; - workAreaSize: Size; - } - - class DownloadItem extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/download-item - - /** - * Emitted when the download is in a terminal state. This includes a completed - * download, a cancelled download (via downloadItem.cancel()), and interrupted - * download that can't be resumed. The state can be one of following: - */ - on(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - once(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - addListener(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - removeListener(event: 'done', listener: (event: Event, - /** - * Can be `completed`, `cancelled` or `interrupted`. - */ - state: ('completed' | 'cancelled' | 'interrupted')) => void): this; - /** - * Emitted when the download has been updated and is not done. The state can be one - * of following: - */ - on(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - once(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - addListener(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - removeListener(event: 'updated', listener: (event: Event, - /** - * Can be `progressing` or `interrupted`. - */ - state: ('progressing' | 'interrupted')) => void): this; - /** - * Cancels the download operation. - */ - cancel(): void; - canResume(): boolean; - getContentDisposition(): string; - getETag(): string; - /** - * Note: The file name is not always the same as the actual one saved in local - * disk. If user changes the file name in a prompted download saving dialog, the - * actual name of saved file will be different. - */ - getFilename(): string; - getLastModifiedTime(): string; - getMimeType(): string; - getReceivedBytes(): number; - getSaveDialogOptions(): SaveDialogOptions; - getSavePath(): string; - getStartTime(): number; - /** - * Note: The following methods are useful specifically to resume a cancelled item - * when session is restarted. - */ - getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted'); - /** - * If the size is unknown, it returns 0. - */ - getTotalBytes(): number; - getURL(): string; - getURLChain(): string[]; - hasUserGesture(): boolean; - isPaused(): boolean; - /** - * Pauses the download. - */ - pause(): void; - /** - * Resumes the download that has been paused. Note: To enable resumable downloads - * the server you are downloading from must support range requests and provide both - * Last-Modified and ETag header values. Otherwise resume() will dismiss previously - * received bytes and restart the download from the beginning. - */ - resume(): void; - /** - * This API allows the user to set custom options for the save dialog that opens - * for the download item by default. The API is only available in session's - * will-download callback function. - */ - setSaveDialogOptions(options: SaveDialogOptions): void; - /** - * The API is only available in session's will-download callback function. If user - * doesn't set the save path via the API, Electron will use the original routine to - * determine the save path(Usually prompts a save dialog). - */ - setSavePath(path: string): void; - } - - interface Event extends GlobalEvent { - - // Docs: http://electronjs.org/docs/api/structures/event - - preventDefault: (() => void); - } - - interface FileFilter { - - // Docs: http://electronjs.org/docs/api/structures/file-filter - - extensions: string[]; - name: string; - } - - interface GlobalShortcut extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/global-shortcut - - /** - * When the accelerator is already taken by other applications, this call will - * still return false. This behavior is intended by operating systems, since they - * don't want applications to fight for global shortcuts. - */ - isRegistered(accelerator: Accelerator): boolean; - /** - * Registers a global shortcut of accelerator. The callback is called when the - * registered shortcut is pressed by the user. When the accelerator is already - * taken by other applications, this call will silently fail. This behavior is - * intended by operating systems, since they don't want applications to fight for - * global shortcuts. The following accelerators will not be registered successfully - * on macOS 10.14 Mojave unless the app has been authorized as a trusted - * accessibility client: - */ - register(accelerator: Accelerator, callback: Function): boolean; - /** - * Registers a global shortcut of all accelerator items in accelerators. The - * callback is called when any of the registered shortcuts are pressed by the user. - * When a given accelerator is already taken by other applications, this call will - * silently fail. This behavior is intended by operating systems, since they don't - * want applications to fight for global shortcuts. The following accelerators will - * not be registered successfully on macOS 10.14 Mojave unless the app has been - * authorized as a trusted accessibility client: - */ - registerAll(accelerators: string[], callback: Function): void; - /** - * Unregisters the global shortcut of accelerator. - */ - unregister(accelerator: Accelerator): void; - /** - * Unregisters all of the global shortcuts. - */ - unregisterAll(): void; - } - - interface GPUFeatureStatus { - - // Docs: http://electronjs.org/docs/api/structures/gpu-feature-status - - /** - * Canvas. - */ - '2d_canvas': string; - /** - * Flash. - */ - flash_3d: string; - /** - * Flash Stage3D. - */ - flash_stage3d: string; - /** - * Flash Stage3D Baseline profile. - */ - flash_stage3d_baseline: string; - /** - * Compositing. - */ - gpu_compositing: string; - /** - * Multiple Raster Threads. - */ - multiple_raster_threads: string; - /** - * Native GpuMemoryBuffers. - */ - native_gpu_memory_buffers: string; - /** - * Rasterization. - */ - rasterization: string; - /** - * Video Decode. - */ - video_decode: string; - /** - * Video Encode. - */ - video_encode: string; - /** - * VPx Video Decode. - */ - vpx_decode: string; - /** - * WebGL. - */ - webgl: string; - /** - * WebGL2. - */ - webgl2: string; - } - - interface InAppPurchase extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/in-app-purchase - - /** - * Emitted when one or more transactions have been updated. - */ - on(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - once(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - addListener(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - removeListener(event: 'transactions-updated', listener: (event: Event, - /** - * Array of objects. - */ - transactions: Transaction[]) => void): this; - canMakePayments(): boolean; - /** - * Completes all pending transactions. - */ - finishAllTransactions(): void; - /** - * Completes the pending transactions corresponding to the date. - */ - finishTransactionByDate(date: string): void; - /** - * Retrieves the product descriptions. Deprecated Soon - */ - getProducts(productIDs: string[], callback: (products: Product[]) => void): void; - /** - * Retrieves the product descriptions. - */ - getProducts(productIDs: string[]): Promise; - getReceiptURL(): string; - /** - * You should listen for the transactions-updated event as soon as possible and - * certainly before you call purchaseProduct. Deprecated Soon - */ - purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void; - /** - * You should listen for the transactions-updated event as soon as possible and - * certainly before you call purchaseProduct. - */ - purchaseProduct(productID: string, quantity?: number): Promise; - } - - class IncomingMessage extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/incoming-message - - /** - * Emitted when a request has been canceled during an ongoing HTTP transaction. - */ - on(event: 'aborted', listener: Function): this; - once(event: 'aborted', listener: Function): this; - addListener(event: 'aborted', listener: Function): this; - removeListener(event: 'aborted', listener: Function): this; - /** - * The data event is the usual method of transferring response data into - * applicative code. - */ - on(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - once(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - addListener(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - removeListener(event: 'data', listener: ( - /** - * A chunk of response body's data. - */ - chunk: Buffer) => void): this; - /** - * Indicates that response body has ended. - */ - on(event: 'end', listener: Function): this; - once(event: 'end', listener: Function): this; - addListener(event: 'end', listener: Function): this; - removeListener(event: 'end', listener: Function): this; - /** - * error Error - Typically holds an error string identifying failure root cause. - * Emitted when an error was encountered while streaming response data events. For - * instance, if the server closes the underlying while the response is still - * streaming, an error event will be emitted on the response object and a close - * event will subsequently follow on the request object. - */ - on(event: 'error', listener: Function): this; - once(event: 'error', listener: Function): this; - addListener(event: 'error', listener: Function): this; - removeListener(event: 'error', listener: Function): this; - headers: any; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - statusCode: number; - statusMessage: string; - } - - interface IOCounters { - - // Docs: http://electronjs.org/docs/api/structures/io-counters - - /** - * Then number of I/O other operations. - */ - otherOperationCount: number; - /** - * Then number of I/O other transfers. - */ - otherTransferCount: number; - /** - * The number of I/O read operations. - */ - readOperationCount: number; - /** - * The number of I/O read transfers. - */ - readTransferCount: number; - /** - * The number of I/O write operations. - */ - writeOperationCount: number; - /** - * The number of I/O write transfers. - */ - writeTransferCount: number; - } - - interface IpcMain extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/ipc-main - - /** - * Listens to channel, when a new message arrives listener would be called with - * listener(event, args...). - */ - on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this; - /** - * Adds a one time listener function for the event. This listener is invoked only - * the next time a message is sent to channel, after which it is removed. - */ - once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this; - /** - * Removes listeners of the specified channel. - */ - removeAllListeners(channel: string): this; - /** - * Removes the specified listener from the listener array for the specified - * channel. - */ - removeListener(channel: string, listener: Function): this; - } - - interface IpcMainEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/ipc-main-event - - /** - * The ID of the renderer frame that sent this message - */ - frameId: number; - /** - * A function that will send an IPC message to the renderer frame that sent the - * original message that you are currently handling. You should use this method to - * "reply" to the sent message in order to guaruntee the reply will go to the - * correct process and frame. - */ - reply: Function; - /** - * Set this to the value to be returned in a syncronous message - */ - returnValue: any; - /** - * Returns the webContents that sent the message - */ - sender: WebContents; - } - - interface IpcRenderer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/ipc-renderer - - /** - * Listens to channel, when a new message arrives listener would be called with - * listener(event, args...). - */ - on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this; - /** - * Adds a one time listener function for the event. This listener is invoked only - * the next time a message is sent to channel, after which it is removed. - */ - once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this; - /** - * Removes all listeners, or those of the specified channel. - */ - removeAllListeners(channel: string): this; - /** - * Removes the specified listener from the listener array for the specified - * channel. - */ - removeListener(channel: string, listener: Function): this; - /** - * Send a message to the main process asynchronously via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The main process handles it by - * listening for channel with ipcMain module. - */ - send(channel: string, ...args: any[]): void; - /** - * Send a message to the main process synchronously via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The main process handles it by - * listening for channel with ipcMain module, and replies by setting - * event.returnValue. Note: Sending a synchronous message will block the whole - * renderer process, unless you know what you are doing you should never use it. - */ - // sendSync(channel: string, ...args: any[]): any; ### VSCODE CHANGE (we do not want to use sendSync) - /** - * Sends a message to a window with webContentsId via channel. - */ - sendTo(webContentsId: number, channel: string, ...args: any[]): void; - /** - * Like ipcRenderer.send but the event will be sent to the element in the - * host page instead of the main process. - */ - sendToHost(channel: string, ...args: any[]): void; - } - - interface IpcRendererEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/ipc-renderer-event - - /** - * The IpcRenderer instance that emitted the event originally - */ - sender: IpcRenderer; - /** - * The webContents.id that sent the message, you can call - * event.sender.sendTo(event.senderId, ...) to reply to the message, see for more - * information. This only applies to messages sent from a different renderer. - * Messages sent directly from the main process set event.senderId to 0. - */ - senderId: number; - } - - interface JumpListCategory { - - // Docs: http://electronjs.org/docs/api/structures/jump-list-category - - /** - * Array of objects if type is tasks or custom, otherwise it should be omitted. - */ - items?: JumpListItem[]; - /** - * Must be set if type is custom, otherwise it should be omitted. - */ - name?: string; - /** - * One of the following: - */ - type?: ('tasks' | 'frequent' | 'recent' | 'custom'); - } - - interface JumpListItem { - - // Docs: http://electronjs.org/docs/api/structures/jump-list-item - - /** - * The command line arguments when program is executed. Should only be set if type - * is task. - */ - args?: string; - /** - * Description of the task (displayed in a tooltip). Should only be set if type is - * task. - */ - description?: string; - /** - * The index of the icon in the resource file. If a resource file contains multiple - * icons this value can be used to specify the zero-based index of the icon that - * should be displayed for this task. If a resource file contains only one icon, - * this property should be set to zero. - */ - iconIndex?: number; - /** - * The absolute path to an icon to be displayed in a Jump List, which can be an - * arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll). You can - * usually specify process.execPath to show the program icon. - */ - iconPath?: string; - /** - * Path of the file to open, should only be set if type is file. - */ - path?: string; - /** - * Path of the program to execute, usually you should specify process.execPath - * which opens the current program. Should only be set if type is task. - */ - program?: string; - /** - * The text to be displayed for the item in the Jump List. Should only be set if - * type is task. - */ - title?: string; - /** - * One of the following: - */ - type?: ('task' | 'separator' | 'file'); - /** - * The working directory. Default is empty. - */ - workingDirectory?: string; - } - - interface KeyboardEvent extends Event { - - // Docs: http://electronjs.org/docs/api/structures/keyboard-event - - /** - * whether an Alt key was used in an accelerator to trigger the Event - */ - altKey?: boolean; - /** - * whether the Control key was used in an accelerator to trigger the Event - */ - ctrlKey?: boolean; - /** - * whether a meta key was used in an accelerator to trigger the Event - */ - metaKey?: boolean; - /** - * whether a Shift key was used in an accelerator to trigger the Event - */ - shiftKey?: boolean; - /** - * whether an accelerator was used to trigger the event as opposed to another user - * gesture like mouse click - */ - triggeredByAccelerator?: boolean; - } - - interface MemoryUsageDetails { - - // Docs: http://electronjs.org/docs/api/structures/memory-usage-details - - count: number; - liveSize: number; - size: number; - } - - class Menu { - - // Docs: http://electronjs.org/docs/api/menu - - /** - * Emitted when a popup is closed either manually or with menu.closePopup(). - */ - on(event: 'menu-will-close', listener: (event: Event) => void): this; - once(event: 'menu-will-close', listener: (event: Event) => void): this; - addListener(event: 'menu-will-close', listener: (event: Event) => void): this; - removeListener(event: 'menu-will-close', listener: (event: Event) => void): this; - /** - * Emitted when menu.popup() is called. - */ - on(event: 'menu-will-show', listener: (event: Event) => void): this; - once(event: 'menu-will-show', listener: (event: Event) => void): this; - addListener(event: 'menu-will-show', listener: (event: Event) => void): this; - removeListener(event: 'menu-will-show', listener: (event: Event) => void): this; - constructor(); - /** - * Generally, the template is an array of options for constructing a MenuItem. The - * usage can be referenced above. You can also attach other fields to the element - * of the template and they will become properties of the constructed menu items. - */ - static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu; - /** - * Note: The returned Menu instance doesn't support dynamic addition or removal of - * menu items. Instance properties can still be dynamically modified. - */ - static getApplicationMenu(): (Menu) | (null); - /** - * Sends the action to the first responder of application. This is used for - * emulating default macOS menu behaviors. Usually you would use the role property - * of a MenuItem. See the macOS Cocoa Event Handling Guide for more information on - * macOS' native actions. - */ - static sendActionToFirstResponder(action: string): void; - /** - * Sets menu as the application menu on macOS. On Windows and Linux, the menu will - * be set as each window's top menu. Also on Windows and Linux, you can use a & in - * the top-level item name to indicate which letter should get a generated - * accelerator. For example, using &File for the file menu would result in a - * generated Alt-F accelerator that opens the associated menu. The indicated - * character in the button label gets an underline. The & character is not - * displayed on the button label. Passing null will suppress the default menu. On - * Windows and Linux, this has the additional effect of removing the menu bar from - * the window. Note: The default menu will be created automatically if the app does - * not set one. It contains standard items such as File, Edit, View, Window and - * Help. - */ - static setApplicationMenu(menu: (Menu) | (null)): void; - /** - * Appends the menuItem to the menu. - */ - append(menuItem: MenuItem): void; - /** - * Closes the context menu in the browserWindow. - */ - closePopup(browserWindow?: BrowserWindow): void; - getMenuItemById(id: string): MenuItem; - /** - * Inserts the menuItem to the pos position of the menu. - */ - insert(pos: number, menuItem: MenuItem): void; - /** - * Pops up this menu as a context menu in the BrowserWindow. - */ - popup(options?: PopupOptions): void; - items: MenuItem[]; - } - - class MenuItem { - - // Docs: http://electronjs.org/docs/api/menu-item - - constructor(options: MenuItemConstructorOptions); - accelerator: string; - checked: boolean; - click: Function; - commandId: number; - enabled: boolean; - icon: NativeImage; - id: string; - label: string; - menu: Menu; - registerAccelerator: boolean; - role: string; - sublabel: string; - submenu: Menu; - type: string; - visible: boolean; - } - - interface MimeTypedBuffer { - - // Docs: http://electronjs.org/docs/api/structures/mime-typed-buffer - - /** - * The actual Buffer content. - */ - data: Buffer; - /** - * The mimeType of the Buffer that you are sending. - */ - mimeType: string; - } - - class NativeImage { - - // Docs: http://electronjs.org/docs/api/native-image - - /** - * Creates an empty NativeImage instance. - */ - static createEmpty(): NativeImage; - /** - * Creates a new NativeImage instance from buffer that contains the raw bitmap - * pixel data returned by toBitmap(). The specific format is platform-dependent. - */ - static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage; - /** - * Creates a new NativeImage instance from buffer. Tries to decode as PNG or JPEG - * first. - */ - static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage; - /** - * Creates a new NativeImage instance from dataURL. - */ - static createFromDataURL(dataURL: string): NativeImage; - /** - * Creates a new NativeImage instance from the NSImage that maps to the given image - * name. See NSImageName for a list of possible values. The hslShift is applied to - * the image with the following rules This means that [-1, 0, 1] will make the - * image completely white and [-1, 1, 0] will make the image completely black. In - * some cases, the NSImageName doesn't match its string representation; one example - * of this is NSFolderImageName, whose string representation would actually be - * NSFolder. Therefore, you'll need to determine the correct string representation - * for your image before passing it in. This can be done with the following: echo - * -e '#import \nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); }' | - * clang -otest -x objective-c -framework Cocoa - && ./test where SYSTEM_IMAGE_NAME - * should be replaced with any value from this list. - */ - static createFromNamedImage(imageName: string, hslShift: number[]): NativeImage; - /** - * Creates a new NativeImage instance from a file located at path. This method - * returns an empty image if the path does not exist, cannot be read, or is not a - * valid image. - */ - static createFromPath(path: string): NativeImage; - /** - * Add an image representation for a specific scale factor. This can be used to - * explicitly add different scale factor representations to an image. This can be - * called on empty images. - */ - addRepresentation(options: AddRepresentationOptions): void; - crop(rect: Rectangle): NativeImage; - getAspectRatio(): number; - /** - * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy - * the bitmap data, so you have to use the returned Buffer immediately in current - * event loop tick, otherwise the data might be changed or destroyed. - */ - getBitmap(options?: BitmapOptions): Buffer; - /** - * Notice that the returned pointer is a weak pointer to the underlying native - * image instead of a copy, so you must ensure that the associated nativeImage - * instance is kept around. - */ - getNativeHandle(): Buffer; - getSize(): Size; - isEmpty(): boolean; - isTemplateImage(): boolean; - /** - * If only the height or the width are specified then the current aspect ratio will - * be preserved in the resized image. - */ - resize(options: ResizeOptions): NativeImage; - /** - * Marks the image as a template image. - */ - setTemplateImage(option: boolean): void; - toBitmap(options?: ToBitmapOptions): Buffer; - toDataURL(options?: ToDataURLOptions): string; - toJPEG(quality: number): Buffer; - toPNG(options?: ToPNGOptions): Buffer; - } - - interface Net extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/net - - /** - * Creates a ClientRequest instance using the provided options which are directly - * forwarded to the ClientRequest constructor. The net.request method would be used - * to issue both secure and insecure HTTP requests according to the specified - * protocol scheme in the options object. - */ - request(options: (any) | (string)): ClientRequest; - } - - interface NetLog extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/net-log - - /** - * Starts recording network events to path. - */ - startLogging(path: string): void; - /** - * Stops recording network events. If not called, net logging will automatically - * end when app quits. Deprecated Soon - */ - stopLogging(callback?: (path: string) => void): void; - /** - * Stops recording network events. If not called, net logging will automatically - * end when app quits. - */ - stopLogging(): Promise; - /** - * A Boolean property that indicates whether network logs are recorded. - */ - currentlyLogging?: boolean; - /** - * A String property that returns the path to the current log file. - */ - currentlyLoggingPath?: string; - } - - class Notification extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/notification - - on(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - once(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - addListener(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - removeListener(event: 'action', listener: (event: Event, - /** - * The index of the action that was activated. - */ - index: number) => void): this; - /** - * Emitted when the notification is clicked by the user. - */ - on(event: 'click', listener: (event: Event) => void): this; - once(event: 'click', listener: (event: Event) => void): this; - addListener(event: 'click', listener: (event: Event) => void): this; - removeListener(event: 'click', listener: (event: Event) => void): this; - /** - * Emitted when the notification is closed by manual intervention from the user. - * This event is not guaranteed to be emitted in all cases where the notification - * is closed. - */ - on(event: 'close', listener: (event: Event) => void): this; - once(event: 'close', listener: (event: Event) => void): this; - addListener(event: 'close', listener: (event: Event) => void): this; - removeListener(event: 'close', listener: (event: Event) => void): this; - /** - * Emitted when the user clicks the "Reply" button on a notification with hasReply: - * true. - */ - on(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - once(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - addListener(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - removeListener(event: 'reply', listener: (event: Event, - /** - * The string the user entered into the inline reply field. - */ - reply: string) => void): this; - /** - * Emitted when the notification is shown to the user, note this could be fired - * multiple times as a notification can be shown multiple times through the show() - * method. - */ - on(event: 'show', listener: (event: Event) => void): this; - once(event: 'show', listener: (event: Event) => void): this; - addListener(event: 'show', listener: (event: Event) => void): this; - removeListener(event: 'show', listener: (event: Event) => void): this; - constructor(options: NotificationConstructorOptions); - static isSupported(): boolean; - /** - * Dismisses the notification. - */ - close(): void; - /** - * Immediately shows the notification to the user, please note this means unlike - * the HTML5 Notification implementation, instantiating a new Notification does not - * immediately show it to the user, you need to call this method before the OS will - * display it. If the notification has been shown before, this method will dismiss - * the previously shown notification and create a new one with identical - * properties. - */ - show(): void; - } - - interface NotificationAction { - - // Docs: http://electronjs.org/docs/api/structures/notification-action - - /** - * The label for the given action. - */ - text?: string; - /** - * The type of action, can be button. - */ - type: ('button'); - } - - interface Point { - - // Docs: http://electronjs.org/docs/api/structures/point - - x: number; - y: number; - } - - interface PowerMonitor extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/power-monitor - - /** - * Emitted when the system is about to lock the screen. - */ - on(event: 'lock-screen', listener: Function): this; - once(event: 'lock-screen', listener: Function): this; - addListener(event: 'lock-screen', listener: Function): this; - removeListener(event: 'lock-screen', listener: Function): this; - /** - * Emitted when the system changes to AC power. - */ - on(event: 'on-ac', listener: Function): this; - once(event: 'on-ac', listener: Function): this; - addListener(event: 'on-ac', listener: Function): this; - removeListener(event: 'on-ac', listener: Function): this; - /** - * Emitted when system changes to battery power. - */ - on(event: 'on-battery', listener: Function): this; - once(event: 'on-battery', listener: Function): this; - addListener(event: 'on-battery', listener: Function): this; - removeListener(event: 'on-battery', listener: Function): this; - /** - * Emitted when system is resuming. - */ - on(event: 'resume', listener: Function): this; - once(event: 'resume', listener: Function): this; - addListener(event: 'resume', listener: Function): this; - removeListener(event: 'resume', listener: Function): this; - /** - * Emitted when the system is about to reboot or shut down. If the event handler - * invokes e.preventDefault(), Electron will attempt to delay system shutdown in - * order for the app to exit cleanly. If e.preventDefault() is called, the app - * should exit as soon as possible by calling something like app.quit(). - */ - on(event: 'shutdown', listener: Function): this; - once(event: 'shutdown', listener: Function): this; - addListener(event: 'shutdown', listener: Function): this; - removeListener(event: 'shutdown', listener: Function): this; - /** - * Emitted when the system is suspending. - */ - on(event: 'suspend', listener: Function): this; - once(event: 'suspend', listener: Function): this; - addListener(event: 'suspend', listener: Function): this; - removeListener(event: 'suspend', listener: Function): this; - /** - * Emitted as soon as the systems screen is unlocked. - */ - on(event: 'unlock-screen', listener: Function): this; - once(event: 'unlock-screen', listener: Function): this; - addListener(event: 'unlock-screen', listener: Function): this; - removeListener(event: 'unlock-screen', listener: Function): this; - /** - * Calculate the system idle state. idleThreshold is the amount of time (in - * seconds) before considered idle. locked is available on supported systems only. - */ - getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown'); - /** - * Calculate system idle time in seconds. - */ - getSystemIdleTime(): number; - /** - * Calculate the system idle state. idleThreshold is the amount of time (in - * seconds) before considered idle. callback will be called synchronously on some - * systems and with an idleState argument that describes the system's state. locked - * is available on supported systems only. - */ - querySystemIdleState(idleThreshold: number, callback: (idleState: 'active' | 'idle' | 'locked' | 'unknown') => void): void; - /** - * Calculate system idle time in seconds. - */ - querySystemIdleTime(callback: (idleTime: number) => void): void; - } - - interface PowerSaveBlocker extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/power-save-blocker - - isStarted(id: number): boolean; - /** - * Starts preventing the system from entering lower-power mode. Returns an integer - * identifying the power save blocker. Note: prevent-display-sleep has higher - * precedence over prevent-app-suspension. Only the highest precedence type takes - * effect. In other words, prevent-display-sleep always takes precedence over - * prevent-app-suspension. For example, an API calling A requests for - * prevent-app-suspension, and another calling B requests for - * prevent-display-sleep. prevent-display-sleep will be used until B stops its - * request. After that, prevent-app-suspension is used. - */ - start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number; - /** - * Stops the specified power save blocker. - */ - stop(id: number): void; - } - - interface PrinterInfo { - - // Docs: http://electronjs.org/docs/api/structures/printer-info - - description: string; - isDefault: boolean; - name: string; - status: number; - } - - interface ProcessMemoryInfo { - - // Docs: http://electronjs.org/docs/api/structures/process-memory-info - - /** - * The amount of memory not shared by other processes, such as JS heap or HTML - * content in Kilobytes. - */ - private: number; - /** - * and The amount of memory currently pinned to actual physical RAM in Kilobytes. - */ - residentSet: number; - /** - * The amount of memory shared between processes, typically memory consumed by the - * Electron code itself in Kilobytes. - */ - shared: number; - } - - interface ProcessMetric { - - // Docs: http://electronjs.org/docs/api/structures/process-metric - - /** - * CPU usage of the process. - */ - cpu: CPUUsage; - /** - * Process id of the process. - */ - pid: number; - /** - * Process type. One of the following values: - */ - type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'GPU' | 'Unknown'); - } - - interface Product { - - // Docs: http://electronjs.org/docs/api/structures/product - - /** - * The total size of the content, in bytes. - */ - contentLengths: number[]; - /** - * A string that identifies the version of the content. - */ - contentVersion: string; - /** - * The locale formatted price of the product. - */ - formattedPrice: string; - /** - * A Boolean value that indicates whether the App Store has downloadable content - * for this product. true if at least one file has been associated with the - * product. - */ - isDownloadable: boolean; - /** - * A description of the product. - */ - localizedDescription: string; - /** - * The name of the product. - */ - localizedTitle: string; - /** - * The cost of the product in the local currency. - */ - price: number; - /** - * The string that identifies the product to the Apple App Store. - */ - productIdentifier: string; - } - - interface Protocol extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/protocol - - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a Buffer as a response. - */ - interceptBufferProtocol(scheme: string, handler: (request: InterceptBufferProtocolRequest, callback: (buffer?: Buffer) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a file as a response. - */ - interceptFileProtocol(scheme: string, handler: (request: InterceptFileProtocolRequest, callback: (filePath: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a new HTTP request as a response. - */ - interceptHttpProtocol(scheme: string, handler: (request: InterceptHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; - /** - * Same as protocol.registerStreamProtocol, except that it replaces an existing - * protocol handler. - */ - interceptStreamProtocol(scheme: string, handler: (request: InterceptStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void; - /** - * Intercepts scheme protocol and uses handler as the protocol's new handler which - * sends a String as a response. - */ - interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * The callback will be called with a boolean that indicates whether there is - * already a handler for scheme. Deprecated Soon - */ - isProtocolHandled(scheme: string, callback: (handled: boolean) => void): void; - isProtocolHandled(scheme: string): Promise; - /** - * Registers a protocol of scheme that will send a Buffer as a response. The usage - * is the same with registerFileProtocol, except that the callback should be called - * with either a Buffer object or an object that has the data, mimeType, and - * charset properties. Example: - */ - registerBufferProtocol(scheme: string, handler: (request: RegisterBufferProtocolRequest, callback: (buffer?: (Buffer) | (MimeTypedBuffer)) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send the file as a response. The - * handler will be called with handler(request, callback) when a request is going - * to be created with scheme. completion will be called with completion(null) when - * scheme is successfully registered or completion(error) when failed. To handle - * the request, the callback should be called with either the file's path or an - * object that has a path property, e.g. callback(filePath) or callback({ path: - * filePath }). The object may also have a headers property which gives a map of - * headers to values for the response headers, e.g. callback({ path: filePath, - * headers: {"Content-Security-Policy": "default-src 'none'"]}). When callback is - * called with nothing, a number, or an object that has an error property, the - * request will fail with the error number you specified. For the available error - * numbers you can use, please see the net error list. By default the scheme is - * treated like http:, which is parsed differently than protocols that follow the - * "generic URI syntax" like file:. - */ - registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send an HTTP request as a response. The - * usage is the same with registerFileProtocol, except that the callback should be - * called with a redirectRequest object that has the url, method, referrer, - * uploadData and session properties. By default the HTTP request will reuse the - * current session. If you want the request to have a different session you should - * set session to null. For POST requests the uploadData object must be provided. - */ - registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void; - /** - * Note: This method can only be used before the ready event of the app module gets - * emitted and can be called only once. Registers the scheme as standard, secure, - * bypasses content security policy for resources, allows registering ServiceWorker - * and supports fetch API. Specify a privilege with the value of true to enable the - * capability. An example of registering a privileged scheme, with bypassing - * Content Security Policy: A standard scheme adheres to what RFC 3986 calls - * generic URI syntax. For example http and https are standard schemes, while file - * is not. Registering a scheme as standard, will allow relative and absolute - * resources to be resolved correctly when served. Otherwise the scheme will behave - * like the file protocol, but without the ability to resolve relative URLs. For - * example when you load following page with custom protocol without registering it - * as standard scheme, the image will not be loaded because non-standard schemes - * can not recognize relative URLs: Registering a scheme as standard will allow - * access to files through the FileSystem API. Otherwise the renderer will throw a - * security error for the scheme. By default web storage apis (localStorage, - * sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard - * schemes. So in general if you want to register a custom protocol to replace the - * http protocol, you have to register it as a standard scheme. - * protocol.registerSchemesAsPrivileged can be used to replicate the functionality - * of the previous protocol.registerStandardSchemes, webFrame.registerURLSchemeAs* - * and protocol.registerServiceWorkerSchemes functions that existed prior to - * Electron 5.0.0, for example: before (<= v4.x) after (>= v5.x) - */ - registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void; - /** - * Registers a protocol of scheme that will send a Readable as a response. The - * usage is similar to the other register{Any}Protocol, except that the callback - * should be called with either a Readable object or an object that has the data, - * statusCode, and headers properties. Example: It is possible to pass any object - * that implements the readable stream API (emits data/end/error events). For - * example, here's how a file could be returned: - */ - registerStreamProtocol(scheme: string, handler: (request: RegisterStreamProtocolRequest, callback: (stream?: (NodeJS.ReadableStream) | (StreamProtocolResponse)) => void) => void, completion?: (error: Error) => void): void; - /** - * Registers a protocol of scheme that will send a String as a response. The usage - * is the same with registerFileProtocol, except that the callback should be called - * with either a String or an object that has the data, mimeType, and charset - * properties. - */ - registerStringProtocol(scheme: string, handler: (request: RegisterStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void; - /** - * Remove the interceptor installed for scheme and restore its original handler. - */ - uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; - /** - * Unregisters the custom protocol of scheme. - */ - unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; - } - - interface Rectangle { - - // Docs: http://electronjs.org/docs/api/structures/rectangle - - /** - * The height of the rectangle (must be an integer). - */ - height: number; - /** - * The width of the rectangle (must be an integer). - */ - width: number; - /** - * The x coordinate of the origin of the rectangle (must be an integer). - */ - x: number; - /** - * The y coordinate of the origin of the rectangle (must be an integer). - */ - y: number; - } - - interface Referrer { - - // Docs: http://electronjs.org/docs/api/structures/referrer - - /** - * Can be default, unsafe-url, no-referrer-when-downgrade, no-referrer, origin, - * strict-origin-when-cross-origin, same-origin or strict-origin. See the for more - * details on the meaning of these values. - */ - policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin'); - /** - * HTTP Referrer URL. - */ - url: string; - } - - interface Remote extends MainInterface { - - // Docs: http://electronjs.org/docs/api/remote - - getCurrentWebContents(): WebContents; - /** - * Note: Do not use removeAllListeners on BrowserWindow. Use of this can remove all - * blur listeners, disable click events on touch bar buttons, and other unintended - * consequences. - */ - getCurrentWindow(): BrowserWindow; - getGlobal(name: string): any; - /** - * e.g. - */ - require(module: string): any; - /** - * The process object in the main process. This is the same as - * remote.getGlobal('process') but is cached. - */ - process?: any; - } - - interface RemoveClientCertificate { - - // Docs: http://electronjs.org/docs/api/structures/remove-client-certificate - - /** - * Origin of the server whose associated client certificate must be removed from - * the cache. - */ - origin: string; - /** - * clientCertificate. - */ - type: string; - } - - interface RemovePassword { - - // Docs: http://electronjs.org/docs/api/structures/remove-password - - /** - * When provided, the authentication info related to the origin will only be - * removed otherwise the entire cache will be cleared. - */ - origin?: string; - /** - * Credentials of the authentication. Must be provided if removing by origin. - */ - password?: string; - /** - * Realm of the authentication. Must be provided if removing by origin. - */ - realm?: string; - /** - * Scheme of the authentication. Can be basic, digest, ntlm, negotiate. Must be - * provided if removing by origin. - */ - scheme?: ('basic' | 'digest' | 'ntlm' | 'negotiate'); - /** - * password. - */ - type: string; - /** - * Credentials of the authentication. Must be provided if removing by origin. - */ - username?: string; - } - - interface Screen extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/screen - - /** - * Emitted when newDisplay has been added. - */ - on(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - once(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - addListener(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - removeListener(event: 'display-added', listener: (event: Event, - newDisplay: Display) => void): this; - /** - * Emitted when one or more metrics change in a display. The changedMetrics is an - * array of strings that describe the changes. Possible changes are bounds, - * workArea, scaleFactor and rotation. - */ - on(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - once(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - addListener(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - removeListener(event: 'display-metrics-changed', listener: (event: Event, - display: Display, - changedMetrics: string[]) => void): this; - /** - * Emitted when oldDisplay has been removed. - */ - on(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - once(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - addListener(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - removeListener(event: 'display-removed', listener: (event: Event, - oldDisplay: Display) => void): this; - /** - * Converts a screen DIP point to a screen physical point. The DPI scale is - * performed relative to the display containing the DIP point. - */ - dipToScreenPoint(point: Point): Point; - /** - * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed - * relative to the display nearest to window. If window is null, scaling will be - * performed to the display nearest to rect. - */ - dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle; - getAllDisplays(): Display[]; - /** - * The current absolute position of the mouse pointer. - */ - getCursorScreenPoint(): Point; - getDisplayMatching(rect: Rectangle): Display; - getDisplayNearestPoint(point: Point): Display; - getPrimaryDisplay(): Display; - /** - * Converts a screen physical point to a screen DIP point. The DPI scale is - * performed relative to the display containing the physical point. - */ - screenToDipPoint(point: Point): Point; - /** - * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed - * relative to the display nearest to window. If window is null, scaling will be - * performed to the display nearest to rect. - */ - screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle; - } - - interface ScrubberItem { - - // Docs: http://electronjs.org/docs/api/structures/scrubber-item - - /** - * The image to appear in this item. - */ - icon?: NativeImage; - /** - * The text to appear in this item. - */ - label?: string; - } - - interface SegmentedControlSegment { - - // Docs: http://electronjs.org/docs/api/structures/segmented-control-segment - - /** - * Whether this segment is selectable. Default: true. - */ - enabled?: boolean; - /** - * The image to appear in this segment. - */ - icon?: NativeImage; - /** - * The text to appear in this segment. - */ - label?: string; - } - - class Session extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/session - - /** - * If partition starts with persist:, the page will use a persistent session - * available to all pages in the app with the same partition. if there is no - * persist: prefix, the page will use an in-memory session. If the partition is - * empty then default session of the app will be returned. To create a Session with - * options, you have to ensure the Session with the partition has never been used - * before. There is no way to change the options of an existing Session object. - */ - static fromPartition(partition: string, options?: FromPartitionOptions): Session; - /** - * A Session object, the default session object of the app. - */ - static defaultSession?: Session; - /** - * Emitted when Electron is about to download item in webContents. Calling - * event.preventDefault() will cancel the download and item will not be available - * from next tick of the process. - */ - on(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - once(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - addListener(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - removeListener(event: 'will-download', listener: (event: Event, - item: DownloadItem, - webContents: WebContents) => void): this; - /** - * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate - * authentication. - */ - allowNTLMCredentialsForDomains(domains: string): void; - clearAuthCache(): Promise; - clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate)): Promise; - /** - * Clears the session’s HTTP authentication cache. Deprecated Soon - */ - clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate), callback: Function): void; - /** - * Clears the session’s HTTP cache. - */ - clearCache(): Promise; - /** - * Clears the session’s HTTP cache. Deprecated Soon - */ - clearCache(callback: (error: number) => void): void; - /** - * Clears the host resolver cache. - */ - clearHostResolverCache(): Promise; - /** - * Clears the host resolver cache. Deprecated Soon - */ - clearHostResolverCache(callback?: Function): void; - /** - * Clears the storage data for the current session. Deprecated Soon - */ - clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void; - clearStorageData(options?: ClearStorageDataOptions): Promise; - /** - * Allows resuming cancelled or interrupted downloads from previous Session. The - * API will generate a DownloadItem that can be accessed with the will-download - * event. The DownloadItem will not have any WebContents associated with it and the - * initial state will be interrupted. The download will start only when the resume - * API is called on the DownloadItem. - */ - createInterruptedDownload(options: CreateInterruptedDownloadOptions): void; - /** - * Disables any network emulation already active for the session. Resets to the - * original network configuration. - */ - disableNetworkEmulation(): void; - /** - * Emulates network with the given configuration for the session. - */ - enableNetworkEmulation(options: EnableNetworkEmulationOptions): void; - /** - * Writes any unwritten DOMStorage data to disk. - */ - flushStorageData(): void; - /** - * Deprecated Soon - */ - getBlobData(identifier: string, callback: (result: Buffer) => void): void; - getBlobData(identifier: string): Promise; - getCacheSize(): Promise; - /** - * Callback is invoked with the session's current cache size. Deprecated Soon - */ - getCacheSize(callback: (size: number, error: number) => void): void; - getPreloads(): string[]; - getUserAgent(): string; - resolveProxy(url: string): Promise; - /** - * Resolves the proxy information for url. The callback will be called with - * callback(proxy) when the request is performed. Deprecated Soon - */ - resolveProxy(url: string, callback: (proxy: string) => void): void; - /** - * Sets the certificate verify proc for session, the proc will be called with - * proc(request, callback) whenever a server certificate verification is requested. - * Calling callback(0) accepts the certificate, calling callback(-2) rejects it. - * Calling setCertificateVerifyProc(null) will revert back to default certificate - * verify proc. - */ - setCertificateVerifyProc(proc: (request: CertificateVerifyProcRequest, callback: (verificationResult: number) => void) => void): void; - /** - * Sets download saving directory. By default, the download directory will be the - * Downloads under the respective app folder. - */ - setDownloadPath(path: string): void; - /** - * Sets the handler which can be used to respond to permission checks for the - * session. Returning true will allow the permission and false will reject it. To - * clear the handler, call setPermissionCheckHandler(null). - */ - setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerDetails) => boolean) | (null)): void; - /** - * Sets the handler which can be used to respond to permission requests for the - * session. Calling callback(true) will allow the permission and callback(false) - * will reject it. To clear the handler, call setPermissionRequestHandler(null). - */ - setPermissionRequestHandler(handler: ((webContents: WebContents, permission: string, callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerDetails) => void) | (null)): void; - /** - * Adds scripts that will be executed on ALL web contents that are associated with - * this session just before normal preload scripts run. - */ - setPreloads(preloads: string[]): void; - /** - * Sets the proxy settings. When pacScript and proxyRules are provided together, - * the proxyRules option is ignored and pacScript configuration is applied. The - * proxyRules has to follow the rules below: For example: The proxyBypassRules is a - * comma separated list of rules described below: - */ - setProxy(config: Config): Promise; - /** - * Sets the proxy settings. When pacScript and proxyRules are provided together, - * the proxyRules option is ignored and pacScript configuration is applied. The - * proxyRules has to follow the rules below: For example: The proxyBypassRules is a - * comma separated list of rules described below: Deprecated Soon - */ - setProxy(config: Config, callback: Function): void; - /** - * Overrides the userAgent and acceptLanguages for this session. The - * acceptLanguages must a comma separated ordered list of language codes, for - * example "en-US,fr,de,ko,zh-CN,ja". This doesn't affect existing WebContents, and - * each WebContents can use webContents.setUserAgent to override the session-wide - * user agent. - */ - setUserAgent(userAgent: string, acceptLanguages?: string): void; - cookies: Cookies; - netLog: NetLog; - protocol: Protocol; - webRequest: WebRequest; - } - - interface Shell { - - // Docs: http://electronjs.org/docs/api/shell - - /** - * Play the beep sound. - */ - beep(): void; - /** - * Move the given file to trash and returns a boolean status for the operation. - */ - moveItemToTrash(fullPath: string): boolean; - /** - * Open the given external protocol URL in the desktop's default manner. (For - * example, mailto: URLs in the user's default mail agent). - */ - openExternal(url: string, options?: OpenExternalOptions): Promise; - /** - * Open the given external protocol URL in the desktop's default manner. (For - * example, mailto: URLs in the user's default mail agent). Deprecated - */ - openExternalSync(url: string, options?: OpenExternalSyncOptions): boolean; - /** - * Open the given file in the desktop's default manner. - */ - openItem(fullPath: string): boolean; - /** - * Resolves the shortcut link at shortcutPath. An exception will be thrown when any - * error happens. - */ - readShortcutLink(shortcutPath: string): ShortcutDetails; - /** - * Show the given file in a file manager. If possible, select the file. - */ - showItemInFolder(fullPath: string): void; - /** - * Creates or updates a shortcut link at shortcutPath. - */ - writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean; - /** - * Creates or updates a shortcut link at shortcutPath. - */ - writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean; - } - - interface ShortcutDetails { - - // Docs: http://electronjs.org/docs/api/structures/shortcut-details - - /** - * The Application User Model ID. Default is empty. - */ - appUserModelId?: string; - /** - * The arguments to be applied to target when launching from this shortcut. Default - * is empty. - */ - args?: string; - /** - * The working directory. Default is empty. - */ - cwd?: string; - /** - * The description of the shortcut. Default is empty. - */ - description?: string; - /** - * The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set - * together. Default is empty, which uses the target's icon. - */ - icon?: string; - /** - * The resource ID of icon when icon is a DLL or EXE. Default is 0. - */ - iconIndex?: number; - /** - * The target to launch from this shortcut. - */ - target: string; - } - - interface Size { - - // Docs: http://electronjs.org/docs/api/structures/size - - height: number; - width: number; - } - - interface StreamProtocolResponse { - - // Docs: http://electronjs.org/docs/api/structures/stream-protocol-response - - /** - * A Node.js readable stream representing the response body. - */ - data: NodeJS.ReadableStream; - /** - * An object containing the response headers. - */ - headers: Headers; - /** - * The HTTP response code. - */ - statusCode: number; - } - - interface SystemPreferences extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/system-preferences - - on(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - once(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - addListener(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - removeListener(event: 'accent-color-changed', listener: (event: Event, - /** - * The new RGBA color the user assigned to be their system accent color. - */ - newColor: string) => void): this; - on(event: 'color-changed', listener: (event: Event) => void): this; - once(event: 'color-changed', listener: (event: Event) => void): this; - addListener(event: 'color-changed', listener: (event: Event) => void): this; - removeListener(event: 'color-changed', listener: (event: Event) => void): this; - on(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - once(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event, - /** - * `true` if a high contrast theme is being used, `false` otherwise. - */ - highContrastColorScheme: boolean) => void): this; - on(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - once(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - addListener(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event, - /** - * `true` if an inverted color scheme (a high contrast color scheme with light text - * and dark backgrounds) is being used, `false` otherwise. - */ - invertedColorScheme: boolean) => void): this; - /** - * Important: In order to properly leverage this API, you must set the - * NSMicrophoneUsageDescription and NSCameraUsageDescription strings in your app's - * Info.plist file. The values for these keys will be used to populate the - * permission dialogs so that the user will be properly informed as to the purpose - * of the permission request. See Electron Application Distribution for more - * information about how to set these in the context of Electron. This user consent - * was not required until macOS 10.14 Mojave, so this method will always return - * true if your system is running 10.13 High Sierra or lower. - */ - askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise; - /** - * NOTE: This API will return false on macOS systems older than Sierra 10.12.2. - */ - canPromptTouchID(): boolean; - /** - * This API is only available on macOS 10.14 Mojave or newer. - */ - getAccentColor(): string; - /** - * Returns an object with system animation settings. - */ - getAnimationSettings(): AnimationSettings; - /** - * Gets the macOS appearance setting that you have declared you want for your - * application, maps to NSApplication.appearance. You can use the - * setAppLevelAppearance API to set this value. - */ - getAppLevelAppearance(): ('dark' | 'light' | 'unknown'); - getColor(color: '3d-dark-shadow' | '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'alternate-selected-control-text' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string; - /** - * Gets the macOS appearance setting that is currently applied to your application, - * maps to NSApplication.effectiveAppearance Please note that until Electron is - * built targeting the 10.14 SDK, your application's effectiveAppearance will - * default to 'light' and won't inherit the OS preference. In the interim in order - * for your application to inherit the OS preference you must set the - * NSRequiresAquaSystemAppearance key in your apps Info.plist to false. If you are - * using electron-packager or electron-forge just set the enableDarwinDarkMode - * packager option to true. See the Electron Packager API for more details. - */ - getEffectiveAppearance(): ('dark' | 'light' | 'unknown'); - /** - * This user consent was not required until macOS 10.14 Mojave, so this method will - * always return granted if your system is running 10.13 High Sierra or lower. - */ - getMediaAccessStatus(mediaType: string): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown'); - /** - * Returns one of several standard system colors that automatically adapt to - * vibrancy and changes in accessibility settings like 'Increase contrast' and - * 'Reduce transparency'. See Apple Documentation for more details. - */ - getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): void; - /** - * Some popular key and types are: - */ - getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; - /** - * An example of using it to determine if you should create a transparent window or - * not (transparent windows won't work correctly when DWM composition is disabled): - */ - isAeroGlassEnabled(): boolean; - isDarkMode(): boolean; - isHighContrastColorScheme(): boolean; - isInvertedColorScheme(): boolean; - isSwipeTrackingFromScrollEventsEnabled(): boolean; - isTrustedAccessibilityClient(prompt: boolean): boolean; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postLocalNotification(event: string, userInfo: any): void; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postNotification(event: string, userInfo: any, deliverImmediately?: boolean): void; - /** - * Posts event as native notifications of macOS. The userInfo is an Object that - * contains the user information dictionary sent along with the notification. - */ - postWorkspaceNotification(event: string, userInfo: any): void; - /** - * This API itself will not protect your user data; rather, it is a mechanism to - * allow you to do so. Native apps will need to set Access Control Constants like - * kSecAccessControlUserPresence on the their keychain entry so that reading it - * would auto-prompt for Touch ID biometric consent. This could be done with - * node-keytar, such that one would store an encryption key with node-keytar and - * only fetch it if promptTouchID() resolves. NOTE: This API will return a rejected - * Promise on macOS systems older than Sierra 10.12.2. - */ - promptTouchID(reason: string): Promise; - /** - * Add the specified defaults to your application's NSUserDefaults. - */ - registerDefaults(defaults: any): void; - /** - * Removes the key in NSUserDefaults. This can be used to restore the default or - * global value of a key previously set with setUserDefault. - */ - removeUserDefault(key: string): void; - /** - * Sets the appearance setting for your application, this should override the - * system default and override the value of getEffectiveAppearance. - */ - setAppLevelAppearance(appearance: 'dark' | 'light'): void; - /** - * Set the value of key in NSUserDefaults. Note that type should match actual type - * of value. An exception is thrown if they don't. Some popular key and types are: - */ - setUserDefault(key: string, type: string, value: string): void; - /** - * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. - * This is necessary for events such as NSUserDefaultsDidChangeNotification. - */ - subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): number; - /** - * Subscribes to native notifications of macOS, callback will be called with - * callback(event, userInfo) when the corresponding event happens. The userInfo is - * an Object that contains the user information dictionary sent along with the - * notification. The id of the subscriber is returned, which can be used to - * unsubscribe the event. Under the hood this API subscribes to - * NSDistributedNotificationCenter, example values of event are: - */ - subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): number; - /** - * Same as subscribeNotification, but uses - * NSWorkspace.sharedWorkspace.notificationCenter. This is necessary for events - * such as NSWorkspaceDidActivateApplicationNotification. - */ - subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: any) => void): void; - /** - * Same as unsubscribeNotification, but removes the subscriber from - * NSNotificationCenter. - */ - unsubscribeLocalNotification(id: number): void; - /** - * Removes the subscriber with id. - */ - unsubscribeNotification(id: number): void; - /** - * Same as unsubscribeNotification, but removes the subscriber from - * NSWorkspace.sharedWorkspace.notificationCenter. - */ - unsubscribeWorkspaceNotification(id: number): void; - } - - interface Task { - - // Docs: http://electronjs.org/docs/api/structures/task - - /** - * The command line arguments when program is executed. - */ - arguments: string; - /** - * Description of this task. - */ - description: string; - /** - * The icon index in the icon file. If an icon file consists of two or more icons, - * set this value to identify the icon. If an icon file consists of one icon, this - * value is 0. - */ - iconIndex: number; - /** - * The absolute path to an icon to be displayed in a JumpList, which can be an - * arbitrary resource file that contains an icon. You can usually specify - * process.execPath to show the icon of the program. - */ - iconPath: string; - /** - * Path of the program to execute, usually you should specify process.execPath - * which opens the current program. - */ - program: string; - /** - * The string to be displayed in a JumpList. - */ - title: string; - /** - * The working directory. Default is empty. - */ - workingDirectory?: string; - } - - interface ThumbarButton { - - // Docs: http://electronjs.org/docs/api/structures/thumbar-button - - click: Function; - /** - * Control specific states and behaviors of the button. By default, it is - * ['enabled']. - */ - flags?: string[]; - /** - * The icon showing in thumbnail toolbar. - */ - icon: NativeImage; - /** - * The text of the button's tooltip. - */ - tooltip?: string; - } - - class TouchBarButton extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-button - - constructor(options: TouchBarButtonConstructorOptions); - backgroundColor: string; - icon: NativeImage; - label: string; - } - - class TouchBarColorPicker extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-color-picker - - constructor(options: TouchBarColorPickerConstructorOptions); - availableColors: string[]; - selectedColor: string; - } - - class TouchBarGroup extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-group - - constructor(options: TouchBarGroupConstructorOptions); - } - - class TouchBarLabel extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-label - - constructor(options: TouchBarLabelConstructorOptions); - label: string; - textColor: string; - } - - class TouchBarPopover extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-popover - - constructor(options: TouchBarPopoverConstructorOptions); - icon: NativeImage; - label: string; - } - - class TouchBarScrubber extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-scrubber - - constructor(options: TouchBarScrubberConstructorOptions); - continuous: boolean; - items: ScrubberItem[]; - mode: string; - overlayStyle: string; - selectedStyle: string; - showArrowButtons: boolean; - } - - class TouchBarSegmentedControl extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-segmented-control - - constructor(options: TouchBarSegmentedControlConstructorOptions); - segments: SegmentedControlSegment[]; - segmentStyle: string; - selectedIndex: number; - } - - class TouchBarSlider extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-slider - - constructor(options: TouchBarSliderConstructorOptions); - label: string; - maxValue: number; - minValue: number; - value: number; - } - - class TouchBarSpacer extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar-spacer - - constructor(options: TouchBarSpacerConstructorOptions); - } - - class TouchBar extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/touch-bar - - constructor(options: TouchBarConstructorOptions); - escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null); - static TouchBarButton: typeof TouchBarButton; - static TouchBarColorPicker: typeof TouchBarColorPicker; - static TouchBarGroup: typeof TouchBarGroup; - static TouchBarLabel: typeof TouchBarLabel; - static TouchBarPopover: typeof TouchBarPopover; - static TouchBarScrubber: typeof TouchBarScrubber; - static TouchBarSegmentedControl: typeof TouchBarSegmentedControl; - static TouchBarSlider: typeof TouchBarSlider; - static TouchBarSpacer: typeof TouchBarSpacer; - } - - interface TraceCategoriesAndOptions { - - // Docs: http://electronjs.org/docs/api/structures/trace-categories-and-options - - /** - * – is a filter to control what category groups should be traced. A filter can - * have an optional prefix to exclude category groups that contain a matching - * category. Having both included and excluded category patterns in the same list - * is not supported. Examples: test_MyTest*, test_MyTest*,test_OtherStuff, - * -excluded_category1,-excluded_category2. - */ - categoryFilter: string; - /** - * Controls what kind of tracing is enabled, it is a comma-delimited sequence of - * the following strings: record-until-full, record-continuously, trace-to-console, - * enable-sampling, enable-systrace, e.g. 'record-until-full,enable-sampling'. The - * first 3 options are trace recording modes and hence mutually exclusive. If more - * than one trace recording modes appear in the traceOptions string, the last one - * takes precedence. If none of the trace recording modes are specified, recording - * mode is record-until-full. The trace option will first be reset to the default - * option (record_mode set to record-until-full, enable_sampling and - * enable_systrace set to false) before options parsed from traceOptions are - * applied on it. - */ - traceOptions: string; - } - - interface TraceConfig { - - // Docs: http://electronjs.org/docs/api/structures/trace-config - - excluded_categories?: string[]; - included_categories?: string[]; - memory_dump_config?: MemoryDumpConfig; - } - - interface Transaction { - - // Docs: http://electronjs.org/docs/api/structures/transaction - - /** - * The error code if an error occurred while processing the transaction. - */ - errorCode: number; - /** - * The error message if an error occurred while processing the transaction. - */ - errorMessage: string; - /** - * The identifier of the restored transaction by the App Store. - */ - originalTransactionIdentifier: string; - payment: Payment; - /** - * The date the transaction was added to the App Store’s payment queue. - */ - transactionDate: string; - /** - * A string that uniquely identifies a successful payment transaction. - */ - transactionIdentifier: string; - /** - * The transaction state, can be purchasing, purchased, failed, restored or - * deferred. - */ - transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred'); - } - - class Tray extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/tray - - /** - * Emitted when the tray balloon is clicked. - */ - on(event: 'balloon-click', listener: Function): this; - once(event: 'balloon-click', listener: Function): this; - addListener(event: 'balloon-click', listener: Function): this; - removeListener(event: 'balloon-click', listener: Function): this; - /** - * Emitted when the tray balloon is closed because of timeout or user manually - * closes it. - */ - on(event: 'balloon-closed', listener: Function): this; - once(event: 'balloon-closed', listener: Function): this; - addListener(event: 'balloon-closed', listener: Function): this; - removeListener(event: 'balloon-closed', listener: Function): this; - /** - * Emitted when the tray balloon shows. - */ - on(event: 'balloon-show', listener: Function): this; - once(event: 'balloon-show', listener: Function): this; - addListener(event: 'balloon-show', listener: Function): this; - removeListener(event: 'balloon-show', listener: Function): this; - /** - * Emitted when the tray icon is clicked. - */ - on(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the tray icon is double clicked. - */ - on(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - once(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - addListener(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - removeListener(event: 'double-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - /** - * Emitted when a drag operation ends on the tray or ends at another location. - */ - on(event: 'drag-end', listener: Function): this; - once(event: 'drag-end', listener: Function): this; - addListener(event: 'drag-end', listener: Function): this; - removeListener(event: 'drag-end', listener: Function): this; - /** - * Emitted when a drag operation enters the tray icon. - */ - on(event: 'drag-enter', listener: Function): this; - once(event: 'drag-enter', listener: Function): this; - addListener(event: 'drag-enter', listener: Function): this; - removeListener(event: 'drag-enter', listener: Function): this; - /** - * Emitted when a drag operation exits the tray icon. - */ - on(event: 'drag-leave', listener: Function): this; - once(event: 'drag-leave', listener: Function): this; - addListener(event: 'drag-leave', listener: Function): this; - removeListener(event: 'drag-leave', listener: Function): this; - /** - * Emitted when any dragged items are dropped on the tray icon. - */ - on(event: 'drop', listener: Function): this; - once(event: 'drop', listener: Function): this; - addListener(event: 'drop', listener: Function): this; - removeListener(event: 'drop', listener: Function): this; - /** - * Emitted when dragged files are dropped in the tray icon. - */ - on(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - once(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - addListener(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - removeListener(event: 'drop-files', listener: (event: Event, - /** - * The paths of the dropped files. - */ - files: string[]) => void): this; - /** - * Emitted when dragged text is dropped in the tray icon. - */ - on(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - once(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - addListener(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - removeListener(event: 'drop-text', listener: (event: Event, - /** - * the dropped text string. - */ - text: string) => void): this; - /** - * Emitted when the mouse enters the tray icon. - */ - on(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the mouse exits the tray icon. - */ - on(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the mouse moves in the tray icon. - */ - on(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - once(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - addListener(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - removeListener(event: 'mouse-move', listener: (event: KeyboardEvent, - /** - * The position of the event. - */ - position: Point) => void): this; - /** - * Emitted when the tray icon is right clicked. - */ - on(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - once(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - addListener(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - removeListener(event: 'right-click', listener: (event: KeyboardEvent, - /** - * The bounds of tray icon. - */ - bounds: Rectangle) => void): this; - constructor(image: (NativeImage) | (string)); - /** - * Destroys the tray icon immediately. - */ - destroy(): void; - /** - * Displays a tray balloon. - */ - displayBalloon(options: DisplayBalloonOptions): void; - /** - * The bounds of this tray icon as Object. - */ - getBounds(): Rectangle; - getIgnoreDoubleClickEvents(): boolean; - getTitle(title: string): string; - isDestroyed(): boolean; - /** - * Pops up the context menu of the tray icon. When menu is passed, the menu will be - * shown instead of the tray icon's context menu. The position is only available on - * Windows, and it is (0, 0) by default. - */ - popUpContextMenu(menu?: Menu, position?: Point): void; - /** - * Sets the context menu for this icon. - */ - setContextMenu(menu: (Menu) | (null)): void; - /** - * Sets when the tray's icon background becomes highlighted (in blue). Deprecated - * Note: You can use highlightMode with a BrowserWindow by toggling between 'never' - * and 'always' modes when the window visibility changes. - */ - setHighlightMode(mode: 'selection' | 'always' | 'never'): void; - /** - * Sets the option to ignore double click events. Ignoring these events allows you - * to detect every individual click of the tray icon. This value is set to false by - * default. - */ - setIgnoreDoubleClickEvents(ignore: boolean): void; - /** - * Sets the image associated with this tray icon. - */ - setImage(image: (NativeImage) | (string)): void; - /** - * Sets the image associated with this tray icon when pressed on macOS. - */ - setPressedImage(image: (NativeImage) | (string)): void; - /** - * Sets the title displayed next to the tray icon in the status bar (Support ANSI - * colors). - */ - setTitle(title: string): void; - /** - * Sets the hover text for this tray icon. - */ - setToolTip(toolTip: string): void; - } - - interface UploadBlob { - - // Docs: http://electronjs.org/docs/api/structures/upload-blob - - /** - * UUID of blob data to upload. - */ - blobUUID: string; - /** - * blob. - */ - type: string; - } - - interface UploadData { - - // Docs: http://electronjs.org/docs/api/structures/upload-data - - /** - * UUID of blob data. Use method to retrieve the data. - */ - blobUUID: string; - /** - * Content being sent. - */ - bytes: Buffer; - /** - * Path of file being uploaded. - */ - file: string; - } - - interface UploadFile { - - // Docs: http://electronjs.org/docs/api/structures/upload-file - - /** - * Path of file to be uploaded. - */ - filePath: string; - /** - * Number of bytes to read from offset. Defaults to 0. - */ - length: number; - /** - * Last Modification time in number of seconds since the UNIX epoch. - */ - modificationTime: number; - /** - * Defaults to 0. - */ - offset: number; - /** - * file. - */ - type: string; - } - - interface UploadRawData { - - // Docs: http://electronjs.org/docs/api/structures/upload-raw-data - - /** - * Data to be uploaded. - */ - bytes: Buffer; - /** - * rawData. - */ - type: string; - } - - class WebContents extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-contents - - static fromId(id: number): WebContents; - static getAllWebContents(): WebContents[]; - static getFocusedWebContents(): WebContents; - /** - * Emitted before dispatching the keydown and keyup events in the page. Calling - * event.preventDefault will prevent the page keydown/keyup events and the menu - * shortcuts. To only prevent the menu shortcuts, use setIgnoreMenuShortcuts: - */ - on(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - once(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - addListener(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - removeListener(event: 'before-input-event', listener: (event: Event, - /** - * Input properties. - */ - input: Input) => void): this; - /** - * Emitted when failed to verify the certificate for url. The usage is the same - * with the certificate-error event of app. - */ - on(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - once(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - addListener(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - removeListener(event: 'certificate-error', listener: (event: Event, - url: string, - /** - * The error code. - */ - error: string, - certificate: Certificate, - callback: (isTrusted: boolean) => void) => void): this; - /** - * Emitted when the associated window logs a console message. Will not be emitted - * for windows with offscreen rendering enabled. - */ - on(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - once(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - addListener(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - removeListener(event: 'console-message', listener: (event: Event, - level: number, - message: string, - line: number, - sourceId: string) => void): this; - /** - * Emitted when there is a new context menu that needs to be handled. - */ - on(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - once(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - addListener(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - removeListener(event: 'context-menu', listener: (event: Event, - params: ContextMenuParams) => void): this; - /** - * Emitted when the renderer process crashes or is killed. - */ - on(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - once(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - addListener(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - removeListener(event: 'crashed', listener: (event: Event, - killed: boolean) => void): this; - /** - * Emitted when the cursor's type changes. The type parameter can be default, - * crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, - * s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, - * nwse-resize, col-resize, row-resize, m-panning, e-panning, n-panning, - * ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, - * vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, - * not-allowed, zoom-in, zoom-out, grab, grabbing or custom. If the type parameter - * is custom, the image parameter will hold the custom cursor image in a - * NativeImage, and scale, size and hotspot will hold additional information about - * the custom cursor. - */ - on(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - once(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - addListener(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - removeListener(event: 'cursor-changed', listener: (event: Event, - type: string, - image?: NativeImage, - /** - * scaling factor for the custom cursor. - */ - scale?: number, - /** - * the size of the `image`. - */ - size?: Size, - /** - * coordinates of the custom cursor's hotspot. - */ - hotspot?: Point) => void): this; - /** - * Emitted when desktopCapturer.getSources() is called in the renderer process. - * Calling event.preventDefault() will make it return empty sources. - */ - on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this; - /** - * Emitted when webContents is destroyed. - */ - on(event: 'destroyed', listener: Function): this; - once(event: 'destroyed', listener: Function): this; - addListener(event: 'destroyed', listener: Function): this; - removeListener(event: 'destroyed', listener: Function): this; - /** - * Emitted when DevTools is closed. - */ - on(event: 'devtools-closed', listener: Function): this; - once(event: 'devtools-closed', listener: Function): this; - addListener(event: 'devtools-closed', listener: Function): this; - removeListener(event: 'devtools-closed', listener: Function): this; - /** - * Emitted when DevTools is focused / opened. - */ - on(event: 'devtools-focused', listener: Function): this; - once(event: 'devtools-focused', listener: Function): this; - addListener(event: 'devtools-focused', listener: Function): this; - removeListener(event: 'devtools-focused', listener: Function): this; - /** - * Emitted when DevTools is opened. - */ - on(event: 'devtools-opened', listener: Function): this; - once(event: 'devtools-opened', listener: Function): this; - addListener(event: 'devtools-opened', listener: Function): this; - removeListener(event: 'devtools-opened', listener: Function): this; - /** - * Emitted when the devtools window instructs the webContents to reload - */ - on(event: 'devtools-reload-page', listener: Function): this; - once(event: 'devtools-reload-page', listener: Function): this; - addListener(event: 'devtools-reload-page', listener: Function): this; - removeListener(event: 'devtools-reload-page', listener: Function): this; - /** - * Emitted when a has been attached to this web contents. - */ - on(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - once(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - addListener(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - removeListener(event: 'did-attach-webview', listener: (event: Event, - /** - * The guest web contents that is used by the ` - */ - webContents: WebContents) => void): this; - /** - * Emitted when a page's theme color changes. This is usually due to encountering a - * meta tag: - */ - on(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - once(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - addListener(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - removeListener(event: 'did-change-theme-color', listener: (event: Event, - /** - * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set. - */ - color: (string) | (null)) => void): this; - /** - * This event is like did-finish-load but emitted when the load failed or was - * cancelled, e.g. window.stop() is invoked. The full list of error codes and their - * meaning is available here. - */ - on(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-fail-load', listener: (event: Event, - errorCode: number, - errorDescription: string, - validatedURL: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when the navigation is done, i.e. the spinner of the tab has stopped - * spinning, and the onload event was dispatched. - */ - on(event: 'did-finish-load', listener: Function): this; - once(event: 'did-finish-load', listener: Function): this; - addListener(event: 'did-finish-load', listener: Function): this; - removeListener(event: 'did-finish-load', listener: Function): this; - /** - * Emitted when a frame has done navigation. - */ - on(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when any frame navigation is done. This event is not emitted for in-page - * navigations, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. - */ - on(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-frame-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations, - */ - httpStatusText: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted when a main frame navigation is done. This event is not emitted for - * in-page navigations, such as clicking anchor links or updating the - * window.location.hash. Use did-navigate-in-page event for this purpose. - */ - on(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - once(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - addListener(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - removeListener(event: 'did-navigate', listener: (event: Event, - url: string, - /** - * -1 for non HTTP navigations - */ - httpResponseCode: number, - /** - * empty for non HTTP navigations - */ - httpStatusText: string) => void): this; - /** - * Emitted when an in-page navigation happened in any frame. When in-page - * navigation happens, the page URL changes but does not cause navigation outside - * of the page. Examples of this occurring are when anchor links are clicked or - * when the DOM hashchange event is triggered. - */ - on(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-navigate-in-page', listener: (event: Event, - url: string, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Emitted after a server side redirect occurs during navigation. For example a - * 302 redirect. This event can not be prevented, if you want to prevent redirects - * you should checkout out the will-redirect event above. - */ - on(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-redirect-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab started spinning. - */ - on(event: 'did-start-loading', listener: Function): this; - once(event: 'did-start-loading', listener: Function): this; - addListener(event: 'did-start-loading', listener: Function): this; - removeListener(event: 'did-start-loading', listener: Function): this; - /** - * Emitted when any frame (including main) starts navigating. isInplace will be - * true for in-page navigations. - */ - on(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'did-start-navigation', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab stopped spinning. - */ - on(event: 'did-stop-loading', listener: Function): this; - once(event: 'did-stop-loading', listener: Function): this; - addListener(event: 'did-stop-loading', listener: Function): this; - removeListener(event: 'did-stop-loading', listener: Function): this; - /** - * Emitted when the document in the given frame is loaded. - */ - on(event: 'dom-ready', listener: (event: Event) => void): this; - once(event: 'dom-ready', listener: (event: Event) => void): this; - addListener(event: 'dom-ready', listener: (event: Event) => void): this; - removeListener(event: 'dom-ready', listener: (event: Event) => void): this; - /** - * Emitted when the window enters a full-screen state triggered by HTML API. - */ - on(event: 'enter-html-full-screen', listener: Function): this; - once(event: 'enter-html-full-screen', listener: Function): this; - addListener(event: 'enter-html-full-screen', listener: Function): this; - removeListener(event: 'enter-html-full-screen', listener: Function): this; - /** - * Emitted when a result is available for [webContents.findInPage] request. - */ - on(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - once(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - addListener(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - removeListener(event: 'found-in-page', listener: (event: Event, - result: Result) => void): this; - /** - * Emitted when the renderer process sends an asynchronous message via - * ipcRenderer.send(). - */ - on(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - once(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - addListener(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - removeListener(event: 'ipc-message', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - /** - * Emitted when the renderer process sends a synchronous message via - * ipcRenderer.sendSync(). - */ - on(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - once(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - addListener(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - removeListener(event: 'ipc-message-sync', listener: (event: Event, - channel: string, - ...args: any[]) => void): this; - /** - * Emitted when the window leaves a full-screen state triggered by HTML API. - */ - on(event: 'leave-html-full-screen', listener: Function): this; - once(event: 'leave-html-full-screen', listener: Function): this; - addListener(event: 'leave-html-full-screen', listener: Function): this; - removeListener(event: 'leave-html-full-screen', listener: Function): this; - /** - * Emitted when webContents wants to do basic auth. The usage is the same with the - * login event of app. - */ - on(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - once(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - addListener(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - removeListener(event: 'login', listener: (event: Event, - request: Request, - authInfo: AuthInfo, - callback: (username: string, password: string) => void) => void): this; - /** - * Emitted when media is paused or done playing. - */ - on(event: 'media-paused', listener: Function): this; - once(event: 'media-paused', listener: Function): this; - addListener(event: 'media-paused', listener: Function): this; - removeListener(event: 'media-paused', listener: Function): this; - /** - * Emitted when media starts playing. - */ - on(event: 'media-started-playing', listener: Function): this; - once(event: 'media-started-playing', listener: Function): this; - addListener(event: 'media-started-playing', listener: Function): this; - removeListener(event: 'media-started-playing', listener: Function): this; - /** - * Emitted when the page requests to open a new window for a url. It could be - * requested by window.open or an external link like . By - * default a new BrowserWindow will be created for the url. Calling - * event.preventDefault() will prevent Electron from automatically creating a new - * BrowserWindow. If you call event.preventDefault() and manually create a new - * BrowserWindow then you must set event.newGuest to reference the new - * BrowserWindow instance, failing to do so may result in unexpected behavior. For - * example: - */ - on(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - once(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - addListener(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - removeListener(event: 'new-window', listener: (event: Event, - url: string, - frameName: string, - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - /** - * The options which will be used for creating the new . - */ - options: any, - /** - * The non-standard features (features not handled by Chromium or Electron) given - * to `window.open()`. - */ - additionalFeatures: string[], - /** - * The referrer that will be passed to the new window. May or may not result in the - * `Referer` header being sent, depending on the referrer policy. - */ - referrer: Referrer) => void): this; - /** - * Emitted when page receives favicon urls. - */ - on(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - once(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - addListener(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - removeListener(event: 'page-favicon-updated', listener: (event: Event, - /** - * Array of URLs. - */ - favicons: string[]) => void): this; - /** - * Fired when page title is set during navigation. explicitSet is false when title - * is synthesized from file url. - */ - on(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - once(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - addListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - removeListener(event: 'page-title-updated', listener: (event: Event, - title: string, - explicitSet: boolean) => void): this; - /** - * Emitted when a new frame is generated. Only the dirty area is passed in the - * buffer. - */ - on(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - once(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - addListener(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - removeListener(event: 'paint', listener: (event: Event, - dirtyRect: Rectangle, - /** - * The image data of the whole frame. - */ - image: NativeImage) => void): this; - /** - * Emitted when a plugin process has crashed. - */ - on(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - once(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - addListener(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - removeListener(event: 'plugin-crashed', listener: (event: Event, - name: string, - version: string) => void): this; - /** - * Emitted when the preload script preloadPath throws an unhandled exception error. - */ - on(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - once(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - addListener(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - removeListener(event: 'preload-error', listener: (event: Event, - preloadPath: string, - error: Error) => void): this; - /** - * Emitted when remote.getBuiltin() is called in the renderer process. Calling - * event.preventDefault() will prevent the module from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - once(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - addListener(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - removeListener(event: 'remote-get-builtin', listener: (event: Event, - moduleName: string) => void): this; - /** - * Emitted when remote.getCurrentWebContents() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - once(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - addListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - removeListener(event: 'remote-get-current-web-contents', listener: (event: Event) => void): this; - /** - * Emitted when remote.getCurrentWindow() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-current-window', listener: (event: Event) => void): this; - once(event: 'remote-get-current-window', listener: (event: Event) => void): this; - addListener(event: 'remote-get-current-window', listener: (event: Event) => void): this; - removeListener(event: 'remote-get-current-window', listener: (event: Event) => void): this; - /** - * Emitted when remote.getGlobal() is called in the renderer process. Calling - * event.preventDefault() will prevent the global from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - once(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - addListener(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - removeListener(event: 'remote-get-global', listener: (event: Event, - globalName: string) => void): this; - /** - * Emitted when .getWebContents() is called in the renderer process. - * Calling event.preventDefault() will prevent the object from being returned. - * Custom value can be returned by setting event.returnValue. - */ - on(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - once(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - addListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event, - guestWebContents: WebContents) => void): this; - /** - * Emitted when remote.require() is called in the renderer process. Calling - * event.preventDefault() will prevent the module from being returned. Custom value - * can be returned by setting event.returnValue. - */ - on(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - once(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - addListener(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - removeListener(event: 'remote-require', listener: (event: Event, - moduleName: string) => void): this; - /** - * Emitted when the unresponsive web page becomes responsive again. - */ - on(event: 'responsive', listener: Function): this; - once(event: 'responsive', listener: Function): this; - addListener(event: 'responsive', listener: Function): this; - removeListener(event: 'responsive', listener: Function): this; - /** - * Emitted when bluetooth device needs to be selected on call to - * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth - * should be enabled. If event.preventDefault is not called, first available device - * will be selected. callback should be called with deviceId to be selected, - * passing empty string to callback will cancel the request. - */ - on(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - once(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - addListener(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - removeListener(event: 'select-bluetooth-device', listener: (event: Event, - devices: BluetoothDevice[], - callback: (deviceId: string) => void) => void): this; - /** - * Emitted when a client certificate is requested. The usage is the same with the - * select-client-certificate event of app. - */ - on(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - once(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - addListener(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - removeListener(event: 'select-client-certificate', listener: (event: Event, - url: string, - certificateList: Certificate[], - callback: (certificate: Certificate) => void) => void): this; - /** - * Emitted when the web page becomes unresponsive. - */ - on(event: 'unresponsive', listener: Function): this; - once(event: 'unresponsive', listener: Function): this; - addListener(event: 'unresponsive', listener: Function): this; - removeListener(event: 'unresponsive', listener: Function): this; - /** - * Emitted when mouse moves over a link or the keyboard moves the focus to a link. - */ - on(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - once(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - addListener(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'update-target-url', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when a 's web contents is being attached to this web contents. - * Calling event.preventDefault() will destroy the guest page. This event can be - * used to configure webPreferences for the webContents of a before it's - * loaded, and provides the ability to set settings that can't be set via - * attributes. Note: The specified preload script option will be appear as - * preloadURL (not preload) in the webPreferences object emitted with this event. - */ - on(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - once(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - addListener(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - removeListener(event: 'will-attach-webview', listener: (event: Event, - /** - * The web preferences that will be used by the guest page. This object can be - * modified to adjust the preferences for the guest page. - */ - webPreferences: any, - /** - * The other ` - */ - params: any) => void): this; - /** - * Emitted when a user or the page wants to start navigation. It can happen when - * the window.location object is changed or a user clicks a link in the page. This - * event will not emit when the navigation is started programmatically with APIs - * like webContents.loadURL and webContents.back. It is also not emitted for - * in-page navigations, such as clicking anchor links or updating the - * window.location.hash. Use did-navigate-in-page event for this purpose. Calling - * event.preventDefault() will prevent the navigation. - */ - on(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - once(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - addListener(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'will-navigate', listener: (event: Event, - url: string) => void): this; - /** - * Emitted when a beforeunload event handler is attempting to cancel a page unload. - * Calling event.preventDefault() will ignore the beforeunload event handler and - * allow the page to be unloaded. - */ - on(event: 'will-prevent-unload', listener: (event: Event) => void): this; - once(event: 'will-prevent-unload', listener: (event: Event) => void): this; - addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; - removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this; - /** - * Emitted as a server side redirect occurs during navigation. For example a 302 - * redirect. This event will be emitted after did-start-navigation and always - * before the did-redirect-navigation event for the same navigation. Calling - * event.preventDefault() will prevent the navigation (not just the redirect). - */ - on(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - once(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - addListener(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - removeListener(event: 'will-redirect', listener: (event: Event, - url: string, - isInPlace: boolean, - isMainFrame: boolean, - frameProcessId: number, - frameRoutingId: number) => void): this; - /** - * Adds the specified path to DevTools workspace. Must be used after DevTools - * creation: - */ - addWorkSpace(path: string): void; - /** - * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(image, dirtyRect) when there is a presentation event. - * The image is an instance of NativeImage that stores the captured frame. The - * dirtyRect is an object with x, y, width, height properties that describes which - * part of the page was repainted. If onlyDirty is set to true, image will only - * contain the repainted area. onlyDirty defaults to false. - */ - beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; - /** - * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(image, dirtyRect) when there is a presentation event. - * The image is an instance of NativeImage that stores the captured frame. The - * dirtyRect is an object with x, y, width, height properties that describes which - * part of the page was repainted. If onlyDirty is set to true, image will only - * contain the repainted area. onlyDirty defaults to false. - */ - beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; - canGoBack(): boolean; - canGoForward(): boolean; - canGoToOffset(offset: number): boolean; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Clears the navigation history. - */ - clearHistory(): void; - /** - * Closes the devtools. - */ - closeDevTools(): void; - /** - * Executes the editing command copy in web page. - */ - copy(): void; - /** - * Copy the image at the given position to the clipboard. - */ - copyImageAt(x: number, y: number): void; - /** - * Executes the editing command cut in web page. - */ - cut(): void; - /** - * Executes the editing command delete in web page. - */ - delete(): void; - /** - * Disable device emulation enabled by webContents.enableDeviceEmulation. - */ - disableDeviceEmulation(): void; - /** - * Initiates a download of the resource at url without navigating. The - * will-download event of session will be triggered. - */ - downloadURL(url: string): void; - /** - * Enable device emulation with the given parameters. - */ - enableDeviceEmulation(parameters: Parameters): void; - /** - * End subscribing for frame presentation events. - */ - endFrameSubscription(): void; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Starts a request to find all matches for the text in the web page. The result of - * the request can be obtained by subscribing to found-in-page event. - */ - findInPage(text: string, options?: FindInPageOptions): number; - /** - * Focuses the web page. - */ - focus(): void; - getFrameRate(): number; - getOSProcessId(): number; - /** - * Get the system printer list. - */ - getPrinters(): PrinterInfo[]; - getProcessId(): number; - getTitle(): string; - getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen'); - getURL(): string; - getUserAgent(): string; - getWebRTCIPHandlingPolicy(): string; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Makes the browser go back a web page. - */ - goBack(): void; - /** - * Makes the browser go forward a web page. - */ - goForward(): void; - /** - * Navigates browser to the specified absolute web page index. - */ - goToIndex(index: number): void; - /** - * Navigates to the specified offset from the "current entry". - */ - goToOffset(offset: number): void; - /** - * Injects CSS into the current web page. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Starts inspecting element at position (x, y). - */ - inspectElement(x: number, y: number): void; - /** - * Opens the developer tools for the service worker context. - */ - inspectServiceWorker(): void; - /** - * Opens the developer tools for the shared worker context. - */ - inspectSharedWorker(): void; - /** - * Schedules a full repaint of the window this web contents is in. If offscreen - * rendering is enabled invalidates the frame and generates a new one through the - * 'paint' event. - */ - invalidate(): void; - isAudioMuted(): boolean; - isCrashed(): boolean; - isCurrentlyAudible(): boolean; - isDestroyed(): boolean; - isDevToolsFocused(): boolean; - isDevToolsOpened(): boolean; - isFocused(): boolean; - isLoading(): boolean; - isLoadingMainFrame(): boolean; - isOffscreen(): boolean; - isPainting(): boolean; - isWaitingForResponse(): boolean; - /** - * Loads the given file in the window, filePath should be a path to an HTML file - * relative to the root of your application. For instance an app structure like - * this: Would require code like this - */ - loadFile(filePath: string, options?: LoadFileOptions): Promise; - /** - * Loads the url in the window. The url must contain the protocol prefix, e.g. the - * http:// or file://. If the load should bypass http cache then use the pragma - * header to achieve it. - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Opens the devtools. When contents is a tag, the mode would be detach - * by default, explicitly passing an empty mode can force using last used dock - * state. - */ - openDevTools(options?: OpenDevToolsOptions): void; - /** - * Executes the editing command paste in web page. - */ - paste(): void; - /** - * Executes the editing command pasteAndMatchStyle in web page. - */ - pasteAndMatchStyle(): void; - /** - * Prints window's web page. When silent is set to true, Electron will pick the - * system's default printer if deviceName is empty and the default settings for - * printing. Calling window.print() in web page is equivalent to calling - * webContents.print({ silent: false, printBackground: false, deviceName: '' }). - * Use page-break-before: always; CSS style to force to print to a new page. - */ - print(options?: PrintOptions, callback?: (success: boolean) => void): void; - /** - * Prints window's web page as PDF with Chromium's preview printing custom - * settings. The landscape will be ignored if @page CSS at-rule is used in the web - * page. By default, an empty options will be regarded as: Use page-break-before: - * always; CSS style to force to print to a new page. An example of - * webContents.printToPDF: - */ - printToPDF(options: PrintToPDFOptions): Promise; - /** - * Prints window's web page as PDF with Chromium's preview printing custom - * settings. The callback will be called with callback(error, data) on completion. - * The data is a Buffer that contains the generated PDF data. Deprecated Soon - */ - printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; - /** - * Executes the editing command redo in web page. - */ - redo(): void; - /** - * Reloads the current web page. - */ - reload(): void; - /** - * Reloads current page and ignores cache. - */ - reloadIgnoringCache(): void; - /** - * Removes the specified path from DevTools workspace. - */ - removeWorkSpace(path: string): void; - /** - * Executes the editing command replace in web page. - */ - replace(text: string): void; - /** - * Executes the editing command replaceMisspelling in web page. - */ - replaceMisspelling(text: string): void; - savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise; - /** - * Executes the editing command selectAll in web page. - */ - selectAll(): void; - /** - * Send an asynchronous message to renderer process via channel, you can also send - * arbitrary arguments. Arguments will be serialized in JSON internally and hence - * no functions or prototype chain will be included. The renderer process can - * handle the message by listening to channel with the ipcRenderer module. An - * example of sending messages from the main process to the renderer process: - */ - send(channel: string, ...args: any[]): void; - /** - * Sends an input event to the page. Note: The BrowserWindow containing the - * contents needs to be focused for sendInputEvent() to work. For keyboard events, - * the event object also have following properties: For mouse events, the event - * object also have following properties: For the mouseWheel event, the event - * object also have following properties: - */ - sendInputEvent(event: Event): void; - /** - * Send an asynchronous message to a specific frame in a renderer process via - * channel. Arguments will be serialized as JSON internally and as such no - * functions or prototype chains will be included. The renderer process can handle - * the message by listening to channel with the ipcRenderer module. If you want to - * get the frameId of a given renderer context you should use the - * webFrame.routingId value. E.g. You can also read frameId from all incoming IPC - * messages in the main process. - */ - sendToFrame(frameId: number, channel: string, ...args: any[]): void; - /** - * Mute the audio on the current web page. - */ - setAudioMuted(muted: boolean): void; - /** - * Controls whether or not this WebContents will throttle animations and timers - * when the page becomes backgrounded. This also affects the Page Visibility API. - */ - setBackgroundThrottling(allowed: boolean): void; - /** - * Uses the devToolsWebContents as the target WebContents to show devtools. The - * devToolsWebContents must not have done any navigation, and it should not be used - * for other purposes after the call. By default Electron manages the devtools by - * creating an internal WebContents with native view, which developers have very - * limited control of. With the setDevToolsWebContents method, developers can use - * any WebContents to show the devtools in it, including BrowserWindow, BrowserView - * and tag. Note that closing the devtools does not destroy the - * devToolsWebContents, it is caller's responsibility to destroy - * devToolsWebContents. An example of showing devtools in a tag: An - * example of showing devtools in a BrowserWindow: - */ - setDevToolsWebContents(devToolsWebContents: WebContents): void; - /** - * If offscreen rendering is enabled sets the frame rate to the specified number. - * Only values between 1 and 60 are accepted. - */ - setFrameRate(fps: number): void; - /** - * Ignore application menu shortcuts while this web contents is focused. - */ - setIgnoreMenuShortcuts(ignore: boolean): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Overrides the user agent for this web page. - */ - setUserAgent(userAgent: string): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Setting the WebRTC IP handling policy allows you to control which IPs are - * exposed via WebRTC. See BrowserLeaks for more details. - */ - setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. The formula for this is - * scale := 1.2 ^ level. - */ - setZoomLevel(level: number): void; - /** - * Shows pop-up dictionary that searches the selected word on the page. - */ - showDefinitionForSelection(): void; - /** - * Sets the item as dragging item for current drag-drop operation, file is the - * absolute path of the file to be dragged, and icon is the image showing under the - * cursor when dragging. - */ - startDrag(item: Item): void; - /** - * If offscreen rendering is enabled and not painting, start painting. - */ - startPainting(): void; - /** - * Stops any pending navigation. - */ - stop(): void; - /** - * Stops any findInPage request for the webContents with the provided action. - */ - stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; - /** - * If offscreen rendering is enabled and painting, stop painting. - */ - stopPainting(): void; - /** - * Takes a V8 heap snapshot and saves it to filePath. - */ - takeHeapSnapshot(filePath: string): Promise; - /** - * Toggles the developer tools. - */ - toggleDevTools(): void; - /** - * Executes the editing command undo in web page. - */ - undo(): void; - /** - * Executes the editing command unselect in web page. - */ - unselect(): void; - debugger: Debugger; - devToolsWebContents: WebContents; - hostWebContents: WebContents; - id: number; - session: Session; - } - - interface WebFrame extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-frame - - /** - * Attempts to free memory that is no longer being used (like images from a - * previous navigation). Note that blindly calling this method probably makes - * Electron slower since it will have to refill these emptied caches, you should - * only call it if an event in your app has occurred that makes you think your page - * is actually using less memory (i.e. you have navigated from a super heavy page - * to a mostly empty one, and intend to stay there). - */ - clearCache(): void; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Evaluates code in page. In the browser window some HTML APIs like - * requestFullScreen can only be invoked by a gesture from the user. Setting - * userGesture to true will remove this limitation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Works like executeJavaScript but evaluates scripts in an isolated context. - * Deprecated Soon - */ - executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Works like executeJavaScript but evaluates scripts in an isolated context. - */ - executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise; - findFrameByName(name: string): WebFrame; - findFrameByRoutingId(routingId: number): WebFrame; - getFrameForSelector(selector: string): WebFrame; - /** - * Returns an object describing usage information of Blink's internal memory - * caches. This will generate: - */ - getResourceUsage(): ResourceUsage; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Inserts css as a style sheet in the document. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Set the content security policy of the isolated world. - */ - setIsolatedWorldContentSecurityPolicy(worldId: number, csp: string): void; - /** - * Set the name of the isolated world. Useful in devtools. - */ - setIsolatedWorldHumanReadableName(worldId: number, name: string): void; - /** - * Set the security origin, content security policy and name of the isolated world. - * Note: If the csp is specified, then the securityOrigin also has to be specified. - */ - setIsolatedWorldInfo(worldId: number, info: Info): void; - /** - * Set the security origin of the isolated world. - */ - setIsolatedWorldSecurityOrigin(worldId: number, securityOrigin: string): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Sets a provider for spell checking in input fields and text areas. The provider - * must be an object that has a spellCheck method that accepts an array of - * individual words for spellchecking. The spellCheck function runs asynchronously - * and calls the callback function with an array of misspelt words when complete. - * An example of using node-spellchecker as provider: - */ - setSpellCheckProvider(language: string, provider: Provider): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. - */ - setZoomLevel(level: number): void; - /** - * A WebFrame representing the first child frame of webFrame, the property would be - * null if webFrame has no children or if first child is not in the current - * renderer process. - */ - firstChild?: WebFrame; - /** - * A WebFrame representing next sibling frame, the property would be null if - * webFrame is the last frame in its parent or if the next sibling is not in the - * current renderer process. - */ - nextSibling?: WebFrame; - /** - * A WebFrame representing the frame which opened webFrame, the property would be - * null if there's no opener or opener is not in the current renderer process. - */ - opener?: WebFrame; - /** - * A WebFrame representing parent frame of webFrame, the property would be null if - * webFrame is top or parent is not in the current renderer process. - */ - parent?: WebFrame; - /** - * An Integer representing the unique frame id in the current renderer process. - * Distinct WebFrame instances that refer to the same underlying frame will have - * the same routingId. - */ - routingId?: number; - /** - * A WebFrame representing top frame in frame hierarchy to which webFrame belongs, - * the property would be null if top frame is not in the current renderer process. - */ - top?: WebFrame; - } - - class WebRequest extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/web-request - - /** - * The listener will be called with listener(details) when a server initiated - * redirect is about to occur. - */ - onBeforeRedirect(listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a server initiated - * redirect is about to occur. - */ - onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when a request is - * about to occur. The uploadData is an array of UploadData objects. The callback - * has to be called with an response object. Some examples of valid urls: - */ - onBeforeRequest(listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when a request is - * about to occur. The uploadData is an array of UploadData objects. The callback - * has to be called with an response object. Some examples of valid urls: - */ - onBeforeRequest(filter: OnBeforeRequestFilter, listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) before sending an - * HTTP request, once the request headers are available. This may occur after a TCP - * connection is made to the server, but before any http data is sent. The callback - * has to be called with an response object. - */ - onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) before sending an - * HTTP request, once the request headers are available. This may occur after a TCP - * connection is made to the server, but before any http data is sent. The callback - * has to be called with an response object. - */ - onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a request is completed. - */ - onCompleted(filter: OnCompletedFilter, listener: ((details: OnCompletedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when a request is completed. - */ - onCompleted(listener: ((details: OnCompletedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when an error occurs. - */ - onErrorOccurred(listener: ((details: OnErrorOccurredDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when an error occurs. - */ - onErrorOccurred(filter: OnErrorOccurredFilter, listener: ((details: OnErrorOccurredDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when HTTP response - * headers of a request have been received. The callback has to be called with an - * response object. - */ - onHeadersReceived(filter: OnHeadersReceivedFilter, listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details, callback) when HTTP response - * headers of a request have been received. The callback has to be called with an - * response object. - */ - onHeadersReceived(listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void; - /** - * The listener will be called with listener(details) when first byte of the - * response body is received. For HTTP requests, this means that the status line - * and response headers are available. - */ - onResponseStarted(listener: ((details: OnResponseStartedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) when first byte of the - * response body is received. For HTTP requests, this means that the status line - * and response headers are available. - */ - onResponseStarted(filter: OnResponseStartedFilter, listener: ((details: OnResponseStartedDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) just before a request is - * going to be sent to the server, modifications of previous onBeforeSendHeaders - * response are visible by the time this listener is fired. - */ - onSendHeaders(filter: OnSendHeadersFilter, listener: ((details: OnSendHeadersDetails) => void) | (null)): void; - /** - * The listener will be called with listener(details) just before a request is - * going to be sent to the server, modifications of previous onBeforeSendHeaders - * response are visible by the time this listener is fired. - */ - onSendHeaders(listener: ((details: OnSendHeadersDetails) => void) | (null)): void; - } - - interface WebSource { - - // Docs: http://electronjs.org/docs/api/structures/web-source - - code: string; - /** - * Default is 1. - */ - startLine?: number; - url?: string; - } - - interface WebviewTag extends HTMLElement { - - // Docs: http://electronjs.org/docs/api/webview-tag - - /** - * Fired when a load has committed. This includes navigation within the current - * document as well as subframe document-level loads, but does not include - * asynchronous resource loads. - */ - addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this; - /** - * Fired when the navigation is done, i.e. the spinner of the tab will stop - * spinning, and the onload event is dispatched. - */ - addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this; - /** - * This event is like did-finish-load, but fired when the load failed or was - * cancelled, e.g. window.stop() is invoked. - */ - addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this; - /** - * Fired when a frame has done navigation. - */ - addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab starts spinning. - */ - addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this; - /** - * Corresponds to the points in time when the spinner of the tab stops spinning. - */ - addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this; - /** - * Fired when document in the given frame is loaded. - */ - addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this; - /** - * Fired when page title is set during navigation. explicitSet is false when title - * is synthesized from file url. - */ - addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this; - /** - * Fired when page receives favicon urls. - */ - addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this; - /** - * Fired when page enters fullscreen triggered by HTML API. - */ - addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this; - /** - * Fired when page leaves fullscreen triggered by HTML API. - */ - addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this; - /** - * Fired when the guest window logs a console message. The following example code - * forwards all log messages to the embedder's console without regard for log level - * or other properties. - */ - addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this; - /** - * Fired when a result is available for webview.findInPage request. - */ - addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this; - /** - * Fired when the guest page attempts to open a new browser window. The following - * example code opens the new url in system's default browser. - */ - addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this; - /** - * Emitted when a user or the page wants to start navigation. It can happen when - * the window.location object is changed or a user clicks a link in the page. This - * event will not emit when the navigation is started programmatically with APIs - * like .loadURL and .back. It is also not emitted during in-page - * navigation, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. Calling event.preventDefault() - * does NOT have any effect. - */ - addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this; - /** - * Emitted when a navigation is done. This event is not emitted for in-page - * navigations, such as clicking anchor links or updating the window.location.hash. - * Use did-navigate-in-page event for this purpose. - */ - addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this; - /** - * Emitted when an in-page navigation happened. When in-page navigation happens, - * the page URL changes but does not cause navigation outside of the page. Examples - * of this occurring are when anchor links are clicked or when the DOM hashchange - * event is triggered. - */ - addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this; - /** - * Fired when the guest page attempts to close itself. The following example code - * navigates the webview to about:blank when the guest attempts to close itself. - */ - addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'close', listener: (event: Event) => void): this; - /** - * Fired when the guest page has sent an asynchronous message to embedder page. - * With sendToHost method and ipc-message event you can communicate between guest - * page and embedder page: - */ - addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this; - /** - * Fired when the renderer process is crashed. - */ - addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'crashed', listener: (event: Event) => void): this; - /** - * Fired when a plugin process is crashed. - */ - addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this; - /** - * Fired when the WebContents is destroyed. - */ - addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'destroyed', listener: (event: Event) => void): this; - /** - * Emitted when media starts playing. - */ - addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this; - /** - * Emitted when media is paused or done playing. - */ - addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'media-paused', listener: (event: Event) => void): this; - /** - * Emitted when a page's theme color changes. This is usually due to encountering a - * meta tag: - */ - addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this; - /** - * Emitted when mouse moves over a link or the keyboard moves the focus to a link. - */ - addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this; - /** - * Emitted when DevTools is opened. - */ - addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this; - /** - * Emitted when DevTools is closed. - */ - addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this; - /** - * Emitted when DevTools is focused / opened. - */ - addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this; - removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this; - addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - removeEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - canGoBack(): boolean; - canGoForward(): boolean; - canGoToOffset(offset: number): boolean; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Upon completion callback will be - * called with callback(image). The image is an instance of NativeImage that stores - * data of the snapshot. Omitting rect will capture the whole visible page. - * Deprecated Soon - */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; - /** - * Captures a snapshot of the page within rect. Omitting rect will capture the - * whole visible page. - */ - capturePage(rect?: Rectangle): Promise; - /** - * Clears the navigation history. - */ - clearHistory(): void; - /** - * Closes the DevTools window of guest page. - */ - closeDevTools(): void; - /** - * Executes editing command copy in page. - */ - copy(): void; - /** - * Executes editing command cut in page. - */ - cut(): void; - /** - * Executes editing command delete in page. - */ - delete(): void; - /** - * Initiates a download of the resource at url without navigating. - */ - downloadURL(url: string): void; - /** - * Evaluates code in page. If userGesture is set, it will create the user gesture - * context in the page. HTML APIs like requestFullScreen, which require user - * action, can take advantage of this option for automation. Deprecated Soon - */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; - /** - * Evaluates code in page. If userGesture is set, it will create the user gesture - * context in the page. HTML APIs like requestFullScreen, which require user - * action, can take advantage of this option for automation. - */ - executeJavaScript(code: string, userGesture?: boolean): Promise; - /** - * Starts a request to find all matches for the text in the web page. The result of - * the request can be obtained by subscribing to found-in-page event. - */ - findInPage(text: string, options?: FindInPageOptions): number; - getTitle(): string; - getURL(): string; - getUserAgent(): string; - /** - * It depends on the remote module, it is therefore not available when this module - * is disabled. - */ - getWebContents(): WebContents; - getWebContentsId(): number; - getZoomFactor(): number; - getZoomLevel(): number; - /** - * Makes the guest page go back. - */ - goBack(): void; - /** - * Makes the guest page go forward. - */ - goForward(): void; - /** - * Navigates to the specified absolute index. - */ - goToIndex(index: number): void; - /** - * Navigates to the specified offset from the "current entry". - */ - goToOffset(offset: number): void; - /** - * Injects CSS into the guest page. - */ - insertCSS(css: string): void; - /** - * Inserts text to the focused element. - */ - insertText(text: string): void; - /** - * Starts inspecting element at position (x, y) of guest page. - */ - inspectElement(x: number, y: number): void; - /** - * Opens the DevTools for the service worker context present in the guest page. - */ - inspectServiceWorker(): void; - /** - * Opens the DevTools for the shared worker context present in the guest page. - */ - inspectSharedWorker(): void; - isAudioMuted(): boolean; - isCrashed(): boolean; - isCurrentlyAudible(): boolean; - isDevToolsFocused(): boolean; - isDevToolsOpened(): boolean; - isLoading(): boolean; - isLoadingMainFrame(): boolean; - isWaitingForResponse(): boolean; - /** - * Loads the url in the webview, the url must contain the protocol prefix, e.g. the - * http:// or file://. - */ - loadURL(url: string, options?: LoadURLOptions): Promise; - /** - * Opens a DevTools window for guest page. - */ - openDevTools(): void; - /** - * Executes editing command paste in page. - */ - paste(): void; - /** - * Executes editing command pasteAndMatchStyle in page. - */ - pasteAndMatchStyle(): void; - /** - * Prints webview's web page. Same as webContents.print([options]). - */ - print(options?: PrintOptions): void; - /** - * Prints webview's web page as PDF, Same as webContents.printToPDF(options, - * callback). Deprecated Soon - */ - printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; - /** - * Prints webview's web page as PDF, Same as webContents.printToPDF(options). - */ - printToPDF(options: PrintToPDFOptions): Promise; - /** - * Executes editing command redo in page. - */ - redo(): void; - /** - * Reloads the guest page. - */ - reload(): void; - /** - * Reloads the guest page and ignores cache. - */ - reloadIgnoringCache(): void; - /** - * Executes editing command replace in page. - */ - replace(text: string): void; - /** - * Executes editing command replaceMisspelling in page. - */ - replaceMisspelling(text: string): void; - /** - * Executes editing command selectAll in page. - */ - selectAll(): void; - /** - * Send an asynchronous message to renderer process via channel, you can also send - * arbitrary arguments. The renderer process can handle the message by listening to - * the channel event with the ipcRenderer module. See webContents.send for - * examples. - */ - send(channel: string, ...args: any[]): void; - /** - * Sends an input event to the page. See webContents.sendInputEvent for detailed - * description of event object. - */ - sendInputEvent(event: any): void; - /** - * Set guest page muted. - */ - setAudioMuted(muted: boolean): void; - /** - * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. - */ - setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Overrides the user agent for the guest page. - */ - setUserAgent(userAgent: string): void; - /** - * Sets the maximum and minimum pinch-to-zoom level. - */ - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Changes the zoom factor to the specified factor. Zoom factor is zoom percent - * divided by 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * Changes the zoom level to the specified level. The original size is 0 and each - * increment above or below represents zooming 20% larger or smaller to default - * limits of 300% and 50% of original size, respectively. The formula for this is - * scale := 1.2 ^ level. - */ - setZoomLevel(level: number): void; - /** - * Shows pop-up dictionary that searches the selected word on the page. - */ - showDefinitionForSelection(): void; - /** - * Stops any pending navigation. - */ - stop(): void; - /** - * Stops any findInPage request for the webview with the provided action. - */ - stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void; - /** - * Executes editing command undo in page. - */ - undo(): void; - /** - * Executes editing command unselect in page. - */ - unselect(): void; - /** - * When this attribute is present the guest page will be allowed to open new - * windows. Popups are disabled by default. - */ - // allowpopups?: string; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * A list of strings which specifies the blink features to be disabled separated by - * ,. The full list of supported feature strings can be found in the - * RuntimeEnabledFeatures.json5 file. - */ - disableblinkfeatures?: string; - /** - * When this attribute is present the guest page will have web security disabled. - * Web security is enabled by default. - */ - // disablewebsecurity?: string; ### VSCODE CHANGE(https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * A list of strings which specifies the blink features to be enabled separated by - * ,. The full list of supported feature strings can be found in the - * RuntimeEnabledFeatures.json5 file. - */ - enableblinkfeatures?: string; - /** - * When this attribute is false the guest page in webview will not have access to - * the remote module. The remote module is available by default. - */ - enableremotemodule?: string; - /** - * Sets the referrer URL for the guest page. - */ - httpreferrer?: string; - /** - * When this attribute is present the guest page in webview will have node - * integration and can use node APIs like require and process to access low level - * system resources. Node integration is disabled by default in the guest page. - */ - nodeintegration?: string; - /** - * Experimental option for enabling NodeJS support in sub-frames such as iframes - * inside the webview. All your preloads will load for every iframe, you can use - * process.isMainFrame to determine if you are in the main frame or not. This - * option is disabled by default in the guest page. - */ - nodeintegrationinsubframes?: string; - /** - * Sets the session used by the page. If partition starts with persist:, the page - * will use a persistent session available to all pages in the app with the same - * partition. if there is no persist: prefix, the page will use an in-memory - * session. By assigning the same partition, multiple pages can share the same - * session. If the partition is unset then default session of the app will be used. - * This value can only be modified before the first navigation, since the session - * of an active renderer process cannot change. Subsequent attempts to modify the - * value will fail with a DOM exception. - */ - partition?: string; - /** - * When this attribute is present the guest page in webview will be able to use - * browser plugins. Plugins are disabled by default. - */ - plugins?: string; - /** - * Specifies a script that will be loaded before other scripts run in the guest - * page. The protocol of script's URL must be either file: or asar:, because it - * will be loaded by require in guest page under the hood. When the guest page - * doesn't have node integration this script will still have access to all Node - * APIs, but global objects injected by Node will be deleted after this script has - * finished executing. Note: This option will be appear as preloadURL (not preload) - * in the webPreferences specified to the will-attach-webview event. - */ - preload?: string; - /** - * Returns the visible URL. Writing to this attribute initiates top-level - * navigation. Assigning src its own value will reload the current page. The src - * attribute can also accept data URLs, such as data:text/plain,Hello, world!. - */ - src?: string; - /** - * Sets the user agent for the guest page before the page is navigated to. Once the - * page is loaded, use the setUserAgent method to change the user agent. - */ - useragent?: string; - /** - * A list of strings which specifies the web preferences to be set on the webview, - * separated by ,. The full list of supported preference strings can be found in - * BrowserWindow. The string follows the same format as the features string in - * window.open. A name by itself is given a true boolean value. A preference can be - * set to another value by including an =, followed by the value. Special values - * yes and 1 are interpreted as true, while no and 0 are interpreted as false. - */ - webpreferences?: string; - } - - interface AboutPanelOptionsOptions { - /** - * The app's name. - */ - applicationName?: string; - /** - * The app's version. - */ - applicationVersion?: string; - /** - * Copyright information. - */ - copyright?: string; - /** - * The app's build version number. - */ - version?: string; - /** - * Credit information. - */ - credits?: string; - /** - * The app's website. - */ - website?: string; - /** - * Path to the app's icon. Will be shown as 64x64 pixels while retaining aspect - * ratio. - */ - iconPath?: string; - } - - interface AddRepresentationOptions { - /** - * The scale factor to add the image representation for. - */ - scaleFactor: number; - /** - * Defaults to 0. Required if a bitmap buffer is specified as buffer. - */ - width?: number; - /** - * Defaults to 0. Required if a bitmap buffer is specified as buffer. - */ - height?: number; - /** - * The buffer containing the raw image data. - */ - buffer?: Buffer; - /** - * The data URL containing either a base 64 encoded PNG or JPEG image. - */ - dataURL?: string; - } - - interface AnimationSettings { - /** - * Returns true if rich animations should be rendered. Looks at session type (e.g. - * remote desktop) and accessibility settings to give guidance for heavy - * animations. - */ - shouldRenderRichAnimation: boolean; - /** - * Determines on a per-platform basis whether scroll animations (e.g. produced by - * home/end key) should be enabled. - */ - scrollAnimationsEnabledBySystem: boolean; - /** - * Determines whether the user desires reduced motion based on platform APIs. - */ - prefersReducedMotion: boolean; - } - - interface AppDetailsOptions { - /** - * Window's . It has to be set, otherwise the other options will have no effect. - */ - appId?: string; - /** - * Window's . - */ - appIconPath?: string; - /** - * Index of the icon in appIconPath. Ignored when appIconPath is not set. Default - * is 0. - */ - appIconIndex?: number; - /** - * Window's . - */ - relaunchCommand?: string; - /** - * Window's . - */ - relaunchDisplayName?: string; - } - - interface AuthInfo { - isProxy: boolean; - scheme: string; - host: string; - port: number; - realm: string; - } - - interface AutoResizeOptions { - /** - * If true, the view's width will grow and shrink together with the window. false - * by default. - */ - width: boolean; - /** - * If true, the view's height will grow and shrink together with the window. false - * by default. - */ - height: boolean; - /** - * If true, the view's x position and width will grow and shrink proportionly with - * the window. false by default. - */ - horizontal: boolean; - /** - * If true, the view's y position and height will grow and shrink proportinaly with - * the window. false by default. - */ - vertical: boolean; - } - - interface BitmapOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface BrowserViewConstructorOptions { - /** - * See . - */ - webPreferences?: WebPreferences; - } - - interface BrowserWindowConstructorOptions { - /** - * Window's width in pixels. Default is 800. - */ - width?: number; - /** - * Window's height in pixels. Default is 600. - */ - height?: number; - /** - * ( if y is used) Window's left offset from screen. Default is to center the - * window. - */ - x?: number; - /** - * ( if x is used) Window's top offset from screen. Default is to center the - * window. - */ - y?: number; - /** - * The width and height would be used as web page's size, which means the actual - * window's size will include window frame's size and be slightly larger. Default - * is false. - */ - useContentSize?: boolean; - /** - * Show window in the center of the screen. - */ - center?: boolean; - /** - * Window's minimum width. Default is 0. - */ - minWidth?: number; - /** - * Window's minimum height. Default is 0. - */ - minHeight?: number; - /** - * Window's maximum width. Default is no limit. - */ - maxWidth?: number; - /** - * Window's maximum height. Default is no limit. - */ - maxHeight?: number; - /** - * Whether window is resizable. Default is true. - */ - resizable?: boolean; - /** - * Whether window is movable. This is not implemented on Linux. Default is true. - */ - movable?: boolean; - /** - * Whether window is minimizable. This is not implemented on Linux. Default is - * true. - */ - minimizable?: boolean; - /** - * Whether window is maximizable. This is not implemented on Linux. Default is - * true. - */ - maximizable?: boolean; - /** - * Whether window is closable. This is not implemented on Linux. Default is true. - */ - closable?: boolean; - /** - * Whether the window can be focused. Default is true. On Windows setting - * focusable: false also implies setting skipTaskbar: true. On Linux setting - * focusable: false makes the window stop interacting with wm, so the window will - * always stay on top in all workspaces. - */ - focusable?: boolean; - /** - * Whether the window should always stay on top of other windows. Default is false. - */ - alwaysOnTop?: boolean; - /** - * Whether the window should show in fullscreen. When explicitly set to false the - * fullscreen button will be hidden or disabled on macOS. Default is false. - */ - fullscreen?: boolean; - /** - * Whether the window can be put into fullscreen mode. On macOS, also whether the - * maximize/zoom button should toggle full screen mode or maximize window. Default - * is true. - */ - fullscreenable?: boolean; - /** - * Use pre-Lion fullscreen on macOS. Default is false. - */ - simpleFullscreen?: boolean; - /** - * Whether to show the window in taskbar. Default is false. - */ - skipTaskbar?: boolean; - /** - * The kiosk mode. Default is false. - */ - kiosk?: boolean; - /** - * Default window title. Default is "Electron". If the HTML tag is defined - * in the HTML file loaded by loadURL(), this property will be - * ignored. - */ - title?: string; - /** - * The window icon. On Windows it is recommended to use ICO icons to get best - * visual effects, you can also leave it undefined so the executable's icon will be - * used. - */ - icon?: (NativeImage) | (string); - /** - * Whether window should be shown when created. Default is true. - */ - show?: boolean; - /** - * Specify false to create a . Default is true. - */ - frame?: boolean; - /** - * Specify parent window. Default is null. - */ - parent?: BrowserWindow; - /** - * Whether this is a modal window. This only works when the window is a child - * window. Default is false. - */ - modal?: boolean; - /** - * Whether the web view accepts a single mouse-down event that simultaneously - * activates the window. Default is false. - */ - acceptFirstMouse?: boolean; - /** - * Whether to hide cursor when typing. Default is false. - */ - disableAutoHideCursor?: boolean; - /** - * Auto hide the menu bar unless the Alt key is pressed. Default is false. - */ - autoHideMenuBar?: boolean; - /** - * Enable the window to be resized larger than screen. Default is false. - */ - enableLargerThanScreen?: boolean; - /** - * Window's background color as a hexadecimal value, like #66CD00 or #FFF or - * #80FFFFFF (alpha in #AARRGGBB format is supported if transparent is set to - * true). Default is #FFF (white). - */ - backgroundColor?: string; - /** - * Whether window should have a shadow. This is only implemented on macOS. Default - * is true. - */ - hasShadow?: boolean; - /** - * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 - * (fully opaque). This is only implemented on Windows and macOS. - */ - opacity?: number; - /** - * Forces using dark theme for the window, only works on some GTK+3 desktop - * environments. Default is false. - */ - darkTheme?: boolean; - /** - * Makes the window . Default is false. - */ - transparent?: boolean; - /** - * The type of window, default is normal window. See more about this below. - */ - type?: string; - /** - * The style of window title bar. Default is default. Possible values are: - */ - titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover'); - /** - * Shows the title in the title bar in full screen mode on macOS for all - * titleBarStyle options. Default is false. - */ - fullscreenWindowTitle?: boolean; - /** - * Use WS_THICKFRAME style for frameless windows on Windows, which adds standard - * window frame. Setting it to false will remove window shadow and window - * animations. Default is true. - */ - thickFrame?: boolean; - /** - * Add a type of vibrancy effect to the window, only on macOS. Can be - * appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, - * medium-light or ultra-dark. Please note that using frame: false in combination - * with a vibrancy value requires that you use a non-default titleBarStyle as well. - */ - vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'); - /** - * Controls the behavior on macOS when option-clicking the green stoplight button - * on the toolbar or by clicking the Window > Zoom menu item. If true, the window - * will grow to the preferred width of the web page when zoomed, false will cause - * it to zoom to the width of the screen. This will also affect the behavior when - * calling maximize() directly. Default is false. - */ - zoomToPageWidth?: boolean; - /** - * Tab group name, allows opening the window as a native tab on macOS 10.12+. - * Windows with the same tabbing identifier will be grouped together. This also - * adds a native new tab button to your window's tab bar and allows your app and - * window to receive the new-window-for-tab event. - */ - tabbingIdentifier?: string; - /** - * Settings of web page's features. - */ - webPreferences?: WebPreferences; - } - - interface CertificateTrustDialogOptions { - /** - * The certificate to trust/import. - */ - certificate: Certificate; - /** - * The message to display to the user. - */ - message: string; - } - - interface CertificateVerifyProcRequest { - hostname: string; - certificate: Certificate; - /** - * Verification result from chromium. - */ - verificationResult: string; - /** - * Error code. - */ - errorCode: number; - } - - interface ClearStorageDataOptions { - /** - * Should follow window.location.origin’s representation scheme://host:port. - */ - origin?: string; - /** - * The types of storages to clear, can contain: appcache, cookies, filesystem, - * indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. - */ - storages?: string[]; - /** - * The types of quotas to clear, can contain: temporary, persistent, syncable. - */ - quotas?: string[]; - } - - interface CommandLine { - /** - * Append a switch (with optional value) to Chromium's command line. Note: This - * will not affect process.argv. The intended usage of this function is to control - * Chromium's behavior. - */ - appendSwitch: (the_switch: string, value?: string) => void; - /** - * Append an argument to Chromium's command line. The argument will be quoted - * correctly. Switches will precede arguments regardless of appending order. If - * you're appending an argument like --switch=value, consider using - * appendSwitch('switch', 'value') instead. Note: This will not affect - * process.argv. The intended usage of this function is to control Chromium's - * behavior. - */ - appendArgument: (value: string) => void; - hasSwitch: (the_switch: string) => boolean; - /** - * Note: When the switch is not present or has no value, it returns empty string. - */ - getSwitchValue: (the_switch: string) => string; - } - - interface Config { - /** - * The URL associated with the PAC file. - */ - pacScript: string; - /** - * Rules indicating which proxies to use. - */ - proxyRules: string; - /** - * Rules indicating which URLs should bypass the proxy settings. - */ - proxyBypassRules: string; - } - - interface ConsoleMessageEvent extends Event { - level: number; - message: string; - line: number; - sourceId: string; - } - - interface ContextMenuParams { - /** - * x coordinate. - */ - x: number; - /** - * y coordinate. - */ - y: number; - /** - * URL of the link that encloses the node the context menu was invoked on. - */ - linkURL: string; - /** - * Text associated with the link. May be an empty string if the contents of the - * link are an image. - */ - linkText: string; - /** - * URL of the top level page that the context menu was invoked on. - */ - pageURL: string; - /** - * URL of the subframe that the context menu was invoked on. - */ - frameURL: string; - /** - * Source URL for the element that the context menu was invoked on. Elements with - * source URLs are images, audio and video. - */ - srcURL: string; - /** - * Type of the node the context menu was invoked on. Can be none, image, audio, - * video, canvas, file or plugin. - */ - mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'); - /** - * Whether the context menu was invoked on an image which has non-empty contents. - */ - hasImageContents: boolean; - /** - * Whether the context is editable. - */ - isEditable: boolean; - /** - * Text of the selection that the context menu was invoked on. - */ - selectionText: string; - /** - * Title or alt text of the selection that the context was invoked on. - */ - titleText: string; - /** - * The misspelled word under the cursor, if any. - */ - misspelledWord: string; - /** - * The character encoding of the frame on which the menu was invoked. - */ - frameCharset: string; - /** - * If the context menu was invoked on an input field, the type of that field. - * Possible values are none, plainText, password, other. - */ - inputFieldType: string; - /** - * Input source that invoked the context menu. Can be none, mouse, keyboard, touch - * or touchMenu. - */ - menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'); - /** - * The flags for the media element the context menu was invoked on. - */ - mediaFlags: MediaFlags; - /** - * These flags indicate whether the renderer believes it is able to perform the - * corresponding action. - */ - editFlags: EditFlags; - } - - interface CrashReporterStartOptions { - companyName: string; - /** - * URL that crash reports will be sent to as POST. - */ - submitURL: string; - /** - * Defaults to app.getName(). - */ - productName?: string; - /** - * Whether crash reports should be sent to the server Default is true. - */ - uploadToServer?: boolean; - /** - * Default is false. - */ - ignoreSystemCrashHandler?: boolean; - /** - * An object you can define that will be sent along with the report. Only string - * properties are sent correctly. Nested objects are not supported and the property - * names and values must be less than 64 characters long. - */ - extra?: Extra; - /** - * Directory to store the crashreports temporarily (only used when the crash - * reporter is started via process.crashReporter.start). - */ - crashesDirectory?: string; - } - - interface CreateFromBitmapOptions { - width: number; - height: number; - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface CreateFromBufferOptions { - /** - * Required for bitmap buffers. - */ - width?: number; - /** - * Required for bitmap buffers. - */ - height?: number; - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface CreateInterruptedDownloadOptions { - /** - * Absolute path of the download. - */ - path: string; - /** - * Complete URL chain for the download. - */ - urlChain: string[]; - mimeType?: string; - /** - * Start range for the download. - */ - offset: number; - /** - * Total length of the download. - */ - length: number; - /** - * Last-Modified header value. - */ - lastModified: string; - /** - * ETag header value. - */ - eTag: string; - /** - * Time when download was started in number of seconds since UNIX epoch. - */ - startTime?: number; - } - - interface Data { - text?: string; - html?: string; - image?: NativeImage; - rtf?: string; - /** - * The title of the URL at text. - */ - bookmark?: string; - } - - interface Details { - /** - * The url to associate the cookie with. - */ - url: string; - /** - * The name of the cookie. Empty by default if omitted. - */ - name?: string; - /** - * The value of the cookie. Empty by default if omitted. - */ - value?: string; - /** - * The domain of the cookie. Empty by default if omitted. - */ - domain?: string; - /** - * The path of the cookie. Empty by default if omitted. - */ - path?: string; - /** - * Whether the cookie should be marked as Secure. Defaults to false. - */ - secure?: boolean; - /** - * Whether the cookie should be marked as HTTP only. Defaults to false. - */ - httpOnly?: boolean; - /** - * The expiration date of the cookie as the number of seconds since the UNIX epoch. - * If omitted then the cookie becomes a session cookie and will not be retained - * between sessions. - */ - expirationDate?: number; - } - - interface DevToolsExtensions { - } - - interface DidChangeThemeColorEvent extends Event { - themeColor: string; - } - - interface DidFailLoadEvent extends Event { - errorCode: number; - errorDescription: string; - validatedURL: string; - isMainFrame: boolean; - } - - interface DidFrameFinishLoadEvent extends Event { - isMainFrame: boolean; - } - - interface DidNavigateEvent extends Event { - url: string; - } - - interface DidNavigateInPageEvent extends Event { - isMainFrame: boolean; - url: string; - } - - interface DisplayBalloonOptions { - /** - * - - */ - icon?: (NativeImage) | (string); - title: string; - content: string; - } - - interface Dock { - /** - * When critical is passed, the dock icon will bounce until either the application - * becomes active or the request is canceled. When informational is passed, the - * dock icon will bounce for one second. However, the request remains active until - * either the application becomes active or the request is canceled. Nota Bene: - * This method can only be used while the app is not focused; when the app is - * focused it will return -1. - */ - bounce: (type?: 'critical' | 'informational') => number; - /** - * Cancel the bounce of id. - */ - cancelBounce: (id: number) => void; - /** - * Bounces the Downloads stack if the filePath is inside the Downloads folder. - */ - downloadFinished: (filePath: string) => void; - /** - * Sets the string to be displayed in the dock’s badging area. - */ - setBadge: (text: string) => void; - getBadge: () => string; - /** - * Hides the dock icon. - */ - hide: () => void; - show: () => Promise; - isVisible: () => boolean; - /** - * Sets the application's dock menu. - */ - setMenu: (menu: Menu) => void; - getMenu: () => (Menu) | (null); - /** - * Sets the image associated with this dock icon. - */ - setIcon: (image: (NativeImage) | (string)) => void; - } - - interface EnableNetworkEmulationOptions { - /** - * Whether to emulate network outage. Defaults to false. - */ - offline?: boolean; - /** - * RTT in ms. Defaults to 0 which will disable latency throttling. - */ - latency?: number; - /** - * Download rate in Bps. Defaults to 0 which will disable download throttling. - */ - downloadThroughput?: number; - /** - * Upload rate in Bps. Defaults to 0 which will disable upload throttling. - */ - uploadThroughput?: number; - } - - interface Extensions { - } - - interface FeedURLOptions { - url: string; - /** - * HTTP request headers. - */ - headers?: Headers; - /** - * Either json or default, see the README for more information. - */ - serverType?: string; - } - - interface FileIconOptions { - size: ('small' | 'normal' | 'large'); - } - - interface Filter { - /** - * Retrieves cookies which are associated with url. Empty implies retrieving - * cookies of all urls. - */ - url?: string; - /** - * Filters cookies by name. - */ - name?: string; - /** - * Retrieves cookies whose domains match or are subdomains of domains. - */ - domain?: string; - /** - * Retrieves cookies whose path matches path. - */ - path?: string; - /** - * Filters cookies by their Secure property. - */ - secure?: boolean; - /** - * Filters out session or persistent cookies. - */ - session?: boolean; - } - - interface FindInPageOptions { - /** - * Whether to search forward or backward, defaults to true. - */ - forward?: boolean; - /** - * Whether the operation is first request or a follow up, defaults to false. - */ - findNext?: boolean; - /** - * Whether search should be case-sensitive, defaults to false. - */ - matchCase?: boolean; - /** - * Whether to look only at the start of words. defaults to false. - */ - wordStart?: boolean; - /** - * When combined with wordStart, accepts a match in the middle of a word if the - * match begins with an uppercase letter followed by a lowercase or non-letter. - * Accepts several other intra-word matches, defaults to false. - */ - medialCapitalAsWordStart?: boolean; - } - - interface FoundInPageEvent extends Event { - result: FoundInPageResult; - } - - interface FromPartitionOptions { - /** - * Whether to enable cache. - */ - cache: boolean; - } - - interface Header { - /** - * Specify an extra header name. - */ - name: string; - } - - interface Headers { - } - - interface HeapStatistics { - totalHeapSize: number; - totalHeapSizeExecutable: number; - totalPhysicalSize: number; - totalAvailableSize: number; - usedHeapSize: number; - heapSizeLimit: number; - mallocedMemory: number; - peakMallocedMemory: number; - doesZapGarbage: boolean; - } - - interface IgnoreMouseEventsOptions { - /** - * If true, forwards mouse move messages to Chromium, enabling mouse related events - * such as mouseleave. Only used when ignore is true. If ignore is false, - * forwarding is always disabled regardless of this value. - */ - forward?: boolean; - } - - interface ImportCertificateOptions { - /** - * Path for the pkcs12 file. - */ - certificate: string; - /** - * Passphrase for the certificate. - */ - password: string; - } - - interface Info { - /** - * Security origin for the isolated world. - */ - securityOrigin?: string; - /** - * Content Security Policy for the isolated world. - */ - csp?: string; - /** - * Name for isolated world. Useful in devtools. - */ - name?: string; - } - - interface Input { - /** - * Either keyUp or keyDown. - */ - type: string; - /** - * Equivalent to . - */ - key: string; - /** - * Equivalent to . - */ - code: string; - /** - * Equivalent to . - */ - isAutoRepeat: boolean; - /** - * Equivalent to . - */ - shift: boolean; - /** - * Equivalent to . - */ - control: boolean; - /** - * Equivalent to . - */ - alt: boolean; - /** - * Equivalent to . - */ - meta: boolean; - } - - interface InterceptBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptHttpProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptStreamProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface InterceptStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface IpcMessageEvent extends Event { - channel: string; - args: any[]; - } - - interface Item { - /** - * or files Array The path(s) to the file(s) being dragged. - */ - file: string; - /** - * The image must be non-empty on macOS. - */ - icon: NativeImage; - } - - interface JumpListSettings { - /** - * The minimum number of items that will be shown in the Jump List (for a more - * detailed description of this value see the ). - */ - minItems: number; - /** - * Array of JumpListItem objects that correspond to items that the user has - * explicitly removed from custom categories in the Jump List. These items must not - * be re-added to the Jump List in the call to app.setJumpList(), Windows will not - * display any custom category that contains any of the removed items. - */ - removedItems: JumpListItem[]; - } - - interface LoadCommitEvent extends Event { - url: string; - isMainFrame: boolean; - } - - interface LoadFileOptions { - /** - * Passed to url.format(). - */ - query?: Query; - /** - * Passed to url.format(). - */ - search?: string; - /** - * Passed to url.format(). - */ - hash?: string; - } - - interface LoadURLOptions { - /** - * An HTTP Referrer url. - */ - httpReferrer?: (string) | (Referrer); - /** - * A user agent originating the request. - */ - userAgent?: string; - /** - * Extra headers separated by "\n" - */ - extraHeaders?: string; - postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]); - /** - * Base url (with trailing path separator) for files to be loaded by the data url. - * This is needed only if the specified url is a data url and needs to load other - * files. - */ - baseURLForDataURL?: string; - } - - interface LoginItemSettings { - options?: Options; - /** - * true if the app is set to open at login. - */ - openAtLogin: boolean; - /** - * true if the app is set to open as hidden at login. This setting is not available - * on . - */ - openAsHidden: boolean; - /** - * true if the app was opened at login automatically. This setting is not available - * on . - */ - wasOpenedAtLogin: boolean; - /** - * true if the app was opened as a hidden login item. This indicates that the app - * should not open any windows at startup. This setting is not available on . - */ - wasOpenedAsHidden: boolean; - /** - * true if the app was opened as a login item that should restore the state from - * the previous session. This indicates that the app should restore the windows - * that were open the last time the app was closed. This setting is not available - * on . - */ - restoreState: boolean; - } - - interface LoginItemSettingsOptions { - /** - * The executable path to compare against. Defaults to process.execPath. - */ - path?: string; - /** - * The command-line arguments to compare against. Defaults to an empty array. - */ - args?: string[]; - } - - interface MemoryDumpConfig { - } - - interface MenuItemConstructorOptions { - /** - * Will be called with click(menuItem, browserWindow, event) when the menu item is - * clicked. - */ - click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: KeyboardEvent) => void; - /** - * Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, - * reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, - * togglefullscreen, window, minimize, close, help, about, services, hide, - * hideOthers, unhide, quit, startSpeaking, stopSpeaking, close, minimize, zoom, - * front, appMenu, fileMenu, editMenu, viewMenu, recentDocuments, toggleTabBar, - * selectNextTab, selectPreviousTab, mergeAllWindows, clearRecentDocuments, - * moveTabToNewWindow or windowMenu Define the action of the menu item, when - * specified the click property will be ignored. See . - */ - role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'close' | 'minimize' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu'); - /** - * Can be normal, separator, submenu, checkbox or radio. - */ - type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'); - label?: string; - sublabel?: string; - accelerator?: Accelerator; - icon?: (NativeImage) | (string); - /** - * If false, the menu item will be greyed out and unclickable. - */ - enabled?: boolean; - /** - * default is true, and when false will prevent the accelerator from triggering the - * item if the item is not visible`. - */ - acceleratorWorksWhenHidden?: boolean; - /** - * If false, the menu item will be entirely hidden. - */ - visible?: boolean; - /** - * Should only be specified for checkbox or radio type menu items. - */ - checked?: boolean; - /** - * If false, the accelerator won't be registered with the system, but it will still - * be displayed. Defaults to true. - */ - registerAccelerator?: boolean; - /** - * Should be specified for submenu type menu items. If submenu is specified, the - * type: 'submenu' can be omitted. If the value is not a then it will be - * automatically converted to one using Menu.buildFromTemplate. - */ - submenu?: (MenuItemConstructorOptions[]) | (Menu); - /** - * Unique within a single menu. If defined then it can be used as a reference to - * this item by the position attribute. - */ - id?: string; - /** - * Inserts this item before the item with the specified label. If the referenced - * item doesn't exist the item will be inserted at the end of the menu. Also - * implies that the menu item in question should be placed in the same “group” as - * the item. - */ - before?: string[]; - /** - * Inserts this item after the item with the specified label. If the referenced - * item doesn't exist the item will be inserted at the end of the menu. - */ - after?: string[]; - /** - * Provides a means for a single context menu to declare the placement of their - * containing group before the containing group of the item with the specified - * label. - */ - beforeGroupContaining?: string[]; - /** - * Provides a means for a single context menu to declare the placement of their - * containing group after the containing group of the item with the specified - * label. - */ - afterGroupContaining?: string[]; - } - - interface MessageBoxOptions { - /** - * Can be "none", "info", "error", "question" or "warning". On Windows, "question" - * displays the same icon as "info", unless you set an icon using the "icon" - * option. On macOS, both "warning" and "error" display the same warning icon. - */ - type?: string; - /** - * Array of texts for buttons. On Windows, an empty array will result in one button - * labeled "OK". - */ - buttons?: string[]; - /** - * Index of the button in the buttons array which will be selected by default when - * the message box opens. - */ - defaultId?: number; - /** - * Title of the message box, some platforms will not show it. - */ - title?: string; - /** - * Content of the message box. - */ - message: string; - /** - * Extra information of the message. - */ - detail?: string; - /** - * If provided, the message box will include a checkbox with the given label. The - * checkbox state can be inspected only when using callback. - */ - checkboxLabel?: string; - /** - * Initial checked state of the checkbox. false by default. - */ - checkboxChecked?: boolean; - icon?: NativeImage; - /** - * The index of the button to be used to cancel the dialog, via the Esc key. By - * default this is assigned to the first button with "cancel" or "no" as the label. - * If no such labeled buttons exist and this option is not set, 0 will be used as - * the return value or callback response. - */ - cancelId?: number; - /** - * On Windows Electron will try to figure out which one of the buttons are common - * buttons (like "Cancel" or "Yes"), and show the others as command links in the - * dialog. This can make the dialog appear in the style of modern Windows apps. If - * you don't like this behavior, you can set noLink to true. - */ - noLink?: boolean; - /** - * Normalize the keyboard access keys across platforms. Default is false. Enabling - * this assumes & is used in the button labels for the placement of the keyboard - * shortcut access key and labels will be converted so they work correctly on each - * platform, & characters are removed on macOS, converted to _ on Linux, and left - * untouched on Windows. For example, a button label of Vie&w will be converted to - * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and - * Linux. - */ - normalizeAccessKeys?: boolean; - } - - interface MessageBoxReturnValue { - /** - * The index of the clicked button. - */ - response: number; - /** - * The checked state of the checkbox if checkboxLabel was set. Otherwise false. - */ - checkboxChecked: boolean; - } - - interface MessageBoxSyncOptions { - /** - * Can be "none", "info", "error", "question" or "warning". On Windows, "question" - * displays the same icon as "info", unless you set an icon using the "icon" - * option. On macOS, both "warning" and "error" display the same warning icon. - */ - type?: string; - /** - * Array of texts for buttons. On Windows, an empty array will result in one button - * labeled "OK". - */ - buttons?: string[]; - /** - * Index of the button in the buttons array which will be selected by default when - * the message box opens. - */ - defaultId?: number; - /** - * Title of the message box, some platforms will not show it. - */ - title?: string; - /** - * Content of the message box. - */ - message: string; - /** - * Extra information of the message. - */ - detail?: string; - /** - * If provided, the message box will include a checkbox with the given label. The - * checkbox state can be inspected only when using callback. - */ - checkboxLabel?: string; - /** - * Initial checked state of the checkbox. false by default. - */ - checkboxChecked?: boolean; - icon?: (NativeImage) | (string); - /** - * The index of the button to be used to cancel the dialog, via the Esc key. By - * default this is assigned to the first button with "cancel" or "no" as the label. - * If no such labeled buttons exist and this option is not set, 0 will be used as - * the return value or callback response. - */ - cancelId?: number; - /** - * On Windows Electron will try to figure out which one of the buttons are common - * buttons (like "Cancel" or "Yes"), and show the others as command links in the - * dialog. This can make the dialog appear in the style of modern Windows apps. If - * you don't like this behavior, you can set noLink to true. - */ - noLink?: boolean; - /** - * Normalize the keyboard access keys across platforms. Default is false. Enabling - * this assumes & is used in the button labels for the placement of the keyboard - * shortcut access key and labels will be converted so they work correctly on each - * platform, & characters are removed on macOS, converted to _ on Linux, and left - * untouched on Windows. For example, a button label of Vie&w will be converted to - * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and - * Linux. - */ - normalizeAccessKeys?: boolean; - } - - interface NewWindowEvent extends Event { - url: string; - frameName: string; - /** - * Can be `default`, `foreground-tab`, `background-tab`, `new-window`, - * `save-to-disk` and `other`. - */ - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'); - /** - * The options which should be used for creating the new . - */ - options: Options; - } - - interface NotificationConstructorOptions { - /** - * A title for the notification, which will be shown at the top of the notification - * window when it is shown. - */ - title: string; - /** - * A subtitle for the notification, which will be displayed below the title. - */ - subtitle?: string; - /** - * The body text of the notification, which will be displayed below the title or - * subtitle. - */ - body: string; - /** - * Whether or not to emit an OS notification noise when showing the notification. - */ - silent?: boolean; - /** - * An icon to use in the notification. - */ - icon?: (string) | (NativeImage); - /** - * Whether or not to add an inline reply option to the notification. - */ - hasReply?: boolean; - /** - * The placeholder to write in the inline reply input field. - */ - replyPlaceholder?: string; - /** - * The name of the sound file to play when the notification is shown. - */ - sound?: string; - /** - * Actions to add to the notification. Please read the available actions and - * limitations in the NotificationAction documentation. - */ - actions?: NotificationAction[]; - /** - * A custom title for the close button of an alert. An empty string will cause the - * default localized text to be used. - */ - closeButtonText?: string; - } - - interface OnBeforeRedirectDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - redirectURL: string; - statusCode: number; - /** - * The server IP address that the request was actually sent to. - */ - ip?: string; - fromCache: boolean; - responseHeaders: ResponseHeaders; - } - - interface OnBeforeRedirectFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeRequestDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - uploadData: UploadData[]; - } - - interface OnBeforeRequestFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeSendHeadersDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - requestHeaders: RequestHeaders; - } - - interface OnBeforeSendHeadersFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnBeforeSendHeadersResponse { - cancel?: boolean; - /** - * When provided, request will be made with these headers. - */ - requestHeaders?: RequestHeaders; - } - - interface OnCompletedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - responseHeaders: ResponseHeaders; - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnCompletedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnErrorOccurredDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - fromCache: boolean; - /** - * The error description. - */ - error: string; - } - - interface OnErrorOccurredFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnHeadersReceivedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - statusLine: string; - statusCode: number; - responseHeaders: ResponseHeaders; - } - - interface OnHeadersReceivedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnHeadersReceivedResponse { - cancel?: boolean; - /** - * When provided, the server is assumed to have responded with these headers. - */ - responseHeaders?: ResponseHeaders; - /** - * Should be provided when overriding responseHeaders to change header status - * otherwise original response header's status will be used. - */ - statusLine?: string; - } - - interface OnResponseStartedDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - responseHeaders: ResponseHeaders; - /** - * Indicates whether the response was fetched from disk cache. - */ - fromCache: boolean; - statusCode: number; - statusLine: string; - } - - interface OnResponseStartedFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OnSendHeadersDetails { - id: number; - url: string; - method: string; - webContentsId?: number; - resourceType: string; - referrer: string; - timestamp: number; - requestHeaders: RequestHeaders; - } - - interface OnSendHeadersFilter { - /** - * Array of URL patterns that will be used to filter out the requests that do not - * match the URL patterns. - */ - urls: string[]; - } - - interface OpenDevToolsOptions { - /** - * Opens the devtools with specified dock state, can be right, bottom, undocked, - * detach. Defaults to last used dock state. In undocked mode it's possible to dock - * back. In detach mode it's not. - */ - mode: ('right' | 'bottom' | 'undocked' | 'detach'); - /** - * Whether to bring the opened devtools window to the foreground. The default is - * true. - */ - activate?: boolean; - } - - interface OpenDialogOptions { - title?: string; - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Contains which features the dialog should use. The following values are - * supported: - */ - properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>; - /** - * Message to display above input boxes. - */ - message?: string; - /** - * Create when packaged for the Mac App Store. - */ - securityScopedBookmarks?: boolean; - } - - interface OpenDialogReturnValue { - /** - * whether or not the dialog was canceled. - */ - canceled: boolean; - /** - * An array of file paths chosen by the user. If the dialog is cancelled this will - * be an empty array. - */ - filePaths?: string[]; - /** - * An array matching the filePaths array of base64 encoded strings which contains - * security scoped bookmark data. securityScopedBookmarks must be enabled for this - * to be populated. - */ - bookmarks?: string[]; - } - - interface OpenDialogSyncOptions { - title?: string; - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Contains which features the dialog should use. The following values are - * supported: - */ - properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>; - /** - * Message to display above input boxes. - */ - message?: string; - /** - * Create when packaged for the Mac App Store. - */ - securityScopedBookmarks?: boolean; - } - - interface OpenExternalOptions { - /** - * true to bring the opened application to the foreground. The default is true. - */ - activate?: boolean; - /** - * The working directory. - */ - workingDirectory?: string; - } - - interface OpenExternalSyncOptions { - /** - * true to bring the opened application to the foreground. The default is true. - */ - activate?: boolean; - /** - * The working directory. - */ - workingDirectory?: string; - } - - interface PageFaviconUpdatedEvent extends Event { - /** - * Array of URLs. - */ - favicons: string[]; - } - - interface PageTitleUpdatedEvent extends Event { - title: string; - explicitSet: boolean; - } - - interface Parameters { - /** - * Specify the screen type to emulate (default: desktop): - */ - screenPosition: ('desktop' | 'mobile'); - /** - * Set the emulated screen size (screenPosition == mobile). - */ - screenSize: Size; - /** - * Position the view on the screen (screenPosition == mobile) (default: { x: 0, y: - * 0 }). - */ - viewPosition: Point; - /** - * Set the device scale factor (if zero defaults to original device scale factor) - * (default: 0). - */ - deviceScaleFactor: number; - /** - * Set the emulated view size (empty means no override) - */ - viewSize: Size; - /** - * Scale of emulated view inside available space (not in fit to view mode) - * (default: 1). - */ - scale: number; - } - - interface Payment { - /** - * The identifier of the purchased product. - */ - productIdentifier: string; - /** - * The quantity purchased. - */ - quantity: number; - } - - interface PermissionCheckHandlerDetails { - /** - * The security orign of the media check. - */ - securityOrigin: string; - /** - * The type of media access being requested, can be video, audio or unknown - */ - mediaType: ('video' | 'audio' | 'unknown'); - /** - * The last URL the requesting frame loaded - */ - requestingUrl: string; - /** - * Whether the frame making the request is the main frame - */ - isMainFrame: boolean; - } - - interface PermissionRequestHandlerDetails { - /** - * The url of the openExternal request. - */ - externalURL?: string; - /** - * The types of media access being requested, elements can be video or audio - */ - mediaTypes?: Array<'video' | 'audio'>; - /** - * The last URL the requesting frame loaded - */ - requestingUrl: string; - /** - * Whether the frame making the request is the main frame - */ - isMainFrame: boolean; - } - - interface PluginCrashedEvent extends Event { - name: string; - version: string; - } - - interface PopupOptions { - /** - * Default is the focused window. - */ - window?: BrowserWindow; - /** - * Default is the current mouse cursor position. Must be declared if y is declared. - */ - x?: number; - /** - * Default is the current mouse cursor position. Must be declared if x is declared. - */ - y?: number; - /** - * The index of the menu item to be positioned under the mouse cursor at the - * specified coordinates. Default is -1. - */ - positioningItem?: number; - /** - * Called when menu is closed. - */ - callback?: () => void; - } - - interface PrintOptions { - /** - * Don't ask user for print settings. Default is false. - */ - silent?: boolean; - /** - * Also prints the background color and image of the web page. Default is false. - */ - printBackground?: boolean; - /** - * Set the printer device name to use. Default is ''. - */ - deviceName?: string; - } - - interface PrintToPDFOptions { - /** - * Specifies the type of margins to use. Uses 0 for default margin, 1 for no - * margin, and 2 for minimum margin. - */ - marginsType?: number; - /** - * Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, - * Tabloid or an Object containing height and width in microns. - */ - pageSize?: (string) | (Size); - /** - * Whether to print CSS backgrounds. - */ - printBackground?: boolean; - /** - * Whether to print selection only. - */ - printSelectionOnly?: boolean; - /** - * true for landscape, false for portrait. - */ - landscape?: boolean; - } - - interface Privileges { - /** - * Default false. - */ - standard?: boolean; - /** - * Default false. - */ - secure?: boolean; - /** - * Default false. - */ - bypassCSP?: boolean; - /** - * Default false. - */ - allowServiceWorkers?: boolean; - /** - * Default false. - */ - supportFetchAPI?: boolean; - /** - * Default false. - */ - corsEnabled?: boolean; - } - - interface ProgressBarOptions { - /** - * Mode for the progress bar. Can be none, normal, indeterminate, error or paused. - */ - mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused'); - } - - interface Provider { - /** - * . - */ - spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void; - } - - interface ReadBookmark { - title: string; - url: string; - } - - interface RedirectRequest { - url: string; - method: string; - session?: Session; - uploadData?: UploadData; - } - - interface RegisterBufferProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterFileProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterHttpProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterStreamProtocolRequest { - url: string; - headers: Headers; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RegisterStringProtocolRequest { - url: string; - referrer: string; - method: string; - uploadData: UploadData[]; - } - - interface RelaunchOptions { - args?: string[]; - execPath?: string; - } - - interface Request { - method: string; - url: string; - referrer: string; - } - - interface ResizeOptions { - /** - * Defaults to the image's width. - */ - width?: number; - /** - * Defaults to the image's height. - */ - height?: number; - /** - * The desired quality of the resize image. Possible values are good, better or - * best. The default is best. These values express a desired quality/speed - * tradeoff. They are translated into an algorithm-specific method that depends on - * the capabilities (CPU, GPU) of the underlying platform. It is possible for all - * three methods to be mapped to the same algorithm on a given platform. - */ - quality?: string; - } - - interface ResourceUsage { - images: MemoryUsageDetails; - scripts: MemoryUsageDetails; - cssStyleSheets: MemoryUsageDetails; - xslStyleSheets: MemoryUsageDetails; - fonts: MemoryUsageDetails; - other: MemoryUsageDetails; - } - - interface Response { - cancel?: boolean; - /** - * The original request is prevented from being sent or completed and is instead - * redirected to the given URL. - */ - redirectURL?: string; - } - - interface Result { - requestId: number; - /** - * Position of the active match. - */ - activeMatchOrdinal: number; - /** - * Number of Matches. - */ - matches: number; - /** - * Coordinates of first match region. - */ - selectionArea: SelectionArea; - finalUpdate: boolean; - } - - interface SaveDialogOptions { - title?: string; - /** - * Absolute directory path, absolute file path, or file name to use by default. - */ - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Message to display above text fields. - */ - message?: string; - /** - * Custom label for the text displayed in front of the filename text field. - */ - nameFieldLabel?: string; - /** - * Show the tags input box, defaults to true. - */ - showsTagField?: boolean; - /** - * Create a when packaged for the Mac App Store. If this option is enabled and the - * file doesn't already exist a blank file will be created at the chosen path. - */ - securityScopedBookmarks?: boolean; - } - - interface SaveDialogReturnValue { - /** - * whether or not the dialog was canceled. - */ - canceled: boolean; - /** - * If the dialog is canceled this will be undefined. - */ - filePath?: string; - /** - * Base64 encoded string which contains the security scoped bookmark data for the - * saved file. securityScopedBookmarks must be enabled for this to be present. - */ - bookmark?: string; - } - - interface SaveDialogSyncOptions { - title?: string; - /** - * Absolute directory path, absolute file path, or file name to use by default. - */ - defaultPath?: string; - /** - * Custom label for the confirmation button, when left empty the default label will - * be used. - */ - buttonLabel?: string; - filters?: FileFilter[]; - /** - * Message to display above text fields. - */ - message?: string; - /** - * Custom label for the text displayed in front of the filename text field. - */ - nameFieldLabel?: string; - /** - * Show the tags input box, defaults to true. - */ - showsTagField?: boolean; - /** - * Create a when packaged for the Mac App Store. If this option is enabled and the - * file doesn't already exist a blank file will be created at the chosen path. - */ - securityScopedBookmarks?: boolean; - } - - interface Settings { - /** - * true to open the app at login, false to remove the app as a login item. Defaults - * to false. - */ - openAtLogin?: boolean; - /** - * true to open the app as hidden. Defaults to false. The user can edit this - * setting from the System Preferences so - * app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is - * opened to know the current value. This setting is not available on . - */ - openAsHidden?: boolean; - /** - * The executable to launch at login. Defaults to process.execPath. - */ - path?: string; - /** - * The command-line arguments to pass to the executable. Defaults to an empty - * array. Take care to wrap paths in quotes. - */ - args?: string[]; - } - - interface SourcesOptions { - /** - * An array of Strings that lists the types of desktop sources to be captured, - * available types are screen and window. - */ - types: string[]; - /** - * The size that the media source thumbnail should be scaled to. Default is 150 x - * 150. Set width or height to 0 when you do not need the thumbnails. This will - * save the processing time required for capturing the content of each window and - * screen. - */ - thumbnailSize?: Size; - /** - * Set to true to enable fetching window icons. The default value is false. When - * false the appIcon property of the sources return null. Same if a source has the - * type screen. - */ - fetchWindowIcons?: boolean; - } - - interface SystemMemoryInfo { - /** - * The total amount of physical memory in Kilobytes available to the system. - */ - total: number; - /** - * The total amount of memory not being used by applications or disk cache. - */ - free: number; - /** - * The total amount of swap memory in Kilobytes available to the system. - */ - swapTotal: number; - /** - * The free amount of swap memory in Kilobytes available to the system. - */ - swapFree: number; - } - - interface ToBitmapOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface ToDataURLOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface ToPNGOptions { - /** - * Defaults to 1.0. - */ - scaleFactor?: number; - } - - interface TouchBarButtonConstructorOptions { - /** - * Button text. - */ - label?: string; - /** - * Button background color in hex format, i.e #ABCDEF. - */ - backgroundColor?: string; - /** - * Button icon. - */ - icon?: NativeImage; - /** - * Can be left, right or overlay. - */ - iconPosition?: ('left' | 'right' | 'overlay'); - /** - * Function to call when the button is clicked. - */ - click?: () => void; - } - - interface TouchBarColorPickerConstructorOptions { - /** - * Array of hex color strings to appear as possible colors to select. - */ - availableColors?: string[]; - /** - * The selected hex color in the picker, i.e #ABCDEF. - */ - selectedColor?: string; - /** - * Function to call when a color is selected. - */ - change?: (color: string) => void; - } - - interface TouchBarConstructorOptions { - items: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>; - escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null); - } - - interface TouchBarGroupConstructorOptions { - /** - * Items to display as a group. - */ - items: TouchBar; - } - - interface TouchBarLabelConstructorOptions { - /** - * Text to display. - */ - label?: string; - /** - * Hex color of text, i.e #ABCDEF. - */ - textColor?: string; - } - - interface TouchBarPopoverConstructorOptions { - /** - * Popover button text. - */ - label?: string; - /** - * Popover button icon. - */ - icon?: NativeImage; - /** - * Items to display in the popover. - */ - items?: TouchBar; - /** - * true to display a close button on the left of the popover, false to not show it. - * Default is true. - */ - showCloseButton?: boolean; - } - - interface TouchBarScrubberConstructorOptions { - /** - * An array of items to place in this scrubber. - */ - items: ScrubberItem[]; - /** - * Called when the user taps an item that was not the last tapped item. - */ - select: (selectedIndex: number) => void; - /** - * Called when the user taps any item. - */ - highlight: (highlightedIndex: number) => void; - /** - * Selected item style. Defaults to null. - */ - selectedStyle: string; - /** - * Selected overlay item style. Defaults to null. - */ - overlayStyle: string; - /** - * Defaults to false. - */ - showArrowButtons: boolean; - /** - * Defaults to free. - */ - mode: string; - /** - * Defaults to true. - */ - continuous: boolean; - } - - interface TouchBarSegmentedControlConstructorOptions { - /** - * Style of the segments: - */ - segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated'); - /** - * The selection mode of the control: - */ - mode?: ('single' | 'multiple' | 'buttons'); - /** - * An array of segments to place in this control. - */ - segments: SegmentedControlSegment[]; - /** - * The index of the currently selected segment, will update automatically with user - * interaction. When the mode is multiple it will be the last selected item. - */ - selectedIndex?: number; - /** - * Called when the user selects a new segment. - */ - change: (selectedIndex: number, isSelected: boolean) => void; - } - - interface TouchBarSliderConstructorOptions { - /** - * Label text. - */ - label?: string; - /** - * Selected value. - */ - value?: number; - /** - * Minimum value. - */ - minValue?: number; - /** - * Maximum value. - */ - maxValue?: number; - /** - * Function to call when the slider is changed. - */ - change?: (newValue: number) => void; - } - - interface TouchBarSpacerConstructorOptions { - /** - * Size of spacer, possible values are: - */ - size?: ('small' | 'large' | 'flexible'); - } - - interface UpdateTargetUrlEvent extends Event { - url: string; - } - - interface UploadProgress { - /** - * Whether the request is currently active. If this is false no other properties - * will be set - */ - active: boolean; - /** - * Whether the upload has started. If this is false both current and total will be - * set to 0. - */ - started: boolean; - /** - * The number of bytes that have been uploaded so far - */ - current: number; - /** - * The number of bytes that will be uploaded this request - */ - total: number; - } - - interface Versions { - /** - * A String representing Chrome's version string. - */ - chrome?: string; - /** - * A String representing Electron's version string. - */ - electron?: string; - } - - interface VisibleOnAllWorkspacesOptions { - /** - * Sets whether the window should be visible above fullscreen windows - */ - visibleOnFullScreen?: boolean; - } - - interface WillNavigateEvent extends Event { - url: string; - } - - interface EditFlags { - /** - * Whether the renderer believes it can undo. - */ - canUndo: boolean; - /** - * Whether the renderer believes it can redo. - */ - canRedo: boolean; - /** - * Whether the renderer believes it can cut. - */ - canCut: boolean; - /** - * Whether the renderer believes it can copy - */ - canCopy: boolean; - /** - * Whether the renderer believes it can paste. - */ - canPaste: boolean; - /** - * Whether the renderer believes it can delete. - */ - canDelete: boolean; - /** - * Whether the renderer believes it can select all. - */ - canSelectAll: boolean; - } - - interface Extra { - } - - interface FoundInPageResult { - requestId: number; - /** - * Position of the active match. - */ - activeMatchOrdinal: number; - /** - * Number of Matches. - */ - matches: number; - /** - * Coordinates of first match region. - */ - selectionArea: SelectionArea; - finalUpdate: boolean; - } - - interface MediaFlags { - /** - * Whether the media element has crashed. - */ - inError: boolean; - /** - * Whether the media element is paused. - */ - isPaused: boolean; - /** - * Whether the media element is muted. - */ - isMuted: boolean; - /** - * Whether the media element has audio. - */ - hasAudio: boolean; - /** - * Whether the media element is looping. - */ - isLooping: boolean; - /** - * Whether the media element's controls are visible. - */ - isControlsVisible: boolean; - /** - * Whether the media element's controls are toggleable. - */ - canToggleControls: boolean; - /** - * Whether the media element can be rotated. - */ - canRotate: boolean; - } - - interface Options { - } - - interface Query { - } - - interface RequestHeaders { - } - - interface ResponseHeaders { - } - - interface SelectionArea { - } - - interface WebPreferences { - /** - * Whether to enable DevTools. If it is set to false, can not use - * BrowserWindow.webContents.openDevTools() to open DevTools. Default is true. - */ - devTools?: boolean; - /** - * Whether node integration is enabled. Default is false. - */ - nodeIntegration?: boolean; - /** - * Whether node integration is enabled in web workers. Default is false. More about - * this can be found in . - */ - nodeIntegrationInWorker?: boolean; - /** - * Experimental option for enabling Node.js support in sub-frames such as iframes - * and child windows. All your preloads will load for every iframe, you can use - * process.isMainFrame to determine if you are in the main frame or not. - */ - nodeIntegrationInSubFrames?: boolean; - /** - * Specifies a script that will be loaded before other scripts run in the page. - * This script will always have access to node APIs no matter whether node - * integration is turned on or off. The value should be the absolute file path to - * the script. When node integration is turned off, the preload script can - * reintroduce Node global symbols back to the global scope. See example . - */ - preload?: string; - /** - * If set, this will sandbox the renderer associated with the window, making it - * compatible with the Chromium OS-level sandbox and disabling the Node.js engine. - * This is not the same as the nodeIntegration option and the APIs available to the - * preload script are more limited. Read more about the option . This option is - * currently experimental and may change or be removed in future Electron releases. - */ - sandbox?: boolean; - /** - * Whether to enable the module. Default is true. - */ - enableRemoteModule?: boolean; - /** - * Sets the session used by the page. Instead of passing the Session object - * directly, you can also choose to use the partition option instead, which accepts - * a partition string. When both session and partition are provided, session will - * be preferred. Default is the default session. - */ - session?: Session; - /** - * Sets the session used by the page according to the session's partition string. - * If partition starts with persist:, the page will use a persistent session - * available to all pages in the app with the same partition. If there is no - * persist: prefix, the page will use an in-memory session. By assigning the same - * partition, multiple pages can share the same session. Default is the default - * session. - */ - partition?: string; - /** - * When specified, web pages with the same affinity will run in the same renderer - * process. Note that due to reusing the renderer process, certain webPreferences - * options will also be shared between the web pages even when you specified - * different values for them, including but not limited to preload, sandbox and - * nodeIntegration. So it is suggested to use exact same webPreferences for web - * pages with the same affinity. - */ - affinity?: string; - /** - * The default zoom factor of the page, 3.0 represents 300%. Default is 1.0. - */ - zoomFactor?: number; - /** - * Enables JavaScript support. Default is true. - */ - javascript?: boolean; - /** - * When false, it will disable the same-origin policy (usually using testing - * websites by people), and set allowRunningInsecureContent to true if this options - * has not been set by user. Default is true. - */ - // webSecurity?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is - * false. - */ - // allowRunningInsecureContent?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Enables image support. Default is true. - */ - images?: boolean; - /** - * Make TextArea elements resizable. Default is true. - */ - textAreasAreResizable?: boolean; - /** - * Enables WebGL support. Default is true. - */ - webgl?: boolean; - /** - * Whether plugins should be enabled. Default is false. - */ - plugins?: boolean; - /** - * Enables Chromium's experimental features. Default is false. - */ - // experimentalFeatures?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### - /** - * Enables scroll bounce (rubber banding) effect on macOS. Default is false. - */ - scrollBounce?: boolean; - /** - * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to - * enable. The full list of supported feature strings can be found in the file. - */ - enableBlinkFeatures?: string; - /** - * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to - * disable. The full list of supported feature strings can be found in the file. - */ - disableBlinkFeatures?: string; - /** - * Sets the default font for the font-family. - */ - defaultFontFamily?: DefaultFontFamily; - /** - * Defaults to 16. - */ - defaultFontSize?: number; - /** - * Defaults to 13. - */ - defaultMonospaceFontSize?: number; - /** - * Defaults to 0. - */ - minimumFontSize?: number; - /** - * Defaults to ISO-8859-1. - */ - defaultEncoding?: string; - /** - * Whether to throttle animations and timers when the page becomes background. This - * also affects the . Defaults to true. - */ - backgroundThrottling?: boolean; - /** - * Whether to enable offscreen rendering for the browser window. Defaults to false. - * See the for more details. - */ - offscreen?: boolean; - /** - * Whether to run Electron APIs and the specified preload script in a separate - * JavaScript context. Defaults to false. The context that the preload script runs - * in will still have full access to the document and window globals but it will - * use its own set of JavaScript builtins (Array, Object, JSON, etc.) and will be - * isolated from any changes made to the global environment by the loaded page. The - * Electron API will only be available in the preload script and not the loaded - * page. This option should be used when loading potentially untrusted remote - * content to ensure the loaded content cannot tamper with the preload script and - * any Electron APIs being used. This option uses the same technique used by . You - * can access this context in the dev tools by selecting the 'Electron Isolated - * Context' entry in the combo box at the top of the Console tab. - */ - contextIsolation?: boolean; - /** - * Whether to use native window.open(). Defaults to false. Child windows will - * always have node integration disabled unless nodeIntegrationInSubFrames is true. - * This option is currently experimental. - */ - nativeWindowOpen?: boolean; - /** - * Whether to enable the . Defaults to false. The preload script configured for the - * will have node integration enabled when it is executed so you should ensure - * remote/untrusted content is not able to create a tag with a possibly malicious - * preload script. You can use the will-attach-webview event on to strip away the - * preload script and to validate or alter the 's initial settings. - */ - webviewTag?: boolean; - /** - * A list of strings that will be appended to process.argv in the renderer process - * of this app. Useful for passing small bits of data down to renderer process - * preload scripts. - */ - additionalArguments?: string[]; - /** - * Whether to enable browser style consecutive dialog protection. Default is false. - */ - safeDialogs?: boolean; - /** - * The message to display when consecutive dialog protection is triggered. If not - * defined the default message would be used, note that currently the default - * message is in English and not localized. - */ - safeDialogsMessage?: string; - /** - * Whether dragging and dropping a file or link onto the page causes a navigation. - * Default is false. - */ - navigateOnDragDrop?: boolean; - /** - * Autoplay policy to apply to content in the window, can be - * no-user-gesture-required, user-gesture-required, - * document-user-activation-required. Defaults to no-user-gesture-required. - */ - autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required'); - /** - * Whether to prevent the window from resizing when entering HTML Fullscreen. - * Default is false. - */ - disableHtmlFullscreenWindowResize?: boolean; - } - - interface DefaultFontFamily { - /** - * Defaults to Times New Roman. - */ - standard?: string; - /** - * Defaults to Times New Roman. - */ - serif?: string; - /** - * Defaults to Arial. - */ - sansSerif?: string; - /** - * Defaults to Courier New. - */ - monospace?: string; - /** - * Defaults to Script. - */ - cursive?: string; - /** - * Defaults to Impact. - */ - fantasy?: string; - } - -} - -declare module 'electron' { - export = Electron; -} - -interface NodeRequireFunction { - (moduleName: 'electron'): typeof Electron; -} - -interface File { - /** - * The real path to the file on the users filesystem - */ - path: string; -} - -declare module 'original-fs' { - import * as fs from 'fs'; - export = fs; -} - -interface Document { - createElement(tagName: 'webview'): Electron.WebviewTag; -} - -declare namespace NodeJS { - interface Process extends EventEmitter { - - // Docs: http://electronjs.org/docs/api/process - - // ### BEGIN VSCODE MODIFICATION ### - // /** - // * Emitted when Electron has loaded its internal initialization script and is - // * beginning to load the web page or the main script. It can be used by the preload - // * script to add removed Node global symbols back to the global scope when node - // * integration is turned off: - // */ - // on(event: 'loaded', listener: Function): this; - // once(event: 'loaded', listener: Function): this; - // addListener(event: 'loaded', listener: Function): this; - // removeListener(event: 'loaded', listener: Function): this; - // ### END VSCODE MODIFICATION ### - /** - * Causes the main thread of the current process crash. - */ - crash(): void; - getCPUUsage(): Electron.CPUUsage; - /** - * Indicates the creation time of the application. The time is represented as - * number of milliseconds since epoch. It returns null if it is unable to get the - * process creation time. - */ - getCreationTime(): (number) | (null); - /** - * Returns an object with V8 heap statistics. Note that all statistics are reported - * in Kilobytes. - */ - getHeapStatistics(): Electron.HeapStatistics; - getIOCounters(): Electron.IOCounters; - /** - * Returns an object giving memory usage statistics about the current process. Note - * that all statistics are reported in Kilobytes. This api should be called after - * app ready. Chromium does not provide residentSet value for macOS. This is - * because macOS performs in-memory compression of pages that haven't been recently - * used. As a result the resident set size value is not what one would expect. - * private memory is more representative of the actual pre-compression memory usage - * of the process on macOS. - */ - getProcessMemoryInfo(): Promise; - /** - * Returns an object giving memory usage statistics about the entire system. Note - * that all statistics are reported in Kilobytes. - */ - getSystemMemoryInfo(): Electron.SystemMemoryInfo; - /** - * Examples: Note: It returns the actual operating system version instead of kernel - * version on macOS unlike os.release(). - */ - getSystemVersion(): string; - /** - * Causes the main thread of the current process hang. - */ - hang(): void; - /** - * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, - * whichever is lower for the current process. - */ - setFdLimit(maxDescriptors: number): void; - /** - * Takes a V8 heap snapshot and saves it to filePath. - */ - takeHeapSnapshot(filePath: string): boolean; - /** - * A Boolean. When app is started by being passed as parameter to the default app, - * this property is true in the main process, otherwise it is undefined. - */ - defaultApp?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings are printed to - * stderr when formerly callback-based APIs converted to Promises are invoked using - * callbacks. Setting this to true will enable deprecation warnings. - */ - enablePromiseAPIs?: boolean; - /** - * A Boolean, true when the current renderer context is the "main" renderer frame. - * If you want the ID of the current frame you should use webFrame.routingId. - */ - isMainFrame?: boolean; - /** - * A Boolean. For Mac App Store build, this property is true, for other builds it - * is undefined. - */ - mas?: boolean; - /** - * A Boolean that controls ASAR support inside your application. Setting this to - * true will disable the support for asar archives in Node's built-in modules. - */ - noAsar?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings are printed to - * stderr. Setting this to true will silence deprecation warnings. This property is - * used instead of the --no-deprecation command line flag. - */ - noDeprecation?: boolean; - /** - * A String representing the path to the resources directory. - */ - resourcesPath?: string; - /** - * A Boolean. When the renderer process is sandboxed, this property is true, - * otherwise it is undefined. - */ - sandboxed?: boolean; - /** - * A Boolean that controls whether or not deprecation warnings will be thrown as - * exceptions. Setting this to true will throw errors for deprecations. This - * property is used instead of the --throw-deprecation command line flag. - */ - throwDeprecation?: boolean; - /** - * A Boolean that controls whether or not deprecations printed to stderr include - * their stack trace. Setting this to true will print stack traces for - * deprecations. This property is instead of the --trace-deprecation command line - * flag. - */ - traceDeprecation?: boolean; - /** - * A Boolean that controls whether or not process warnings printed to stderr - * include their stack trace. Setting this to true will print stack traces for - * process warnings (including deprecations). This property is instead of the - * --trace-warnings command line flag. - */ - traceProcessWarnings?: boolean; - /** - * A String representing the current process's type, can be "browser" (i.e. main - * process), "renderer", or "worker" (i.e. web worker). - */ - type?: string; - /** - * A Boolean. If the app is running as a Windows Store app (appx), this property is - * true, for otherwise it is undefined. - */ - windowsStore?: boolean; - } - interface ProcessVersions { - electron: string; - chrome: string; - } -} diff --git a/src/vs/base/parts/ipc/node/ipc.cp.ts b/src/vs/base/parts/ipc/node/ipc.cp.ts index d930cdd4003..a5632fdd069 100644 --- a/src/vs/base/parts/ipc/node/ipc.cp.ts +++ b/src/vs/base/parts/ipc/node/ipc.cp.ts @@ -227,7 +227,7 @@ export class Client implements IChannelClient, IDisposable { this.child.on('error', err => console.warn('IPC "' + this.options.serverName + '" errored with ' + err)); this.child.on('exit', (code: any, signal: any) => { - process.removeListener('exit', onExit); + process.removeListener('exit' as 'loaded', onExit); // https://github.com/electron/electron/issues/21475 this.activeRequests.forEach(r => dispose(r)); this.activeRequests.clear(); diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts index ce56c37a418..c1dd257533a 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts @@ -112,7 +112,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { const globalExitListener = () => this.terminate(); process.once('exit', globalExitListener); this._toDispose.add(toDisposable(() => { - process.removeListener('exit', globalExitListener); + process.removeListener('exit' as 'loaded', globalExitListener); // https://github.com/electron/electron/issues/21475 })); } diff --git a/yarn.lock b/yarn.lock index 7d52180aed4..c90d2e63b0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -172,6 +172,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47" integrity sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A== +"@types/node@^10.12.18": + version "10.17.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.9.tgz#4f251a1ed77ac7ef09d456247d67fc8173f6b9da" + integrity sha512-+6VygF9LbG7Gaqeog2G7u1+RUcmo0q1rI+2ZxdIg2fAUngk5Vz9fOCHXdloNUOHEPd1EuuOpL5O0CdgN9Fx5UQ== + "@types/semver@^5.4.0", "@types/semver@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" @@ -711,6 +716,11 @@ array-each@^1.0.0, array-each@^1.0.1: resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= +array-find-index@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= + array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -1330,6 +1340,19 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" integrity sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw== +camelcase-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= + dependencies: + camelcase "^2.0.0" + map-obj "^1.0.0" + +camelcase@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= + camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" @@ -1795,7 +1818,7 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@^1.5.0, concat-stream@^1.6.0: +concat-stream@1.6.2, concat-stream@^1.5.0, concat-stream@^1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== @@ -2100,6 +2123,13 @@ cuint@^0.2.1: resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" integrity sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs= +currently-unhandled@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= + dependencies: + array-find-index "^1.0.1" + cyclist@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" @@ -2136,7 +2166,7 @@ debug@2.2.0: dependencies: ms "0.7.1" -debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: +debug@2.6.9, debug@^2.1.2, debug@^2.1.3, debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -2150,7 +2180,7 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@^3.1.0: +debug@^3.0.0, debug@^3.1.0: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -2487,11 +2517,35 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= +electron-download@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-4.1.1.tgz#02e69556705cc456e520f9e035556ed5a015ebe8" + integrity sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg== + dependencies: + debug "^3.0.0" + env-paths "^1.0.0" + fs-extra "^4.0.1" + minimist "^1.2.0" + nugget "^2.0.1" + path-exists "^3.0.0" + rc "^1.2.1" + semver "^5.4.1" + sumchecker "^2.0.2" + electron-to-chromium@^1.2.7: version "1.3.27" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" integrity sha1-eOy4o5kGYYe7N07t412ccFZagD0= +electron@6.1.5: + version "6.1.5" + resolved "https://registry.yarnpkg.com/electron/-/electron-6.1.5.tgz#1f1bc54042587d8368edd43ffecb0ce7c84cab87" + integrity sha512-PrdJKkAS0IaSJwu4him03VYqvAKK1qyWTE/ieb4LgcbR4F4u90b91/7xna6P1GpD/FXiHqzZQcs0SvK/o08ckQ== + dependencies: + "@types/node" "^10.12.18" + electron-download "^4.1.0" + extract-zip "^1.0.3" + elliptic@^6.0.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" @@ -2548,6 +2602,11 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" integrity sha1-blwtClYhtdra7O+AuQ7ftc13cvA= +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= + errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" @@ -2922,6 +2981,16 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-zip@^1.0.3: + version "1.6.7" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" + integrity sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k= + dependencies: + concat-stream "1.6.2" + debug "2.6.9" + mkdirp "0.5.1" + yauzl "2.4.1" + extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -3260,6 +3329,15 @@ fs-extra@0.26.7: path-is-absolute "^1.0.0" rimraf "^2.2.8" +fs-extra@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -3376,6 +3454,11 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-stdin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -4226,6 +4309,13 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= + dependencies: + repeating "^2.0.0" + indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" @@ -4462,6 +4552,13 @@ is-extglob@^2.1.0, is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= + dependencies: + number-is-nan "^1.0.0" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -5219,6 +5316,14 @@ long@^3.2.0: resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" integrity sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s= +loud-rejection@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= + dependencies: + currently-unhandled "^0.4.1" + signal-exit "^3.0.0" + lru-cache@2: version "2.7.3" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" @@ -5284,6 +5389,11 @@ map-cache@^0.2.0, map-cache@^0.2.2: resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= +map-obj@^1.0.0, map-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= + map-stream@0.0.7, map-stream@~0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.0.7.tgz#8a1f07896d82b10926bd3744a2420009f88974a8" @@ -5371,6 +5481,22 @@ memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: errno "^0.1.3" readable-stream "^2.0.1" +meow@^3.1.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= + dependencies: + camelcase-keys "^2.0.0" + decamelize "^1.1.2" + loud-rejection "^1.0.0" + map-obj "^1.0.1" + minimist "^1.1.3" + normalize-package-data "^2.3.4" + object-assign "^4.0.1" + read-pkg-up "^1.0.1" + redent "^1.0.0" + trim-newlines "^1.0.0" + merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" @@ -5520,7 +5646,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@1.2.0, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= @@ -5859,6 +5985,16 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +normalize-package-data@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" @@ -5940,6 +6076,19 @@ nth-check@~1.0.1: dependencies: boolbase "~1.0.0" +nugget@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/nugget/-/nugget-2.0.1.tgz#201095a487e1ad36081b3432fa3cada4f8d071b0" + integrity sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA= + dependencies: + debug "^2.1.3" + minimist "^1.1.0" + pretty-bytes "^1.0.2" + progress-stream "^1.1.0" + request "^2.45.0" + single-line-log "^1.1.2" + throttleit "0.0.2" + num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -6811,6 +6960,14 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= +pretty-bytes@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-1.0.4.tgz#0a22e8210609ad35542f8c8d5d2159aff0751c84" + integrity sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ= + dependencies: + get-stdin "^4.0.1" + meow "^3.1.0" + pretty-hrtime@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" @@ -6839,6 +6996,14 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= +progress-stream@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/progress-stream/-/progress-stream-1.2.0.tgz#2cd3cfea33ba3a89c9c121ec3347abe9ab125f77" + integrity sha1-LNPP6jO6OonJwSHsM0er6asSX3c= + dependencies: + speedometer "~0.1.2" + through2 "~0.2.3" + progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" @@ -7046,7 +7211,7 @@ raw-body@2.3.2: iconv-lite "0.4.19" unpipe "1.0.0" -rc@^1.2.7: +rc@^1.2.1, rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -7122,7 +7287,7 @@ read@^1.0.7: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@^1.1.8: +readable-stream@^1.1.8, readable-stream@~1.1.9: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= @@ -7190,6 +7355,14 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" +redent@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= + dependencies: + indent-string "^2.1.0" + strip-indent "^1.0.1" + reduce-css-calc@^1.2.6: version "1.3.0" resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716" @@ -7264,6 +7437,13 @@ repeat-string@^1.6.1: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= + dependencies: + is-finite "^1.0.0" + replace-ext@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" @@ -7346,7 +7526,7 @@ request@2.79.0: tunnel-agent "^0.6.0" uuid "^3.1.0" -request@^2.86.0, request@^2.88.0: +request@^2.45.0, request@^2.86.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -7440,6 +7620,13 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2: dependencies: path-parse "^1.0.5" +resolve@^1.10.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== + dependencies: + path-parse "^1.0.6" + resolve@^1.4.0: version "1.10.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" @@ -7730,6 +7917,13 @@ simple-get@^2.7.0: once "^1.3.1" simple-concat "^1.0.0" +single-line-log@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364" + integrity sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q= + dependencies: + string-width "^1.0.1" + sinon@^1.17.2: version "1.17.7" resolved "https://registry.yarnpkg.com/sinon/-/sinon-1.17.7.tgz#4542a4f49ba0c45c05eb2e9dd9d203e2b8efe0bf" @@ -7895,6 +8089,11 @@ spdx-license-ids@^1.0.2: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" integrity sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc= +speedometer@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/speedometer/-/speedometer-0.1.4.tgz#9876dbd2a169d3115402d48e6ea6329c8816a50d" + integrity sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0= + split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -8145,6 +8344,13 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= +strip-indent@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= + dependencies: + get-stdin "^4.0.1" + strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -8155,6 +8361,13 @@ sudo-prompt@9.1.1: resolved "https://registry.yarnpkg.com/sudo-prompt/-/sudo-prompt-9.1.1.tgz#73853d729770392caec029e2470db9c221754db0" integrity sha512-es33J1g2HjMpyAhz8lOR+ICmXXAqTuKbuXuUWLhOLew20oN9oUCgCJx615U/v7aioZg7IX5lIh9x34vwneu4pA== +sumchecker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e" + integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4= + dependencies: + debug "^2.2.0" + supports-color@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e" @@ -8299,6 +8512,11 @@ textextensions@~1.0.0: resolved "https://registry.yarnpkg.com/textextensions/-/textextensions-1.0.2.tgz#65486393ee1f2bb039a60cbba05b0b68bd9501d2" integrity sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI= +throttleit@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-0.0.2.tgz#cfedf88e60c00dd9697b61fdd2a8343a9b680eaf" + integrity sha1-z+34jmDADdlpe2H90qg0OptoDq8= + through2-filter@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" @@ -8331,6 +8549,14 @@ through2@^3.0.0: readable-stream "2 || 3" xtend "~4.0.1" +through2@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/through2/-/through2-0.2.3.tgz#eb3284da4ea311b6cc8ace3653748a52abf25a3f" + integrity sha1-6zKE2k6jEbbMis42U3SKUqvyWj8= + dependencies: + readable-stream "~1.1.9" + xtend "~2.1.1" + through2@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/through2/-/through2-0.4.2.tgz#dbf5866031151ec8352bb6c4db64a2292a840b9b" @@ -8478,6 +8704,11 @@ tough-cookie@~2.4.3: resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk= +trim-newlines@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= + trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" @@ -9450,6 +9681,13 @@ yargs@^7.1.0: y18n "^3.2.1" yargs-parser "^5.0.0" +yauzl@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" + integrity sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU= + dependencies: + fd-slicer "~1.0.1" + yauzl@^2.2.1, yauzl@^2.3.1: version "2.9.1" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.9.1.tgz#a81981ea70a57946133883f029c5821a89359a7f" From 4302b73d2339223075568c95a8188619643e597d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 09:40:29 +0100 Subject: [PATCH 323/637] new inspectValue method --- .../services/resourceConfigurationImpl.ts | 27 +++++++++- .../configuration/common/configuration.ts | 16 ++++++ .../common/configurationModels.ts | 53 ++++++++++++++++++- .../browser/configurationService.ts | 6 ++- .../common/configurationModels.ts | 6 ++- 5 files changed, 102 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts index 08983dc17b4..71a3baf9356 100644 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ b/src/vs/editor/common/services/resourceConfigurationImpl.ts @@ -10,7 +10,7 @@ import { IPosition, Position } from 'vs/editor/common/core/position'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; -import { IConfigurationChangeEvent, IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, IConfigurationService, IOverrides, IConfigurationOverrides, ConfigurationTarget, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService { @@ -37,6 +37,29 @@ export class TextResourceConfigurationService extends Disposable implements ITex return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined); } + updateValue(resource: URI, key: string, value: any): Promise { + const language = this.getLanguage(resource, null); + + if (!language) { + return this.configurationService.updateValue(key, value); + } + + const configurationValue = this.configurationService.inspectValue(key); + if (configurationValue.workspaceFolders) { + const workspaceFolderValue = configurationValue.getWorkspaceFolderValue(resource); + if (workspaceFolderValue) { + + } + } + const overrides: IConfigurationOverrides = {}; + } + + private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, configurationTargetValue: IConfigurationTargetValue, overrides: IConfigurationOverrides): Promise { + if (configurationTargetValue.overrides.some(({ overrideIdentifier }) => overrideIdentifier === overrides.overrideIdentifier)) { + + } + } + private _getValue(resource: URI, position: IPosition | null, section: string | undefined): T { const language = resource ? this.getLanguage(resource, position) : undefined; if (typeof section === 'undefined') { @@ -53,4 +76,4 @@ export class TextResourceConfigurationService extends Disposable implements ITex return this.modeService.getModeIdByFilepathOrFirstLine(resource); } -} \ No newline at end of file +} diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 78839c2d608..bc789f18e6d 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -62,6 +62,20 @@ export interface IConfigurationChangeEvent { changedConfigurationByResource: ResourceMap; } +export interface IConfigurationTargetValue { + value: T | undefined; + overrides: { overrideIdentifier: string, value: T }[]; +} + +export interface IConfigurationValue { + default: IConfigurationTargetValue; + userLocal: IConfigurationTargetValue | undefined; + userRemote: IConfigurationTargetValue | undefined; + workspace: IConfigurationTargetValue | undefined; + workspaceFolders: [IWorkspaceFolder, IConfigurationTargetValue][] | undefined; + getWorkspaceFolderValue(resource: URI): IConfigurationTargetValue | undefined; +} + export interface IConfigurationService { _serviceBrand: undefined; @@ -87,6 +101,8 @@ export interface IConfigurationService { updateValue(key: string, value: any, target: ConfigurationTarget): Promise; updateValue(key: string, value: any, overrides: IConfigurationOverrides, target: ConfigurationTarget, donotNotifyError?: boolean): Promise; + inspectValue(key: string): IConfigurationValue; + reloadConfiguration(folder?: IWorkspaceFolder): Promise; inspect(key: string, overrides?: IConfigurationOverrides): { diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 533ce1a7c4d..84ba20ff2cf 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -10,8 +10,8 @@ import * as types from 'vs/base/common/types'; import * as objects from 'vs/base/common/objects'; import { URI, UriComponents } from 'vs/base/common/uri'; import { OVERRIDE_PROPERTY_PATTERN, ConfigurationScope, IConfigurationRegistry, Extensions, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; -import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, IConfigurationChangeEvent, ConfigurationTarget, removeFromValueTree, toOverrides } from 'vs/platform/configuration/common/configuration'; -import { Workspace } from 'vs/platform/workspace/common/workspace'; +import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, IConfigurationChangeEvent, ConfigurationTarget, removeFromValueTree, toOverrides, IConfigurationValue, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; +import { Workspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { Registry } from 'vs/platform/registry/common/platform'; export class ConfigurationModel implements IConfigurationModel { @@ -45,6 +45,13 @@ export class ConfigurationModel implements IConfigurationModel { return section ? getConfigurationValue(this.contents, section) : this.contents; } + getOverrideValue(section: string | undefined, overrideIdentifier: string): V | undefined { + const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier); + return overrideContents + ? section ? getConfigurationValue(this.contents, section) : overrideContents + : undefined; + } + override(identifier: string): ConfigurationModel { const overrideContents = this.getContentsForOverrideIdentifer(identifier); @@ -361,6 +368,48 @@ export class Configuration { } } + inspectValue(key: string, workspace: Workspace | undefined): IConfigurationValue { + const defaultValue = this.getConfigurationTargetValue(key, this._defaultConfiguration.freeze()); + const userLocalValue = this.getConfigurationTargetValue(key, this.localUserConfiguration.freeze()); + const userRemoteValue = this.getConfigurationTargetValue(key, this.remoteUserConfiguration.freeze()); + const workspaceValue = this.getConfigurationTargetValue(key, this._workspaceConfiguration.freeze()); + const workspaceFolderValues: [IWorkspaceFolder, IConfigurationTargetValue][] = []; + if (workspace) { + for (const workspaceFolder of workspace.folders) { + const folderConfigurationModel = this.getFolderConfigurationModelForResource(workspaceFolder.uri, workspace); + if (folderConfigurationModel) { + const workspaceFolderValue = this.getConfigurationTargetValue(key, folderConfigurationModel.freeze()); + if (workspaceFolderValue) { + workspaceFolderValues.push([workspaceFolder, workspaceFolderValue]); + } + } + } + } + return { + default: defaultValue!, + userLocal: userLocalValue, + userRemote: userRemoteValue, + workspace: workspaceValue, + workspaceFolders: workspaceFolderValues.length ? workspaceFolderValues : undefined, + getWorkspaceFolderValue: (resource): IConfigurationTargetValue | undefined => { + const folderConfigurationModel = this.getFolderConfigurationModelForResource(resource, workspace); + return folderConfigurationModel ? this.getConfigurationTargetValue(key, folderConfigurationModel.freeze()) : undefined; + } + }; + } + + private getConfigurationTargetValue(key: string, configurationModel: ConfigurationModel): IConfigurationTargetValue | undefined { + const value = configurationModel.getValue(key); + const overrides: { overrideIdentifier: string, value: C }[] = []; + for (const { identifiers } of configurationModel.overrides) { + const value = configurationModel.getOverrideValue(key, identifiers[0]); + if (value !== undefined) { + overrides.push({ overrideIdentifier: identifiers[0], value }); + } + } + return value !== undefined || overrides.length > 0 ? { value, overrides } : undefined; + } + inspect(key: string, overrides: IConfigurationOverrides, workspace: Workspace | undefined): { default: C, user: C, diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 1dad86d6bec..31d6f585995 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -12,7 +12,7 @@ import { Queue, Barrier } from 'vs/base/common/async'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import { IWorkspaceContextService, Workspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { ConfigurationChangeEvent, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; -import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData, IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData, IConfigurationService, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; import { Configuration, WorkspaceConfigurationChangeEvent, AllKeysConfigurationChangeEvent } from 'vs/workbench/services/configuration/common/configurationModels'; import { FOLDER_CONFIG_FOLDER_NAME, defaultSettingsSchemaId, userSettingsSchemaId, workspaceSettingsSchemaId, folderSettingsSchemaId, IConfigurationCache, machineSettingsSchemaId, LOCAL_MACHINE_SCOPES } from 'vs/workbench/services/configuration/common/configuration'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -262,6 +262,10 @@ export class WorkspaceService extends Disposable implements IConfigurationServic }); } + inspectValue(key: string): IConfigurationValue { + return this._configuration.inspectValue(key); + } + reloadConfiguration(folder?: IWorkspaceFolder, key?: string): Promise { if (folder) { return this.reloadWorkspaceFolderConfiguration(folder, key); diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index 9d2f6ad88df..ed091e67e21 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { equals } from 'vs/base/common/objects'; -import { compare, toValuesTree, IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; +import { compare, toValuesTree, IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel, IConfigurationOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; import { Configuration as BaseConfiguration, ConfigurationModelParser, ConfigurationChangeEvent, ConfigurationModel, AbstractConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces'; import { Workspace } from 'vs/platform/workspace/common/workspace'; @@ -101,6 +101,10 @@ export class Configuration extends BaseConfiguration { return super.getValue(key, overrides, this._workspace); } + inspectValue(key: string): IConfigurationValue { + return super.inspectValue(key, this._workspace); + } + inspect(key: string, overrides: IConfigurationOverrides = {}): { default: C, user: C, From c4198fac1fd4d01fa3a4bf0fdaceaf0f970fccd5 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 11 Dec 2019 09:49:12 +0100 Subject: [PATCH 324/637] Fixes microsoft/monaco-editor#1614: tabSize must be at least 1 --- src/vs/editor/common/model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index e26df375fa9..8c7edd2e6f8 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -386,7 +386,7 @@ export class TextModelResolvedOptions { defaultEOL: DefaultEndOfLine; trimAutoWhitespace: boolean; }) { - this.tabSize = src.tabSize | 0; + this.tabSize = Math.max(1, src.tabSize | 0); this.indentSize = src.tabSize | 0; this.insertSpaces = Boolean(src.insertSpaces); this.defaultEOL = src.defaultEOL | 0; From 15c35f55668e822c39fa9797722bd321cadaf8ab Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 11 Dec 2019 09:53:48 +0100 Subject: [PATCH 325/637] Implement makeTunnel for localhost Part of #81388 --- src/vs/platform/remote/common/tunnel.ts | 3 +- src/vs/vscode.proposed.d.ts | 7 ++- .../api/browser/extensionHost.contribution.ts | 1 + .../api/browser/mainThreadTunnelService.ts | 38 +++++++++++++++ .../workbench/api/common/extHost.protocol.ts | 9 +++- .../api/common/extHostTunnelService.ts | 47 ++++++++++++++++--- .../remote/common/remoteExplorerService.ts | 8 ++-- .../services/remote/node/tunnelService.ts | 4 +- 8 files changed, 101 insertions(+), 16 deletions(-) create mode 100644 src/vs/workbench/api/browser/mainThreadTunnelService.ts diff --git a/src/vs/platform/remote/common/tunnel.ts b/src/vs/platform/remote/common/tunnel.ts index 78187325d07..ea05c94aaaf 100644 --- a/src/vs/platform/remote/common/tunnel.ts +++ b/src/vs/platform/remote/common/tunnel.ts @@ -11,8 +11,9 @@ export const ITunnelService = createDecorator('tunnelService'); export interface RemoteTunnel { readonly tunnelRemotePort: number; + readonly tunnelRemoteHost: string; readonly tunnelLocalPort: number; - readonly localAddress?: string; + readonly localAddress: string; dispose(): void; } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 945c9bd2aae..fa31dcb8423 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -37,12 +37,11 @@ declare module 'vscode' { remote: { port: number, host: string }; localPort?: number; name?: string; - closeable?: boolean; } export interface Tunnel extends Disposable { remote: { port: number, host: string }; - local: { port: number, host: string }; + localAddress: string; } /** @@ -54,7 +53,7 @@ declare module 'vscode' { * The localAddress should be the complete local address(ex. localhost:1234) for connecting to the port. Tunnels provided through * detected are read-only from the forwarded ports UI. */ - detectedTunnels?: { remotePort: number, localAddress: string }[]; + detectedTunnels?: { remote: { port: number, host: string }, localAddress: string }[]; } export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation; @@ -78,7 +77,7 @@ declare module 'vscode' { export namespace workspace { /** - * Forwards a port. + * Forwards a port. Currently only works for a remote host of localhost. * @param forward The `localPort` is a suggestion only. If that port is not available another will be chosen. */ export function makeTunnel(forward: TunnelOptions): Thenable; diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts index 2905c524113..d29c9c770fb 100644 --- a/src/vs/workbench/api/browser/extensionHost.contribution.ts +++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts @@ -56,6 +56,7 @@ import './mainThreadWorkspace'; import './mainThreadComments'; import './mainThreadTask'; import './mainThreadLabelService'; +import './mainThreadTunnelService'; import 'vs/workbench/api/common/apiCommands'; export class ExtensionPoints implements IWorkbenchContribution { diff --git a/src/vs/workbench/api/browser/mainThreadTunnelService.ts b/src/vs/workbench/api/browser/mainThreadTunnelService.ts new file mode 100644 index 00000000000..d53e3cf329e --- /dev/null +++ b/src/vs/workbench/api/browser/mainThreadTunnelService.ts @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { MainThreadTunnelServiceShape, IExtHostContext, MainContext, ExtHostContext, ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol'; +import { TunnelOptions, TunnelDto } from 'vs/workbench/api/common/extHostTunnelService'; +import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; +import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remoteExplorerService'; + +@extHostNamedCustomer(MainContext.MainThreadTunnelService) +export class MainThreadTunnelService implements MainThreadTunnelServiceShape { + // @ts-ignore + private readonly _proxy: ExtHostTunnelServiceShape; + + constructor( + extHostContext: IExtHostContext, + @IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService + ) { + this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTunnelService); + } + + async $openTunnel(tunnelOptions: TunnelOptions): Promise { + const tunnel = await this.remoteExplorerService.tunnelModel.forward(tunnelOptions.remote.port, tunnelOptions.localPort, tunnelOptions.name); + if (tunnel) { + return { remote: { host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, localAddress: tunnel.localAddress }; + } + return undefined; + } + + async $closeTunnel(remotePort: number): Promise { + return this.remoteExplorerService.tunnelModel.close(remotePort); + } + + dispose(): void { + // + } +} diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index dc89753a162..0286e781fc9 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -47,6 +47,7 @@ import { createExtHostContextProxyIdentifier as createExtId, createMainContextPr import * as search from 'vs/workbench/services/search/common/search'; import { SaveReason } from 'vs/workbench/common/editor'; import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator'; +import { TunnelOptions, TunnelDto } from 'vs/workbench/api/common/extHostTunnelService'; export interface IEnvironment { isExtensionDevelopmentDebug: boolean; @@ -776,6 +777,11 @@ export interface MainThreadWindowShape extends IDisposable { $asExternalUri(uri: UriComponents, options: IOpenUriOptions): Promise; } +export interface MainThreadTunnelServiceShape extends IDisposable { + $openTunnel(tunnelOptions: TunnelOptions): Promise; + $closeTunnel(remotePort: number): Promise; +} + // -- extension host export interface ExtHostCommandsShape { @@ -1435,7 +1441,8 @@ export const MainContext = { MainThreadSearch: createMainId('MainThreadSearch'), MainThreadTask: createMainId('MainThreadTask'), MainThreadWindow: createMainId('MainThreadWindow'), - MainThreadLabelService: createMainId('MainThreadLabelService') + MainThreadLabelService: createMainId('MainThreadLabelService'), + MainThreadTunnelService: createMainId('MainThreadTunnelService') }; export const ExtHostContext = { diff --git a/src/vs/workbench/api/common/extHostTunnelService.ts b/src/vs/workbench/api/common/extHostTunnelService.ts index 20ddef9845d..2f061642da4 100644 --- a/src/vs/workbench/api/common/extHostTunnelService.ts +++ b/src/vs/workbench/api/common/extHostTunnelService.ts @@ -3,19 +3,54 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol'; -import * as vscode from 'vscode'; +import { ExtHostTunnelServiceShape, MainThreadTunnelServiceShape, MainContext } from 'vs/workbench/api/common/extHost.protocol'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; +import * as vscode from 'vscode'; +import { Disposable } from 'vs/base/common/lifecycle'; + +export interface TunnelOptions { + remote: { port: number, host: string }; + localPort?: number; + name?: string; + closeable?: boolean; +} + +export interface TunnelDto { + remote: { port: number, host: string }; + localAddress: string; +} export interface IExtHostTunnelService extends ExtHostTunnelServiceShape { - makeTunnel(forward: vscode.TunnelOptions): Promise; + makeTunnel(forward: TunnelOptions): Promise; } export const IExtHostTunnelService = createDecorator('IExtHostTunnelService'); -export class ExtHostTunnelService implements IExtHostTunnelService { - makeTunnel(forward: vscode.TunnelOptions): Promise { - throw new Error('Method not implemented.'); + +export class ExtHostTunnelService extends Disposable implements IExtHostTunnelService { + private readonly _proxy: MainThreadTunnelServiceShape; + + constructor( + @IExtHostRpcService extHostRpc: IExtHostRpcService + ) { + super(); + this._proxy = extHostRpc.getProxy(MainContext.MainThreadTunnelService); + } + async makeTunnel(forward: TunnelOptions): Promise { + const tunnel = await this._proxy.$openTunnel(forward); + if (tunnel) { + const disposableTunnel: vscode.Tunnel = { + remote: tunnel.remote, + localAddress: tunnel.localAddress, + dispose: () => { + return this._proxy.$closeTunnel(tunnel.remote.port); + } + }; + this._register(disposableTunnel); + return disposableTunnel; + } + return undefined; } } diff --git a/src/vs/workbench/services/remote/common/remoteExplorerService.ts b/src/vs/workbench/services/remote/common/remoteExplorerService.ts index 631de089101..cd2838a28c9 100644 --- a/src/vs/workbench/services/remote/common/remoteExplorerService.ts +++ b/src/vs/workbench/services/remote/common/remoteExplorerService.ts @@ -10,7 +10,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { ExtensionsRegistry, IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry'; -import { ITunnelService } from 'vs/platform/remote/common/tunnel'; +import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; import { Disposable } from 'vs/base/common/lifecycle'; import { IEditableData } from 'vs/workbench/common/views'; @@ -63,7 +63,8 @@ export class TunnelModel extends Disposable { this.forwarded.set(tunnel.tunnelRemotePort, { remote: tunnel.tunnelRemotePort, localAddress: tunnel.localAddress, - local: tunnel.tunnelLocalPort + local: tunnel.tunnelLocalPort, + closeable: true }); } this._onForwardPort.fire(this.forwarded.get(tunnel.tunnelRemotePort)!); @@ -76,7 +77,7 @@ export class TunnelModel extends Disposable { })); } - async forward(remote: number, local?: number, name?: string): Promise { + async forward(remote: number, local?: number, name?: string): Promise { if (!this.forwarded.has(remote)) { const tunnel = await this.tunnelService.openTunnel(remote, local); if (tunnel && tunnel.localAddress) { @@ -89,6 +90,7 @@ export class TunnelModel extends Disposable { }; this.forwarded.set(remote, newForward); this._onForwardPort.fire(newForward); + return tunnel; } } } diff --git a/src/vs/workbench/services/remote/node/tunnelService.ts b/src/vs/workbench/services/remote/node/tunnelService.ts index 8809b75528d..74f93537d48 100644 --- a/src/vs/workbench/services/remote/node/tunnelService.ts +++ b/src/vs/workbench/services/remote/node/tunnelService.ts @@ -28,7 +28,8 @@ class NodeRemoteTunnel extends Disposable implements RemoteTunnel { public readonly tunnelRemotePort: number; public tunnelLocalPort!: number; - public localAddress?: string; + public tunnelRemoteHost: string = 'localhost'; + public localAddress!: string; private readonly _options: IConnectionOptions; private readonly _server: net.Server; @@ -145,6 +146,7 @@ export class TunnelService implements ITunnelService { private makeTunnel(tunnel: RemoteTunnel): RemoteTunnel { return { tunnelRemotePort: tunnel.tunnelRemotePort, + tunnelRemoteHost: tunnel.tunnelRemoteHost, tunnelLocalPort: tunnel.tunnelLocalPort, localAddress: tunnel.localAddress, dispose: () => { From 7047ff922e3fc4131067d9969ff0f242b214267f Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 11 Dec 2019 11:10:27 +0100 Subject: [PATCH 326/637] fixes #83736 --- .../files/browser/views/explorerViewer.ts | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index d1487530958..d56b15d7b99 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -610,7 +610,7 @@ export class FileSorter implements ITreeSorter { } } -const fileOverwriteConfirm = (name: string) => { +const getFileOverwriteConfirm = (name: string) => { return { message: localize('confirmOverwrite', "A file or folder with the name '{0}' already exists in the destination folder. Do you want to replace it?", name), detail: localize('irreversible', "This action is irreversible!"), @@ -853,7 +853,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop { const name = file.name; if (typeof name === 'string' && event.target?.result instanceof ArrayBuffer) { if (target.getChild(name)) { - const { confirmed } = await this.dialogService.confirm(fileOverwriteConfirm(name)); + const { confirmed } = await this.dialogService.confirm(getFileOverwriteConfirm(name)); if (!confirmed) { return; } @@ -926,18 +926,16 @@ export class FileDragAndDrop implements ITreeDragAndDrop { }); } - const filtered = resources.filter(resource => targetNames.has(!hasToIgnoreCase(resource) ? basename(resource) : basename(resource).toLowerCase())); - const resourceExists = filtered.length >= 1; - if (resourceExists) { - const confirmationResult = await this.dialogService.confirm(fileOverwriteConfirm(basename(filtered[0]))); - if (!confirmationResult.confirmed) { - return; - } - } - // Run add in sequence const addPromisesFactory: ITask>[] = []; - resources.forEach(resource => { + await Promise.all(resources.map(async resource => { + if (targetNames.has(!hasToIgnoreCase(resource) ? basename(resource) : basename(resource).toLowerCase())) { + const confirmationResult = await this.dialogService.confirm(getFileOverwriteConfirm(basename(resource))); + if (!confirmationResult.confirmed) { + return; + } + } + addPromisesFactory.push(async () => { const sourceFile = resource; const targetFile = joinPath(target.resource, basename(sourceFile)); @@ -956,7 +954,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop { this.editorService.openEditor({ resource: stat.resource, options: { pinned: true } }); } }); - }); + })); await sequence(addPromisesFactory); } @@ -1053,13 +1051,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop { } catch (error) { // Conflict if ((error).fileOperationResult === FileOperationResult.FILE_MOVE_CONFLICT) { - const confirm: IConfirmation = { - message: localize('confirmOverwriteMessage', "'{0}' already exists in the destination folder. Do you want to replace it?", source.name), - detail: localize('irreversible', "This action is irreversible!"), - primaryButton: localize({ key: 'replaceButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Replace"), - type: 'warning' - }; - + const confirm = getFileOverwriteConfirm(source.name); // Move with overwrite if the user confirms const { confirmed } = await this.dialogService.confirm(confirm); if (confirmed) { From 7fa92942c851116caf534ebea06ae3a8e1363b6e Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 11:26:40 +0100 Subject: [PATCH 327/637] implement updateValue in resource configuration service add tests --- .../common/services/resourceConfiguration.ts | 6 +- .../services/resourceConfigurationImpl.ts | 48 ++- .../standalone/browser/simpleServices.ts | 10 +- .../resourceConfigurationService.test.ts | 289 ++++++++++++++++++ .../configuration/common/configuration.ts | 2 +- .../node/configurationService.ts | 8 +- .../test/common/testConfigurationService.ts | 22 +- .../electron-browser/telemetryService.test.ts | 25 +- .../configurationResolverService.test.ts | 42 +-- .../parts/editor/breadcrumbModel.test.ts | 3 + .../workbench/test/workbenchTestServices.ts | 6 +- 11 files changed, 389 insertions(+), 72 deletions(-) create mode 100644 src/vs/editor/test/common/services/resourceConfigurationService.test.ts diff --git a/src/vs/editor/common/services/resourceConfiguration.ts b/src/vs/editor/common/services/resourceConfiguration.ts index 0e122347e34..299dc13fa5e 100644 --- a/src/vs/editor/common/services/resourceConfiguration.ts +++ b/src/vs/editor/common/services/resourceConfiguration.ts @@ -6,7 +6,7 @@ import { Event } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; import { IPosition } from 'vs/editor/common/core/position'; -import { IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export const ITextResourceConfigurationService = createDecorator('textResourceConfigurationService'); @@ -32,6 +32,8 @@ export interface ITextResourceConfigurationService { getValue(resource: URI | undefined, section?: string): T; getValue(resource: URI | undefined, position?: IPosition, section?: string): T; + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise; + } export const ITextResourcePropertiesService = createDecorator('textResourcePropertiesService'); @@ -44,4 +46,4 @@ export interface ITextResourcePropertiesService { * Returns the End of Line characters for the given resource */ getEOL(resource: URI | undefined, language?: string): string; -} \ No newline at end of file +} diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts index 71a3baf9356..09cdbea7b0f 100644 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ b/src/vs/editor/common/services/resourceConfigurationImpl.ts @@ -10,7 +10,7 @@ import { IPosition, Position } from 'vs/editor/common/core/position'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; -import { IConfigurationChangeEvent, IConfigurationService, IOverrides, IConfigurationOverrides, ConfigurationTarget, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, IConfigurationService, ConfigurationTarget, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService { @@ -37,26 +37,60 @@ export class TextResourceConfigurationService extends Disposable implements ITex return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined); } - updateValue(resource: URI, key: string, value: any): Promise { + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { const language = this.getLanguage(resource, null); if (!language) { + if (configurationTarget !== undefined) { + return this.configurationService.updateValue(key, value, configurationTarget); + } return this.configurationService.updateValue(key, value); } const configurationValue = this.configurationService.inspectValue(key); + + if (configurationTarget !== undefined) { + switch (configurationTarget) { + case ConfigurationTarget.MEMORY: + return this.configurationService.updateValue(key, value, configurationTarget); + case ConfigurationTarget.WORKSPACE_FOLDER: + return this._updateValue(key, value, configurationTarget, configurationValue.getWorkspaceFolderValue(resource), resource, language); + case ConfigurationTarget.WORKSPACE: + return this._updateValue(key, value, configurationTarget, configurationValue.workspace, resource, language); + case ConfigurationTarget.USER_REMOTE: + return this._updateValue(key, value, configurationTarget, configurationValue.userRemote, resource, language); + case ConfigurationTarget.USER_LOCAL: + case ConfigurationTarget.USER: + return this._updateValue(key, value, configurationTarget, configurationValue.userLocal, resource, language); + } + } + if (configurationValue.workspaceFolders) { const workspaceFolderValue = configurationValue.getWorkspaceFolderValue(resource); if (workspaceFolderValue) { - + return this._updateValue(key, value, ConfigurationTarget.WORKSPACE_FOLDER, workspaceFolderValue, resource, language); } } - const overrides: IConfigurationOverrides = {}; + + if (configurationValue.workspace) { + return this._updateValue(key, value, ConfigurationTarget.WORKSPACE, configurationValue.workspace, resource, language); + } + + if (configurationValue.userRemote) { + return this._updateValue(key, value, ConfigurationTarget.USER_REMOTE, configurationValue.userRemote, resource, language); + } + + return this._updateValue(key, value, ConfigurationTarget.USER_LOCAL, configurationValue.userLocal, resource, language); } - private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, configurationTargetValue: IConfigurationTargetValue, overrides: IConfigurationOverrides): Promise { - if (configurationTargetValue.overrides.some(({ overrideIdentifier }) => overrideIdentifier === overrides.overrideIdentifier)) { - + private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, configurationTargetValue: IConfigurationTargetValue | undefined, resource: URI, language: string): Promise { + if (!configurationTargetValue) { + return this.configurationService.updateValue(key, value, configurationTarget); + } + if (configurationTargetValue.overrides.some(({ overrideIdentifier }) => overrideIdentifier === language)) { + return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget); + } else { + return this.configurationService.updateValue(key, value, { resource }, configurationTarget); } } diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index 9fd2d80f1d0..e9be9f21df7 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -25,7 +25,7 @@ import { IModelService } from 'vs/editor/common/services/modelService'; import { IResolvedTextEditorModel, ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService'; import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; import { CommandsRegistry, ICommand, ICommandEvent, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands'; -import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IConfigurationService, IConfigurationModel, IConfigurationValue, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { Configuration, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IConfirmation, IConfirmationResult, IDialogOptions, IDialogService, IShowResult } from 'vs/platform/dialogs/common/dialogs'; @@ -460,6 +460,10 @@ export class SimpleConfigurationService implements IConfigurationService { return Promise.resolve(); } + public inspectValue(key: string): IConfigurationValue { + return this.configuration().inspectValue(key, undefined); + } + public inspect(key: string, options: IConfigurationOverrides = {}): { default: C, user: C, @@ -516,6 +520,10 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur } return this.configurationService.getValue(section); } + + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { + return this.configurationService.updateValue(key, value, { resource }, configurationTarget); + } } export class SimpleResourcePropertiesService implements ITextResourcePropertiesService { diff --git a/src/vs/editor/test/common/services/resourceConfigurationService.test.ts b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts new file mode 100644 index 00000000000..241acf9dc8f --- /dev/null +++ b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts @@ -0,0 +1,289 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; +import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; +import { IModelService } from 'vs/editor/common/services/modelService'; +import { IModeService } from 'vs/editor/common/services/modeService'; +import { IConfigurationValue, IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; +import { TextResourceConfigurationService } from 'vs/editor/common/services/resourceConfigurationImpl'; +import { URI } from 'vs/base/common/uri'; + + +suite('TextResourceConfigurationService - Update', () => { + + let configurationValue: IConfigurationValue; + let updateArgs: any[]; + let configurationService = new class extends TestConfigurationService { + inspectValue(key: string) { + return configurationValue; + } + updateValue() { + updateArgs = [...arguments]; + return Promise.resolve(); + } + }(); + let language: string | null = null; + let testObject: TextResourceConfigurationService; + + setup(() => { + const instantiationService = new TestInstantiationService(); + instantiationService.stub(IModelService, >{ getModel() { return null; } }); + instantiationService.stub(IModeService, >{ getModeIdByFilepathOrFirstLine() { return language; } }); + instantiationService.stub(IConfigurationService, configurationService); + testObject = instantiationService.createInstance(TextResourceConfigurationService); + }); + + test('updateValue writes without target and overrides when no language is defined', async () => { + await testObject.updateValue(URI.file('someFile'), 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b']); + }); + + test('updateValue writes with target and without overrides when no language is defined', async () => { + await testObject.updateValue(URI.file('someFile'), 'a', 'b', ConfigurationTarget.USER_LOCAL); + assert.deepEqual(updateArgs, ['a', 'b', ConfigurationTarget.USER_LOCAL]); + }); + + test('updateValue writes into given memory target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.MEMORY); + assert.deepEqual(updateArgs, ['a', 'b', ConfigurationTarget.MEMORY]); + }); + + test('updateValue writes into given workspace target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.WORKSPACE); + assert.deepEqual(updateArgs, ['a', 'b', ConfigurationTarget.WORKSPACE]); + }); + + test('updateValue writes into given user target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'b', value: '1' }] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.USER); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER]); + }); + + test('updateValue writes into given workspace folder target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'a', value: '1' }] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b', ConfigurationTarget.WORKSPACE_FOLDER); + assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE_FOLDER]); + }); + + test('updateValue writes into derived workspace folder target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.WORKSPACE_FOLDER]); + }); + + test('updateValue writes into derived workspace folder target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, + workspaceFolders: [], + getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'a', value: '1' }] }; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE_FOLDER]); + }); + + test('updateValue writes into derived workspace target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: { value: '2', overrides: [{ overrideIdentifier: 'c', value: '3' }] }, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.WORKSPACE]); + }); + + test('updateValue writes into derived workspace target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: undefined, + workspace: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.WORKSPACE]); + }); + + test('updateValue writes into derived user remote target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: { value: '3', overrides: [] }, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_REMOTE]); + }); + + test('updateValue writes into derived user remote target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: { value: '3', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_REMOTE]); + }); + test('updateValue writes into derived user remote target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: { value: '3', overrides: [] }, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_REMOTE]); + }); + + test('updateValue writes into derived user remote target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [] }, + userRemote: { value: '3', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_REMOTE]); + }); + + test('updateValue writes into derived user target without overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [{ overrideIdentifier: 'b', value: '3' }] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', { resource }, ConfigurationTarget.USER_LOCAL]); + }); + + test('updateValue writes into derived user target with overrides', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, + userRemote: undefined, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', '2'); + assert.deepEqual(updateArgs, ['a', '2', { resource, overrideIdentifier: language }, ConfigurationTarget.USER_LOCAL]); + }); + + test('updateValue when not changed', async () => { + language = 'a'; + configurationValue = { + default: { value: '1', overrides: [] }, + userLocal: undefined, + userRemote: undefined, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; }, + }; + const resource = URI.file('someFile'); + + await testObject.updateValue(resource, 'a', 'b'); + assert.deepEqual(updateArgs, ['a', 'b', ConfigurationTarget.USER_LOCAL]); + }); + +}); diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index bc789f18e6d..6165f9e8f7b 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -68,7 +68,7 @@ export interface IConfigurationTargetValue { } export interface IConfigurationValue { - default: IConfigurationTargetValue; + default: IConfigurationTargetValue | undefined; userLocal: IConfigurationTargetValue | undefined; userRemote: IConfigurationTargetValue | undefined; workspace: IConfigurationTargetValue | undefined; diff --git a/src/vs/platform/configuration/node/configurationService.ts b/src/vs/platform/configuration/node/configurationService.ts index 9dcd0267e77..a9f45eed478 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -6,7 +6,7 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; -import { IConfigurationService, IConfigurationChangeEvent, IConfigurationOverrides, ConfigurationTarget, compare, isConfigurationOverrides, IConfigurationData } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, IConfigurationChangeEvent, IConfigurationOverrides, ConfigurationTarget, compare, isConfigurationOverrides, IConfigurationData, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; import { DefaultConfigurationModel, Configuration, ConfigurationChangeEvent, ConfigurationModel, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels'; import { Event, Emitter } from 'vs/base/common/event'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; @@ -79,6 +79,10 @@ export class ConfigurationService extends Disposable implements IConfigurationSe return Promise.reject(new Error('not supported')); } + inspectValue(key: string): IConfigurationValue { + return this.configuration.inspectValue(key, undefined); + } + inspect(key: string): { default: T, user: T, @@ -135,4 +139,4 @@ export class ConfigurationService extends Disposable implements IConfigurationSe } return {}; } -} \ No newline at end of file +} diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index df01e1a8a4b..91a2d227b41 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -5,12 +5,16 @@ import { TernarySearchTree } from 'vs/base/common/map'; import { URI } from 'vs/base/common/uri'; -import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, getConfigurationValue, isConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; +import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, getConfigurationValue, isConfigurationOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; export class TestConfigurationService implements IConfigurationService { public _serviceBrand: undefined; - private configuration = Object.create(null); + private configuration: any; + + constructor(configuration?: any) { + this.configuration = configuration || Object.create(null); + } private configurationByRoot: TernarySearchTree = TernarySearchTree.forPaths(); @@ -33,7 +37,7 @@ export class TestConfigurationService implements IConfigurationService { return configuration; } - public updateValue(key: string, overrides?: IConfigurationOverrides): Promise { + public updateValue(key: string, value: any): Promise { return Promise.resolve(undefined); } @@ -53,6 +57,18 @@ export class TestConfigurationService implements IConfigurationService { return { dispose() { } }; } + public inspectValue(key: string): IConfigurationValue { + const inspect = this.inspect(key); + return { + default: inspect.default ? { value: inspect.default, overrides: [] } : undefined, + userLocal: inspect.userLocal ? { value: inspect.userLocal, overrides: [] } : undefined, + userRemote: undefined, + workspace: undefined, + workspaceFolders: undefined, + getWorkspaceFolderValue() { return undefined; } + }; + } + public inspect(key: string, overrides?: IConfigurationOverrides): { default: T, user: T, diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts index 8ccbcc4d9f6..bbb8a831b1b 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -9,8 +9,8 @@ import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry'; import { NullAppender, ITelemetryAppender } from 'vs/platform/telemetry/common/telemetryUtils'; import * as Errors from 'vs/base/common/errors'; import * as sinon from 'sinon'; -import { getConfigurationValue } from 'vs/platform/configuration/common/configuration'; import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry'; +import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; class TestTelemetryAppender implements ITelemetryAppender { @@ -767,30 +767,13 @@ suite('TelemetryService', () => { let testAppender = new TestTelemetryAppender(); let service = new TelemetryService({ appender: testAppender - }, { - _serviceBrand: undefined, + }, new class extends TestConfigurationService { getValue() { return { enableTelemetry: enableTelemetry } as any; - }, - updateValue(): Promise { - return null!; - }, - inspect(key: string) { - return { - value: getConfigurationValue(this.getValue(), key), - default: getConfigurationValue(this.getValue(), key), - user: getConfigurationValue(this.getValue(), key), - workspace: null!, - workspaceFolder: null! - }; - }, - keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; }, - onDidChangeConfiguration: emitter.event, - reloadConfiguration(): Promise { return null!; }, - getConfigurationData() { return null; } - }); + } + }()); assert.equal(service.isOptedIn, false); diff --git a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts index 41396579fb8..58a4a27d60b 100644 --- a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import { URI as uri } from 'vs/base/common/uri'; import * as platform from 'vs/base/common/platform'; -import { IConfigurationService, getConfigurationValue, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; @@ -125,7 +125,7 @@ suite('Configuration Resolver Service', () => { }); test('substitute one configuration variable', () => { - let configurationService: IConfigurationService = new MockConfigurationService({ + let configurationService: IConfigurationService = new TestConfigurationService({ editor: { fontFamily: 'foo' }, @@ -142,7 +142,7 @@ suite('Configuration Resolver Service', () => { test('substitute many configuration variables', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: { fontFamily: 'foo' }, @@ -159,7 +159,7 @@ suite('Configuration Resolver Service', () => { test('substitute one env variable and a configuration variable', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: { fontFamily: 'foo' }, @@ -180,7 +180,7 @@ suite('Configuration Resolver Service', () => { test('substitute many env variable and a configuration variable', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: { fontFamily: 'foo' }, @@ -201,7 +201,7 @@ suite('Configuration Resolver Service', () => { test('mixed types of configuration variables', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: { fontFamily: 'foo', lineNumbers: 123, @@ -231,7 +231,7 @@ suite('Configuration Resolver Service', () => { test('uses original variable as fallback', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: {} }); @@ -242,7 +242,7 @@ suite('Configuration Resolver Service', () => { test('configuration variables with invalid accessor', () => { let configurationService: IConfigurationService; - configurationService = new MockConfigurationService({ + configurationService = new TestConfigurationService({ editor: { fontFamily: 'foo' } @@ -503,32 +503,6 @@ suite('Configuration Resolver Service', () => { }); -class MockConfigurationService implements IConfigurationService { - public _serviceBrand: undefined; - public serviceId = IConfigurationService; - public constructor(private configuration: any = {}) { } - public inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getValue(), key), default: getConfigurationValue(this.getValue(), key), user: getConfigurationValue(this.getValue(), key), workspaceFolder: undefined, folder: undefined }; } - public keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; } - public getValue(): any; - public getValue(value: string): any; - public getValue(value?: any): any { - if (!value) { - return this.configuration; - } - const valuePath = (value).split('.'); - let object = this.configuration; - while (valuePath.length && object) { - object = object[valuePath.shift()!]; - } - - return object; - } - public updateValue(): Promise { return Promise.resolve(); } - public getConfigurationData(): any { return null; } - public onDidChangeConfiguration() { return { dispose() { } }; } - public reloadConfiguration() { return Promise.resolve(); } -} - class MockCommandService implements ICommandService { public _serviceBrand: undefined; diff --git a/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts b/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts index 01af7282519..7757b1e08b6 100644 --- a/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts +++ b/src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts @@ -25,6 +25,9 @@ suite('Breadcrumb Model', function () { } return super.getValue(...args); } + updateValue() { + return Promise.resolve(); + } }; test('only uri, inside workspace', function () { diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 45b64318c4e..89f8f3684cd 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -16,7 +16,7 @@ import { IEditorOpeningEvent, EditorServiceImpl, IEditorGroupView } from 'vs/wor import { Event, Emitter } from 'vs/base/common/event'; import Severity from 'vs/base/common/severity'; import { IBackupFileService, IResolvedBackup } from 'vs/workbench/services/backup/common/backup'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { IWorkbenchLayoutService, Parts, Position as PartPosition } from 'vs/workbench/services/layout/browser/layoutService'; import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; @@ -1263,6 +1263,10 @@ export class TestTextResourceConfigurationService implements ITextResourceConfig const section: string | undefined = position ? (typeof arg3 === 'string' ? arg3 : undefined) : (typeof arg2 === 'string' ? arg2 : undefined); return this.configurationService.getValue(section, { resource }); } + + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { + return this.configurationService.updateValue(key, value); + } } export class TestTextResourcePropertiesService implements ITextResourcePropertiesService { From bb6dc668536ebb4580b58a7445a76b51ffd5373c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 11 Dec 2019 12:18:10 +0100 Subject: [PATCH 328/637] debt - apply workbench.fontAliasing only on macOS --- src/vs/workbench/browser/media/style.css | 6 +++--- src/vs/workbench/browser/workbench.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/media/style.css b/src/vs/workbench/browser/media/style.css index b97ac21dda0..72c43f410d8 100644 --- a/src/vs/workbench/browser/media/style.css +++ b/src/vs/workbench/browser/media/style.css @@ -109,18 +109,18 @@ body.web { cursor: pointer; } -.monaco-workbench.monaco-font-aliasing-antialiased { +.monaco-workbench.mac.monaco-font-aliasing-antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } -.monaco-workbench.monaco-font-aliasing-none { +.monaco-workbench.mac.monaco-font-aliasing-none { -webkit-font-smoothing: none; -moz-osx-font-smoothing: unset; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { - .monaco-workbench.monaco-font-aliasing-auto { + .monaco-workbench.mac.monaco-font-aliasing-auto { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index 2838b05e487..5f1cbf50e79 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -13,7 +13,7 @@ import { getZoomLevel, isFirefox, isSafari, isChrome } from 'vs/base/browser/bro import { mark } from 'vs/base/common/performance'; import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors'; import { Registry } from 'vs/platform/registry/common/platform'; -import { isWindows, isLinux, isWeb, isNative } from 'vs/base/common/platform'; +import { isWindows, isLinux, isWeb, isNative, isMacintosh } from 'vs/base/common/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor'; import { IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions'; @@ -252,6 +252,10 @@ export class Workbench extends Layout { private fontAliasing: 'default' | 'antialiased' | 'none' | 'auto' | undefined; private setFontAliasing(configurationService: IConfigurationService) { + if (!isMacintosh) { + return; // macOS only + } + const aliasing = configurationService.getValue<'default' | 'antialiased' | 'none' | 'auto'>('workbench.fontAliasing'); if (this.fontAliasing === aliasing) { return; From e7dd2dda9b237deebcd508840877ddc652cec580 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 11 Dec 2019 12:23:15 +0100 Subject: [PATCH 329/637] Implement tunnelInformation Part of #81388 --- .../api/browser/mainThreadTunnelService.ts | 8 +++-- .../workbench/api/common/extHost.protocol.ts | 1 + .../api/common/extHostExtensionService.ts | 8 ++++- .../api/common/extHostTunnelService.ts | 10 ++++++ .../contrib/remote/browser/tunnelView.ts | 32 ++++++++--------- .../remote/common/remoteExplorerService.ts | 36 +++++++++++++++++-- 6 files changed, 73 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadTunnelService.ts b/src/vs/workbench/api/browser/mainThreadTunnelService.ts index d53e3cf329e..afab7499495 100644 --- a/src/vs/workbench/api/browser/mainThreadTunnelService.ts +++ b/src/vs/workbench/api/browser/mainThreadTunnelService.ts @@ -21,7 +21,7 @@ export class MainThreadTunnelService implements MainThreadTunnelServiceShape { } async $openTunnel(tunnelOptions: TunnelOptions): Promise { - const tunnel = await this.remoteExplorerService.tunnelModel.forward(tunnelOptions.remote.port, tunnelOptions.localPort, tunnelOptions.name); + const tunnel = await this.remoteExplorerService.forward(tunnelOptions.remote.port, tunnelOptions.localPort, tunnelOptions.name); if (tunnel) { return { remote: { host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, localAddress: tunnel.localAddress }; } @@ -29,7 +29,11 @@ export class MainThreadTunnelService implements MainThreadTunnelServiceShape { } async $closeTunnel(remotePort: number): Promise { - return this.remoteExplorerService.tunnelModel.close(remotePort); + return this.remoteExplorerService.close(remotePort); + } + + $addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise { + return Promise.resolve(this.remoteExplorerService.addDetected(tunnels)); } dispose(): void { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 0286e781fc9..91f9d879c62 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -780,6 +780,7 @@ export interface MainThreadWindowShape extends IDisposable { export interface MainThreadTunnelServiceShape extends IDisposable { $openTunnel(tunnelOptions: TunnelOptions): Promise; $closeTunnel(remotePort: number): Promise; + $addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise; } // -- extension host diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts index a3b5ed0057d..a0c3aa4e086 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -32,6 +32,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; +import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; interface ITestRunner { /** Old test runner API, as exported from `vscode/lib/testrunner` */ @@ -76,6 +77,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio protected readonly _extHostWorkspace: ExtHostWorkspace; protected readonly _extHostConfiguration: ExtHostConfiguration; protected readonly _logService: ILogService; + protected readonly _extHostTunnelService: IExtHostTunnelService; protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape; protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape; @@ -104,7 +106,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio @IExtHostConfiguration extHostConfiguration: IExtHostConfiguration, @ILogService logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtensionStoragePaths storagePath: IExtensionStoragePaths + @IExtensionStoragePaths storagePath: IExtensionStoragePaths, + @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService ) { this._hostUtils = hostUtils; this._extHostContext = extHostContext; @@ -113,6 +116,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio this._extHostWorkspace = extHostWorkspace; this._extHostConfiguration = extHostConfiguration; this._logService = logService; + this._extHostTunnelService = extHostTunnelService; this._disposables = new DisposableStore(); this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace); @@ -652,6 +656,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio extensionHostEnv: result.extensionHostEnv }; + await this._extHostTunnelService.addDetected(result.detectedTunnels); + return { type: 'ok', value: { diff --git a/src/vs/workbench/api/common/extHostTunnelService.ts b/src/vs/workbench/api/common/extHostTunnelService.ts index 2f061642da4..5b13798e294 100644 --- a/src/vs/workbench/api/common/extHostTunnelService.ts +++ b/src/vs/workbench/api/common/extHostTunnelService.ts @@ -22,13 +22,16 @@ export interface TunnelDto { } export interface IExtHostTunnelService extends ExtHostTunnelServiceShape { + readonly _serviceBrand: undefined; makeTunnel(forward: TunnelOptions): Promise; + addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise; } export const IExtHostTunnelService = createDecorator('IExtHostTunnelService'); export class ExtHostTunnelService extends Disposable implements IExtHostTunnelService { + readonly _serviceBrand: undefined; private readonly _proxy: MainThreadTunnelServiceShape; constructor( @@ -52,5 +55,12 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe } return undefined; } + + async addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise { + if (tunnels) { + return this._proxy.$addDetected(tunnels); + } + } + } diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index ea19a1064df..8077d549082 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -51,7 +51,7 @@ class TunnelTreeVirtualDelegate implements IListVirtualDelegate { export interface ITunnelViewModel { onForwardedPortsChanged: Event; readonly forwarded: TunnelItem[]; - readonly published: TunnelItem[]; + readonly detected: TunnelItem[]; readonly candidates: TunnelItem[]; readonly groups: ITunnelGroup[]; } @@ -79,11 +79,11 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { items: this.forwarded }); } - if (this.model.published.size > 0) { + if (this.model.detected.size > 0) { groups.push({ - label: nls.localize('remote.tunnelsView.published', "Published"), - tunnelType: TunnelType.Published, - items: this.published + label: nls.localize('remote.tunnelsView.detected', "Detected"), + tunnelType: TunnelType.Detected, + items: this.detected }); } const candidates = this.candidates; @@ -107,9 +107,9 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { }); } - get published(): TunnelItem[] { - return Array.from(this.model.published.values()).map(tunnel => { - return new TunnelItem(TunnelType.Published, tunnel.remote, tunnel.localAddress, false, tunnel.name, tunnel.description); + get detected(): TunnelItem[] { + return Array.from(this.model.detected.values()).map(tunnel => { + return new TunnelItem(TunnelType.Detected, tunnel.remote, tunnel.localAddress, false, tunnel.name, tunnel.description); }); } @@ -118,7 +118,7 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { const values = this.model.candidates.values(); let iterator = values.next(); while (!iterator.done) { - if (!this.model.forwarded.has(iterator.value.remote) && !this.model.published.has(iterator.value.remote)) { + if (!this.model.forwarded.has(iterator.value.remote) && !this.model.detected.has(iterator.value.remote)) { candidates.push(new TunnelItem(TunnelType.Candidate, iterator.value.remote, iterator.value.localAddress, false, undefined, iterator.value.description)); } iterator = values.next(); @@ -324,7 +324,7 @@ class TunnelDataSource implements IAsyncDataSource; - readonly published: Map; + readonly detected: Map; readonly candidates: Map; private _onForwardPort: Emitter = new Emitter(); public onForwardPort: Event = this._onForwardPort.event; @@ -53,7 +53,7 @@ export class TunnelModel extends Disposable { }); }); - this.published = new Map(); + this.detected = new Map(); this.candidates = new Map(); this._register(this.tunnelService.onTunnelOpened(tunnel => { if (this.candidates.has(tunnel.tunnelRemotePort)) { @@ -99,6 +99,9 @@ export class TunnelModel extends Disposable { if (this.forwarded.has(remote)) { this.forwarded.get(remote)!.name = name; this._onPortName.fire(remote); + } else if (this.detected.has(remote)) { + this.detected.get(remote)!.name = name; + this._onPortName.fire(remote); } } @@ -107,7 +110,17 @@ export class TunnelModel extends Disposable { } address(remote: number): string | undefined { - return (this.forwarded.get(remote) || this.published.get(remote))?.localAddress; + return (this.forwarded.get(remote) || this.detected.get(remote))?.localAddress; + } + + addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): void { + tunnels.forEach(tunnel => { + this.detected.set(tunnel.remote.port, { + remote: tunnel.remote.port, + localAddress: tunnel.localAddress, + closeable: false + }); + }); } } @@ -120,6 +133,9 @@ export interface IRemoteExplorerService { onDidChangeEditable: Event; setEditable(remote: number | undefined, data: IEditableData | null): void; getEditableData(remote: number | undefined): IEditableData | undefined; + forward(remote: number, local?: number, name?: string): Promise; + close(remote: number): Promise; + addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): void; } export interface HelpInformation { @@ -221,6 +237,20 @@ class RemoteExplorerService implements IRemoteExplorerService { return this._tunnelModel; } + forward(remote: number, local?: number, name?: string): Promise { + return this.tunnelModel.forward(remote, local, name); + } + + close(remote: number): Promise { + return this.tunnelModel.close(remote); + } + + addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): void { + if (tunnels) { + this.tunnelModel.addDetected(tunnels); + } + } + setEditable(remote: number | undefined, data: IEditableData | null): void { if (!data) { this.editable = undefined; From efc8667b4c6d3021c0fdbfbce9495ae925ca2e28 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 11 Dec 2019 12:24:44 +0100 Subject: [PATCH 330/637] Have types reflect the implementation (fixes microsoft/monaco-editor#1396) --- src/vs/editor/common/modes.ts | 6 +++--- src/vs/monaco.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 3a1399ee682..1b0a5dd0fea 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -1246,9 +1246,9 @@ export function isResourceTextEdit(thing: any): thing is ResourceTextEdit { } export interface ResourceFileEdit { - oldUri: URI; - newUri: URI; - options: { overwrite?: boolean, ignoreIfNotExists?: boolean, ignoreIfExists?: boolean, recursive?: boolean }; + oldUri?: URI; + newUri?: URI; + options?: { overwrite?: boolean, ignoreIfNotExists?: boolean, ignoreIfExists?: boolean, recursive?: boolean }; } export interface ResourceTextEdit { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 9c2896240f3..53c70b9514e 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -5523,9 +5523,9 @@ declare namespace monaco.languages { } export interface ResourceFileEdit { - oldUri: Uri; - newUri: Uri; - options: { + oldUri?: Uri; + newUri?: Uri; + options?: { overwrite?: boolean; ignoreIfNotExists?: boolean; ignoreIfExists?: boolean; From 2c5012637aea03b55d65fd65fe3410510f34d45d Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 12:30:00 +0100 Subject: [PATCH 331/637] check commit --- .../configuration/test/common/testConfigurationService.ts | 6 ++---- .../test/electron-browser/telemetryService.test.ts | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index 91a2d227b41..0c3132542bf 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -6,11 +6,13 @@ import { TernarySearchTree } from 'vs/base/common/map'; import { URI } from 'vs/base/common/uri'; import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, getConfigurationValue, isConfigurationOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; +import { Emitter } from 'vs/base/common/event'; export class TestConfigurationService implements IConfigurationService { public _serviceBrand: undefined; private configuration: any; + readonly onDidChangeConfiguration = new Emitter().event; constructor(configuration?: any) { this.configuration = configuration || Object.create(null); @@ -53,10 +55,6 @@ export class TestConfigurationService implements IConfigurationService { return Promise.resolve(undefined); } - public onDidChangeConfiguration() { - return { dispose() { } }; - } - public inspectValue(key: string): IConfigurationValue { const inspect = this.inspect(key); return { diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts index bbb8a831b1b..a13dca87e9a 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -768,6 +768,7 @@ suite('TelemetryService', () => { let service = new TelemetryService({ appender: testAppender }, new class extends TestConfigurationService { + onDidChangeConfiguration = emitter.event; getValue() { return { enableTelemetry: enableTelemetry From 77b257a6a680e2b271e3dfafed69669eb00224c1 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 12:30:15 +0100 Subject: [PATCH 332/637] fix getOverrideValue --- src/vs/platform/configuration/common/configurationModels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 84ba20ff2cf..932b169fbda 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -48,7 +48,7 @@ export class ConfigurationModel implements IConfigurationModel { getOverrideValue(section: string | undefined, overrideIdentifier: string): V | undefined { const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier); return overrideContents - ? section ? getConfigurationValue(this.contents, section) : overrideContents + ? section ? getConfigurationValue(overrideContents, section) : overrideContents : undefined; } From 6bd03bf2564f64cc6426f98e6da9fa13f61195d4 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 16:05:21 +0100 Subject: [PATCH 333/637] add overrides information to change event --- .../configuration/common/configuration.ts | 75 ++++++++++++++++--- .../common/configurationModels.ts | 21 ++++-- .../workbench/api/node/extHostLogService.ts | 4 + .../common/configurationModels.ts | 44 +++++------ 4 files changed, 105 insertions(+), 39 deletions(-) diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 6165f9e8f7b..6aa0c506c8c 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -12,6 +12,7 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationRegistry, Extensions, OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/configuration/common/configurationRegistry'; import { ResourceMap } from 'vs/base/common/map'; +import { IStringDictionary } from 'vs/base/common/collections'; export const IConfigurationService = createDecorator('configurationService'); @@ -132,6 +133,7 @@ export interface IConfigurationModel { } export interface IOverrides { + keys: string[]; contents: any; identifiers: string[]; } @@ -143,20 +145,74 @@ export interface IConfigurationData { folders: [UriComponents, IConfigurationModel][]; } -export function compare(from: IConfigurationModel, to: IConfigurationModel): { added: string[], removed: string[], updated: string[] } { - const added = to.keys.filter(key => from.keys.indexOf(key) === -1); - const removed = from.keys.filter(key => to.keys.indexOf(key) === -1); +export interface IConfigurationCompareResult { + added: string[]; + removed: string[]; + updated: string[]; + overrides: [string, string[]][]; +} + +export function compare(from: IConfigurationModel | undefined, to: IConfigurationModel | undefined): IConfigurationCompareResult { + const added = to + ? from ? to.keys.filter(key => from.keys.indexOf(key) === -1) : [...to.keys] + : []; + const removed = from + ? to ? from.keys.filter(key => to.keys.indexOf(key) === -1) : [...from.keys] + : []; const updated: string[] = []; - for (const key of from.keys) { - const value1 = getConfigurationValue(from.contents, key); - const value2 = getConfigurationValue(to.contents, key); - if (!objects.equals(value1, value2)) { - updated.push(key); + if (to && from) { + for (const key of from.keys) { + const value1 = getConfigurationValue(from.contents, key); + const value2 = getConfigurationValue(to.contents, key); + if (!objects.equals(value1, value2)) { + updated.push(key); + } } } - return { added, removed, updated }; + const overrides: [string, string[]][] = []; + const byOverrideIdentifier = (overrides: IOverrides[]): IStringDictionary => { + const result: IStringDictionary = {}; + for (const override of overrides) { + for (const identifier of override.identifiers) { + result[identifier] = override; + } + } + return result; + }; + const toOverridesByIdentifier: IStringDictionary = to ? byOverrideIdentifier(to.overrides) : {}; + const fromOverridesByIdentifier: IStringDictionary = from ? byOverrideIdentifier(from.overrides) : {}; + + if (Object.keys(toOverridesByIdentifier).length) { + for (const key of added) { + const override = toOverridesByIdentifier[key]; + if (override) { + overrides.push([key, override.keys]); + } + } + } + if (Object.keys(fromOverridesByIdentifier).length) { + for (const key of removed) { + const override = fromOverridesByIdentifier[key]; + if (override) { + overrides.push([key, override.keys]); + } + } + } + + if (Object.keys(toOverridesByIdentifier).length && Object.keys(fromOverridesByIdentifier).length) { + for (const key of updated) { + const fromOverride = fromOverridesByIdentifier[key]; + const toOverride = toOverridesByIdentifier[key]; + if (fromOverride && toOverride) { + const result = compare({ contents: fromOverride.contents, keys: fromOverride.keys, overrides: [] }, { contents: toOverride.contents, keys: toOverride.keys, overrides: [] }); + overrides.push([key, [...result.added, ...result.removed, ...result.updated]]); + } + } + } + + return { added, removed, updated, overrides }; } export function toOverrides(raw: any, conflictReporter: (message: string) => void): IOverrides[] { @@ -172,6 +228,7 @@ export function toOverrides(raw: any, conflictReporter: (message: string) => voi } overrides.push({ identifiers: [overrideIdentifierFromKey(key).trim()], + keys: Object.keys(overrideRaw), contents: toValuesTree(overrideRaw, conflictReporter) }); } diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 932b169fbda..be4d11e757a 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -192,7 +192,8 @@ export class DefaultConfigurationModel extends ConfigurationModel { if (OVERRIDE_PROPERTY_PATTERN.test(key)) { overrides.push({ identifiers: [overrideIdentifierFromKey(key).trim()], - contents: toValuesTree(contents[key], message => console.error(`Conflict in default settings file: ${message}`)) + keys: Object.keys(contents[key]), + contents: toValuesTree(contents[key], message => console.error(`Conflict in default settings file: ${message}`)), }); } } @@ -638,13 +639,21 @@ export class AbstractConfigurationChangeEvent { return true; } - protected updateKeys(configuration: ConfigurationModel, keys: string[], resource?: URI): void { + protected updateKeys(configuration: ConfigurationModel, { keys, overrides }: IConfigurationChange, resource?: URI): void { for (const key of keys) { configuration.setValue(key, {}); } + for (const [overrideIdentifier, keys] of overrides) { + configuration.setValue(overrideIdentifier, keys.reduce((value: any, key) => { value[key] = {}; return value; }, {})); + } } } +export interface IConfigurationChange { + keys: string[]; + overrides: [string, string[]][]; +} + export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent implements IConfigurationChangeEvent { private _source: ConfigurationTarget; @@ -665,8 +674,8 @@ export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent i return this._changedConfigurationByResource; } - change(event: ConfigurationChangeEvent): ConfigurationChangeEvent; - change(keys: string[], resource?: URI): ConfigurationChangeEvent; + change(changeEvent: ConfigurationChangeEvent): ConfigurationChangeEvent; + change(change: IConfigurationChange, resource?: URI): ConfigurationChangeEvent; change(arg1: any, arg2?: any): ConfigurationChangeEvent { if (arg1 instanceof ConfigurationChangeEvent) { this._changedConfiguration = this._changedConfiguration.merge(arg1._changedConfiguration); @@ -716,9 +725,9 @@ export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent i return configurationModelsToSearch.some(configuration => this.doesConfigurationContains(configuration, config)); } - private changeWithKeys(keys: string[], resource?: URI): void { + private changeWithKeys(change: IConfigurationChange, resource?: URI): void { let changedConfiguration = resource ? this.getOrSetChangedConfigurationForResource(resource) : this._changedConfiguration; - this.updateKeys(changedConfiguration, keys); + this.updateKeys(changedConfiguration, change); } private getOrSetChangedConfigurationForResource(resource: URI): ConfigurationModel { diff --git a/src/vs/workbench/api/node/extHostLogService.ts b/src/vs/workbench/api/node/extHostLogService.ts index 263758ec40a..c3b35583561 100644 --- a/src/vs/workbench/api/node/extHostLogService.ts +++ b/src/vs/workbench/api/node/extHostLogService.ts @@ -20,9 +20,13 @@ export class ExtHostLogService extends DelegatedLogService implements ILogServic constructor( @IExtHostInitDataService initData: IExtHostInitDataService, + @IExtHostOutputService outputSerice: IExtHostOutputService, ) { if (initData.logFile.scheme !== Schemas.file) { throw new Error('Only file-logging supported'); } super(new SpdLogService(ExtensionHostLogFileName, dirname(initData.logFile).fsPath, initData.logLevel)); + outputSerice.createOutputChannelFromLogFile( + initData.remote.isRemote ? localize('remote extension host Log', "Remote Extension Host") : localize('extension host Log', "Extension Host"), + initData.logFile); } $setLevel(level: LogLevel): void { diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index ed091e67e21..d4dd50455c6 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -128,45 +128,40 @@ export class Configuration extends BaseConfiguration { } compareAndUpdateLocalUserConfiguration(user: ConfigurationModel): ConfigurationChangeEvent { - const { added, updated, removed } = compare(this.localUserConfiguration, user); - let changedKeys = [...added, ...updated, ...removed]; - if (changedKeys.length) { + const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user); + const keys = [...added, ...updated, ...removed]; + if (keys.length) { super.updateLocalUserConfiguration(user); } - return new ConfigurationChangeEvent().change(changedKeys); + return new ConfigurationChangeEvent().change({ keys, overrides }); } compareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): ConfigurationChangeEvent { - const { added, updated, removed } = compare(this.remoteUserConfiguration, user); - let changedKeys = [...added, ...updated, ...removed]; - if (changedKeys.length) { + const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { super.updateRemoteUserConfiguration(user); } - return new ConfigurationChangeEvent().change(changedKeys); + return new ConfigurationChangeEvent().change({ keys, overrides }); } compareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): ConfigurationChangeEvent { - const { added, updated, removed } = compare(this.workspaceConfiguration, workspaceConfiguration); - let changedKeys = [...added, ...updated, ...removed]; - if (changedKeys.length) { + const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { super.updateWorkspaceConfiguration(workspaceConfiguration); } - return new ConfigurationChangeEvent().change(changedKeys); + return new ConfigurationChangeEvent().change({ keys, overrides }); } compareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): ConfigurationChangeEvent { const currentFolderConfiguration = this.folderConfigurations.get(resource); - if (currentFolderConfiguration) { - const { added, updated, removed } = compare(currentFolderConfiguration, folderConfiguration); - let changedKeys = [...added, ...updated, ...removed]; - if (changedKeys.length) { - super.updateFolderConfiguration(resource, folderConfiguration); - } - return new ConfigurationChangeEvent().change(changedKeys, resource); - } else { + const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { super.updateFolderConfiguration(resource, folderConfiguration); - return new ConfigurationChangeEvent().change(folderConfiguration.keys, resource); } + return new ConfigurationChangeEvent().change({ keys, overrides }, resource); } compareAndDeleteFolderConfiguration(folder: URI): ConfigurationChangeEvent { @@ -178,9 +173,9 @@ export class Configuration extends BaseConfiguration { if (!folderConfig) { throw new Error('Unknown folder'); } - const keys = folderConfig.keys; super.deleteFolderConfiguration(folder); - return new ConfigurationChangeEvent().change(keys, folder); + const { added, updated, removed, overrides } = compare(folderConfig, undefined); + return new ConfigurationChangeEvent().change({ keys: [...added, ...updated, ...removed], overrides }, folder); } compare(other: Configuration): string[] { @@ -208,7 +203,8 @@ export class AllKeysConfigurationChangeEvent extends AbstractConfigurationChange get changedConfiguration(): ConfigurationModel { if (!this._changedConfiguration) { this._changedConfiguration = new ConfigurationModel(); - this.updateKeys(this._changedConfiguration, this.affectedKeys); + const { added, updated, removed, overrides } = compare(undefined, this._changedConfiguration); + this.updateKeys(this._changedConfiguration, { keys: [...added, ...updated, ...removed], overrides }); } return this._changedConfiguration; } From cd5784cc271107281c71484be8ad40955b2fe6f0 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 11 Dec 2019 16:11:18 +0100 Subject: [PATCH 334/637] debug: callStack contribution is now an editor contribution --- ...tion.ts => callStackEditorContribution.ts} | 124 +++++++----------- .../debug/browser/debug.contribution.ts | 2 - src/vs/workbench/workbench.common.main.ts | 1 + 3 files changed, 52 insertions(+), 75 deletions(-) rename src/vs/workbench/contrib/debug/browser/{debugCallStackContribution.ts => callStackEditorContribution.ts} (70%) diff --git a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts similarity index 70% rename from src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts rename to src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts index dc262b161e6..dfb75360ff0 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCallStackContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts @@ -5,82 +5,65 @@ import { Constants } from 'vs/base/common/uint'; import { Range } from 'vs/editor/common/core/range'; -import { ITextModel, TrackedRangeStickiness, IModelDeltaDecoration, IModelDecorationOptions } from 'vs/editor/common/model'; -import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; -import { IDebugService, State } from 'vs/workbench/contrib/debug/common/debug'; -import { IModelService } from 'vs/editor/common/services/modelService'; +import { TrackedRangeStickiness, IModelDeltaDecoration, IModelDecorationOptions } from 'vs/editor/common/model'; +import { IDebugService, IStackFrame } from 'vs/workbench/contrib/debug/common/debug'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { registerColor } from 'vs/platform/theme/common/colorRegistry'; import { localize } from 'vs/nls'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; - -interface IDebugEditorModelData { - model: ITextModel; - currentStackDecorations: string[]; - topStackFrameRange: Range | undefined; -} +import { IEditorContribution } from 'vs/editor/common/editorCommon'; +import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; const stickiness = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges; -export class DebugCallStackContribution implements IWorkbenchContribution { - private modelDataMap = new Map(); +class CallStackEditorContribution implements IEditorContribution { private toDispose: IDisposable[] = []; + private decorationIds: string[] = []; + private topStackFrameRange: Range | undefined; constructor( - @IModelService private readonly modelService: IModelService, + private readonly editor: ICodeEditor, @IDebugService private readonly debugService: IDebugService, ) { - this.registerListeners(); - } - - private registerListeners(): void { - this.toDispose.push(this.modelService.onModelAdded(this.onModelAdded, this)); - this.modelService.getModels().forEach(model => this.onModelAdded(model)); - this.toDispose.push(this.modelService.onModelRemoved(this.onModelRemoved, this)); - - this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => this.onFocusStackFrame())); - this.toDispose.push(this.debugService.onDidChangeState(state => { - if (state === State.Inactive) { - this.modelDataMap.forEach(modelData => { - modelData.topStackFrameRange = undefined; - }); + const setDecorations = () => this.decorationIds = this.editor.deltaDecorations(this.decorationIds, this.createCallStackDecorations()); + this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => { + setDecorations(); + })); + this.toDispose.push(this.editor.onDidChangeModel(e => { + if (e.newModelUrl) { + setDecorations(); } })); } - private onModelAdded(model: ITextModel): void { - const modelUriStr = model.uri.toString(); - const currentStackDecorations = model.deltaDecorations([], this.createCallStackDecorations(modelUriStr)); + private createCallStackDecorations(): IModelDeltaDecoration[] { + const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame; + const decorations: IModelDeltaDecoration[] = []; + this.debugService.getModel().getSessions().forEach(s => { + s.getAllThreads().forEach(t => { + if (t.stopped) { + let candidateStackFrame = t === focusedStackFrame?.thread ? focusedStackFrame : undefined; + if (!candidateStackFrame) { + const callStack = t.getCallStack(); + if (callStack.length) { + candidateStackFrame = callStack[0]; + } + } - this.modelDataMap.set(modelUriStr, { - model: model, - currentStackDecorations: currentStackDecorations, - topStackFrameRange: undefined + if (candidateStackFrame && candidateStackFrame.source.uri.toString() === this.editor.getModel()?.uri.toString()) { + decorations.push(...this.createDecorationsForStackFrame(candidateStackFrame)); + } + } + }); }); + + return decorations; } - private onModelRemoved(model: ITextModel): void { - const modelUriStr = model.uri.toString(); - const data = this.modelDataMap.get(modelUriStr); - if (data) { - this.modelDataMap.delete(modelUriStr); - } - } - - private onFocusStackFrame(): void { - this.modelDataMap.forEach((modelData, uri) => { - modelData.currentStackDecorations = modelData.model.deltaDecorations(modelData.currentStackDecorations, this.createCallStackDecorations(uri)); - }); - } - - private createCallStackDecorations(modelUriStr: string): IModelDeltaDecoration[] { - const result: IModelDeltaDecoration[] = []; - const stackFrame = this.debugService.getViewModel().focusedStackFrame; - if (!stackFrame || stackFrame.source.uri.toString() !== modelUriStr) { - return result; - } - + private createDecorationsForStackFrame(stackFrame: IStackFrame): IModelDeltaDecoration[] { // only show decorations for the currently focused thread. + const result: IModelDeltaDecoration[] = []; const columnUntilEOLRange = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, Constants.MAX_SAFE_SMALL_INTEGER); const range = new Range(stackFrame.range.startLineNumber, stackFrame.range.startColumn, stackFrame.range.startLineNumber, stackFrame.range.startColumn + 1); @@ -89,33 +72,30 @@ export class DebugCallStackContribution implements IWorkbenchContribution { const callStack = stackFrame.thread.getCallStack(); if (callStack && callStack.length && stackFrame === callStack[0]) { result.push({ - options: DebugCallStackContribution.TOP_STACK_FRAME_MARGIN, + options: CallStackEditorContribution.TOP_STACK_FRAME_MARGIN, range }); result.push({ - options: DebugCallStackContribution.TOP_STACK_FRAME_DECORATION, + options: CallStackEditorContribution.TOP_STACK_FRAME_DECORATION, range: columnUntilEOLRange }); - const modelData = this.modelDataMap.get(modelUriStr); - if (modelData) { - if (modelData.topStackFrameRange && modelData.topStackFrameRange.startLineNumber === stackFrame.range.startLineNumber && modelData.topStackFrameRange.startColumn !== stackFrame.range.startColumn) { - result.push({ - options: DebugCallStackContribution.TOP_STACK_FRAME_INLINE_DECORATION, - range: columnUntilEOLRange - }); - } - modelData.topStackFrameRange = columnUntilEOLRange; + if (this.topStackFrameRange && this.topStackFrameRange.startLineNumber === stackFrame.range.startLineNumber && this.topStackFrameRange.startColumn !== stackFrame.range.startColumn) { + result.push({ + options: CallStackEditorContribution.TOP_STACK_FRAME_INLINE_DECORATION, + range: columnUntilEOLRange + }); } + this.topStackFrameRange = columnUntilEOLRange; } else { result.push({ - options: DebugCallStackContribution.FOCUSED_STACK_FRAME_MARGIN, + options: CallStackEditorContribution.FOCUSED_STACK_FRAME_MARGIN, range }); result.push({ - options: DebugCallStackContribution.FOCUSED_STACK_FRAME_DECORATION, + options: CallStackEditorContribution.FOCUSED_STACK_FRAME_DECORATION, range: columnUntilEOLRange }); } @@ -156,12 +136,8 @@ export class DebugCallStackContribution implements IWorkbenchContribution { }; dispose(): void { - this.modelDataMap.forEach(modelData => { - modelData.model.deltaDecorations(modelData.currentStackDecorations, []); - }); + this.editor.deltaDecorations(this.decorationIds, []); this.toDispose = dispose(this.toDispose); - - this.modelDataMap.clear(); } } @@ -240,3 +216,5 @@ const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpoin const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.')); const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.')); const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.')); + +registerEditorContribution('editor.contrib.callStack', CallStackEditorContribution); diff --git a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts index ae27dbd0f82..7a34ad9f205 100644 --- a/src/vs/workbench/contrib/debug/browser/debug.contribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debug.contribution.ts @@ -46,7 +46,6 @@ import { WatchExpressionsView } from 'vs/workbench/contrib/debug/browser/watchEx import { VariablesView } from 'vs/workbench/contrib/debug/browser/variablesView'; import { ClearReplAction, Repl } from 'vs/workbench/contrib/debug/browser/repl'; import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider'; -import { DebugCallStackContribution } from 'vs/workbench/contrib/debug/browser/debugCallStackContribution'; import { DebugViewlet } from 'vs/workbench/contrib/debug/browser/debugViewlet'; import { StartView } from 'vs/workbench/contrib/debug/browser/startView'; import { ThemeIcon } from 'vs/platform/theme/common/themeService'; @@ -122,7 +121,6 @@ const registry = Registry.as(WorkbenchActionRegistryEx registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugPanelAction, OpenDebugPanelAction.ID, OpenDebugPanelAction.LABEL, openPanelKb), 'View: Debug Console', nls.localize('view', "View")); registry.registerWorkbenchAction(SyncActionDescriptor.create(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View")); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugCallStackContribution, LifecyclePhase.Restored); Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugToolBar, LifecyclePhase.Restored); Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DebugContentProvider, LifecyclePhase.Eventually); Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(StatusBarColorProvider, LifecyclePhase.Eventually); diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index c0b70a6d0e9..c84ec3c03aa 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -164,6 +164,7 @@ import 'vs/workbench/contrib/debug/browser/debug.contribution'; import 'vs/workbench/contrib/debug/browser/debugQuickOpen'; import 'vs/workbench/contrib/debug/browser/debugEditorContribution'; import 'vs/workbench/contrib/debug/browser/breakpointEditorContribution'; +import 'vs/workbench/contrib/debug/browser/callStackEditorContribution'; import 'vs/workbench/contrib/debug/browser/repl'; import 'vs/workbench/contrib/debug/browser/debugViewlet'; From 8d931ec04d4dd515e9e8182a38a4ca9fa2195f6c Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 11 Dec 2019 16:18:12 +0100 Subject: [PATCH 335/637] remove breakpoint from debug-stackframe class names. These should be unrelated #86469 --- .../base/browser/ui/codiconLabel/codicon/codicon.css | 6 +++--- .../debug/browser/callStackEditorContribution.ts | 12 ++++++------ .../debug/browser/media/debug.contribution.css | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css index 162038bd8e5..322f814c01a 100644 --- a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css +++ b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css @@ -395,9 +395,9 @@ .codicon-debug-breakpoint-function-unverified:before { content: "\eb87" } .codicon-debug-breakpoint-function:before { content: "\eb88" } .codicon-debug-breakpoint-function-disabled:before { content: "\eb88" } -.codicon-debug-breakpoint-stackframe-active:before { content: "\eb89" } -.codicon-debug-breakpoint-stackframe:before { content: "\eb8b" } -.codicon-debug-breakpoint-stackframe-focused:before { content: "\eb8b" } +.codicon-debug-stackframe-active:before { content: "\eb89" } +.codicon-debug-stackframe:before { content: "\eb8b" } +.codicon-debug-stackframe-focused:before { content: "\eb8b" } .codicon-debug-breakpoint-unsupported:before { content: "\eb8c" } .codicon-symbol-string:before { content: "\eb8d" } .codicon-debug-reverse-continue:before { content: "\eb8e" } diff --git a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts index dfb75360ff0..9c413547872 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts @@ -108,12 +108,12 @@ class CallStackEditorContribution implements IEditorContribution { static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges; // we need a separate decoration for glyph margin, since we do not want it on each line of a multi line statement. private static TOP_STACK_FRAME_MARGIN: IModelDecorationOptions = { - glyphMarginClassName: 'codicon-debug-breakpoint-stackframe', + glyphMarginClassName: 'codicon-debug-stackframe', stickiness }; private static FOCUSED_STACK_FRAME_MARGIN: IModelDecorationOptions = { - glyphMarginClassName: 'codicon-debug-breakpoint-stackframe-focused', + glyphMarginClassName: 'codicon-debug-stackframe-focused', stickiness }; @@ -163,8 +163,8 @@ registerThemingParticipant((theme, collector) => { .monaco-workbench .codicon-debug-breakpoint-data, .monaco-workbench .codicon-debug-breakpoint-unsupported, .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), - .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after, - .monaco-workbench .codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after { + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe::after { color: ${debugIconBreakpointColor} !important; } `); @@ -191,7 +191,7 @@ registerThemingParticipant((theme, collector) => { const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); if (debugIconBreakpointCurrentStackframeForegroundColor) { collector.addRule(` - .monaco-workbench .codicon-debug-breakpoint-stackframe { + .monaco-workbench .codicon-debug-stackframe { color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; } `); @@ -200,7 +200,7 @@ registerThemingParticipant((theme, collector) => { const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground); if (debugIconBreakpointStackframeFocusedColor) { collector.addRule(` - .monaco-workbench .codicon-debug-breakpoint-stackframe-focused { + .monaco-workbench .codicon-debug-stackframe-focused { color: ${debugIconBreakpointStackframeFocusedColor} !important; } `); diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index 858d8cbacd7..f88a902579c 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -16,8 +16,8 @@ align-items: center; } -.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe-focused::after, -.codicon-debug-breakpoint.codicon-debug-breakpoint-stackframe::after { +.codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, +.codicon-debug-breakpoint.codicon-debug-stackframe::after { content: "\eb8a"; position: absolute; } From c3720e2925bcda6d979407cb4ad949b1f38472e5 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 11 Dec 2019 16:23:33 +0100 Subject: [PATCH 336/637] move breakpoint theming participant to breakpointEditorContribution #86469 --- .../browser/breakpointEditorContribution.ts | 63 +++++++++++++++++++ .../browser/callStackEditorContribution.ts | 60 ------------------ 2 files changed, 63 insertions(+), 60 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 5374107fe82..8cec3096c76 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -34,6 +34,8 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { BrowserFeatures } from 'vs/base/browser/canIUse'; import { isSafari } from 'vs/base/browser/browser'; +import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { registerColor } from 'vs/platform/theme/common/colorRegistry'; const $ = dom.$; @@ -622,4 +624,65 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable { } } +registerThemingParticipant((theme, collector) => { + const debugIconBreakpointColor = theme.getColor(debugIconBreakpointForeground); + if (debugIconBreakpointColor) { + collector.addRule(` + .monaco-workbench .codicon-debug-breakpoint, + .monaco-workbench .codicon-debug-breakpoint-conditional, + .monaco-workbench .codicon-debug-breakpoint-log, + .monaco-workbench .codicon-debug-breakpoint-function, + .monaco-workbench .codicon-debug-breakpoint-data, + .monaco-workbench .codicon-debug-breakpoint-unsupported, + .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, + .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe::after { + color: ${debugIconBreakpointColor} !important; + } + `); + } + + const debugIconBreakpointDisabledColor = theme.getColor(debugIconBreakpointDisabledForeground); + if (debugIconBreakpointDisabledColor) { + collector.addRule(` + .monaco-workbench .codicon[class*='-disabled'] { + color: ${debugIconBreakpointDisabledColor} !important; + } + `); + } + + const debugIconBreakpointUnverifiedColor = theme.getColor(debugIconBreakpointUnverifiedForeground); + if (debugIconBreakpointUnverifiedColor) { + collector.addRule(` + .monaco-workbench .codicon[class*='-unverified'] { + color: ${debugIconBreakpointUnverifiedColor} !important; + } + `); + } + + const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); + if (debugIconBreakpointCurrentStackframeForegroundColor) { + collector.addRule(` + .monaco-workbench .codicon-debug-stackframe { + color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; + } + `); + } + + const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground); + if (debugIconBreakpointStackframeFocusedColor) { + collector.addRule(` + .monaco-workbench .codicon-debug-stackframe-focused { + color: ${debugIconBreakpointStackframeFocusedColor} !important; + } + `); + } +}); + +const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, nls.localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.')); +const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, nls.localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.')); +const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, nls.localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.')); +const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, nls.localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.')); +const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, nls.localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.')); + registerEditorContribution(BREAKPOINT_EDITOR_CONTRIBUTION_ID, BreakpointEditorContribution); diff --git a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts index 9c413547872..de13f54b873 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts @@ -152,69 +152,9 @@ registerThemingParticipant((theme, collector) => { if (focusedStackFrame) { collector.addRule(`.monaco-editor .view-overlays .debug-focused-stack-frame-line { background: ${focusedStackFrame}; }`); } - - const debugIconBreakpointColor = theme.getColor(debugIconBreakpointForeground); - if (debugIconBreakpointColor) { - collector.addRule(` - .monaco-workbench .codicon-debug-breakpoint, - .monaco-workbench .codicon-debug-breakpoint-conditional, - .monaco-workbench .codicon-debug-breakpoint-log, - .monaco-workbench .codicon-debug-breakpoint-function, - .monaco-workbench .codicon-debug-breakpoint-data, - .monaco-workbench .codicon-debug-breakpoint-unsupported, - .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), - .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, - .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe::after { - color: ${debugIconBreakpointColor} !important; - } - `); - } - - const debugIconBreakpointDisabledColor = theme.getColor(debugIconBreakpointDisabledForeground); - if (debugIconBreakpointDisabledColor) { - collector.addRule(` - .monaco-workbench .codicon[class*='-disabled'] { - color: ${debugIconBreakpointDisabledColor} !important; - } - `); - } - - const debugIconBreakpointUnverifiedColor = theme.getColor(debugIconBreakpointUnverifiedForeground); - if (debugIconBreakpointUnverifiedColor) { - collector.addRule(` - .monaco-workbench .codicon[class*='-unverified'] { - color: ${debugIconBreakpointUnverifiedColor} !important; - } - `); - } - - const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); - if (debugIconBreakpointCurrentStackframeForegroundColor) { - collector.addRule(` - .monaco-workbench .codicon-debug-stackframe { - color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; - } - `); - } - - const debugIconBreakpointStackframeFocusedColor = theme.getColor(debugIconBreakpointStackframeForeground); - if (debugIconBreakpointStackframeFocusedColor) { - collector.addRule(` - .monaco-workbench .codicon-debug-stackframe-focused { - color: ${debugIconBreakpointStackframeFocusedColor} !important; - } - `); - } - }); const topStackFrameColor = registerColor('editor.stackFrameHighlightBackground', { dark: '#ffff0033', light: '#ffff6673', hc: '#fff600' }, localize('topStackFrameLineHighlight', 'Background color for the highlight of line at the top stack frame position.')); const focusedStackFrameColor = registerColor('editor.focusedStackFrameHighlightBackground', { dark: '#7abd7a4d', light: '#cee7ce73', hc: '#cee7ce' }, localize('focusedStackFrameLineHighlight', 'Background color for the highlight of line at focused stack frame position.')); -const debugIconBreakpointForeground = registerColor('debugIcon.breakpointForeground', { dark: '#E51400', light: '#E51400', hc: '#E51400' }, localize('debugIcon.breakpointForeground', 'Icon color for breakpoints.')); -const debugIconBreakpointDisabledForeground = registerColor('debugIcon.breakpointDisabledForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointDisabledForeground', 'Icon color for disabled breakpoints.')); -const debugIconBreakpointUnverifiedForeground = registerColor('debugIcon.breakpointUnverifiedForeground', { dark: '#848484', light: '#848484', hc: '#848484' }, localize('debugIcon.breakpointUnverifiedForeground', 'Icon color for unverified breakpoints.')); -const debugIconBreakpointCurrentStackframeForeground = registerColor('debugIcon.breakpointCurrentStackframeForeground', { dark: '#FFCC00', light: '#FFCC00', hc: '#FFCC00' }, localize('debugIcon.breakpointCurrentStackframeForeground', 'Icon color for the current breakpoint stack frame.')); -const debugIconBreakpointStackframeForeground = registerColor('debugIcon.breakpointStackframeForeground', { dark: '#89D185', light: '#89D185', hc: '#89D185' }, localize('debugIcon.breakpointStackframeForeground', 'Icon color for all breakpoint stack frames.')); - registerEditorContribution('editor.contrib.callStack', CallStackEditorContribution); From 41f07052042856f2357dc81453b0f77eec806ce4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 11 Dec 2019 11:55:02 +0100 Subject: [PATCH 337/637] debt - use new ApiCommand for executeWorkspaceSymbolProvider --- .../api/common/extHostApiCommands.ts | 39 +++++++------------ .../search/browser/search.contribution.ts | 12 +++--- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/vs/workbench/api/common/extHostApiCommands.ts b/src/vs/workbench/api/common/extHostApiCommands.ts index f671ebd74bd..6cbbe23026a 100644 --- a/src/vs/workbench/api/common/extHostApiCommands.ts +++ b/src/vs/workbench/api/common/extHostApiCommands.ts @@ -83,6 +83,21 @@ export class ApiCommand { const newCommands: ApiCommand[] = [ + // -- symbol search + new ApiCommand( + 'vscode.executeWorkspaceSymbolProvider', '_executeWorkspaceSymbolProvider', 'Execute all workspace symbol provider.', + [new ApiCommandArgument('query', 'Search string', v => typeof v === 'string', v => v)], + new ApiCommandResult<[search.IWorkspaceSymbolProvider, search.IWorkspaceSymbol[]][], types.SymbolInformation[]>('A promise that resolves to an array of SymbolInformation-instances.', value => { + const result: types.SymbolInformation[] = []; + if (Array.isArray(value)) { + for (let tuple of value) { + result.push(...tuple[1].map(typeConverters.WorkspaceSymbol.to)); + } + } + return result; + }) + ), + // --- call hierarchy new ApiCommand( 'vscode.prepareCallHierarchy', '_executePrepareCallHierarchy', 'Prepare call hierarchy at a position inside a document', [ApiCommandArgument.Uri, ApiCommandArgument.Position], @@ -121,12 +136,6 @@ export class ExtHostApiCommands { } registerCommands() { - this._register('vscode.executeWorkspaceSymbolProvider', this._executeWorkspaceSymbolProvider, { - description: 'Execute all workspace symbol provider.', - args: [{ name: 'query', description: 'Search string', constraint: String }], - returns: 'A promise that resolves to an array of SymbolInformation-instances.' - - }); this._register('vscode.executeDefinitionProvider', this._executeDefinitionProvider, { description: 'Execute all definition provider.', args: [ @@ -362,24 +371,6 @@ export class ExtHostApiCommands { this._disposables.add(disposable); } - /** - * Execute workspace symbol provider. - * - * @param query Search string to match query symbol names - * @return A promise that resolves to an array of symbol information. - */ - private _executeWorkspaceSymbolProvider(query: string): Promise { - return this._commands.executeCommand<[search.IWorkspaceSymbolProvider, search.IWorkspaceSymbol[]][]>('_executeWorkspaceSymbolProvider', { query }).then(value => { - const result: types.SymbolInformation[] = []; - if (Array.isArray(value)) { - for (let tuple of value) { - result.push(...tuple[1].map(typeConverters.WorkspaceSymbol.to)); - } - } - return result; - }); - } - private _executeDefinitionProvider(resource: URI, position: types.Position): Promise { const args = { resource, diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index 6a1b5e3f6b9..2bb92366d6a 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -5,13 +5,12 @@ import { Action } from 'vs/base/common/actions'; import { distinct } from 'vs/base/common/arrays'; -import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors'; +import { onUnexpectedError } from 'vs/base/common/errors'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import * as objects from 'vs/base/common/objects'; import * as platform from 'vs/base/common/platform'; import { dirname } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; -import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { getSelectionSearchString } from 'vs/editor/contrib/find/findController'; import { ToggleCaseSensitiveKeybinding, ToggleRegexKeybinding, ToggleWholeWordKeybinding } from 'vs/editor/contrib/find/findModel'; @@ -57,6 +56,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/explorerViewlet'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; +import { assertType } from 'vs/base/common/types'; registerSingleton(ISearchWorkbenchService, SearchWorkbenchService, true); registerSingleton(ISearchHistoryService, SearchHistoryService, true); @@ -829,11 +829,9 @@ configurationRegistry.registerConfiguration({ } }); -registerLanguageCommand('_executeWorkspaceSymbolProvider', function (accessor, args: { query: string; }) { - const { query } = args; - if (typeof query !== 'string') { - throw illegalArgument(); - } +CommandsRegistry.registerCommand('_executeWorkspaceSymbolProvider', function (accessor, ...args) { + const [query] = args; + assertType(typeof query === 'string'); return getWorkspaceSymbols(query); }); From 783970456be0c7634348e01ee61b2abb9a6ef3b1 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 11 Dec 2019 16:39:47 +0100 Subject: [PATCH 338/637] debt - migrate more language api commands onto new format --- src/vs/editor/browser/editorExtensions.ts | 56 ++- src/vs/editor/contrib/format/format.ts | 34 +- .../editor/contrib/gotoSymbol/goToSymbol.ts | 12 +- src/vs/editor/contrib/hover/getHover.ts | 4 +- src/vs/editor/contrib/quickOpen/quickOpen.ts | 31 +- .../editor/contrib/smartSelect/smartSelect.ts | 7 +- .../wordHighlighter/wordHighlighter.ts | 4 +- .../api/common/extHostApiCommands.ts | 349 ++++++------------ .../api/extHostApiCommands.test.ts | 22 ++ 9 files changed, 227 insertions(+), 292 deletions(-) diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 6855f9882d7..f6d836aac53 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -20,7 +20,7 @@ import { IConstructorSignature1, ServicesAccessor as InstantiationServicesAccess 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'; -import { withNullAsUndefined } from 'vs/base/common/types'; +import { withNullAsUndefined, assertType } from 'vs/base/common/types'; export type ServicesAccessor = InstantiationServicesAccessor; export type IEditorContributionCtor = IConstructorSignature1; @@ -311,6 +311,60 @@ export function registerDefaultLanguageCommand(id: string, handler: (model: ITex }); } +export function registerModelAndPositionCommand(id: string, handler: (model: ITextModel, position: Position, ...args: any[]) => any) { + CommandsRegistry.registerCommand(id, function (accessor, ...args) { + + const [resource, position] = args; + assertType(URI.isUri(resource)); + assertType(Position.isIPosition(position)); + + const model = accessor.get(IModelService).getModel(resource); + if (model) { + const editorPosition = Position.lift(position); + return handler(model, editorPosition, args.slice(2)); + } + + return accessor.get(ITextModelService).createModelReference(resource).then(reference => { + return new Promise((resolve, reject) => { + try { + const result = handler(reference.object.textEditorModel, Position.lift(position), args.slice(2)); + resolve(result); + } catch (err) { + reject(err); + } + }).finally(() => { + reference.dispose(); + }); + }); + }); +} + +export function registerModelCommand(id: string, handler: (model: ITextModel, ...args: any[]) => any) { + CommandsRegistry.registerCommand(id, function (accessor, ...args) { + + const [resource] = args; + assertType(URI.isUri(resource)); + + const model = accessor.get(IModelService).getModel(resource); + if (model) { + return handler(model, args.slice(1)); + } + + return accessor.get(ITextModelService).createModelReference(resource).then(reference => { + return new Promise((resolve, reject) => { + try { + const result = handler(reference.object.textEditorModel, args.slice(1)); + resolve(result); + } catch (err) { + reject(err); + } + }).finally(() => { + reference.dispose(); + }); + }); + }); +} + export function registerEditorCommand(editorCommand: T): T { EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand); return editorCommand; diff --git a/src/vs/editor/contrib/format/format.ts b/src/vs/editor/contrib/format/format.ts index cdf9ba12223..58602a5bfaf 100644 --- a/src/vs/editor/contrib/format/format.ts +++ b/src/vs/editor/contrib/format/format.ts @@ -10,7 +10,7 @@ import { illegalArgument, onUnexpectedExternalError } from 'vs/base/common/error import { URI } from 'vs/base/common/uri'; import { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from 'vs/editor/browser/core/editorState'; import { IActiveCodeEditor, isCodeEditor } from 'vs/editor/browser/editorBrowser'; -import { registerLanguageCommand, ServicesAccessor } from 'vs/editor/browser/editorExtensions'; +import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; @@ -25,6 +25,8 @@ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable } from 'vs/base/common/lifecycle'; import { LinkedList } from 'vs/base/common/linkedList'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { assertType } from 'vs/base/common/types'; export function alertFormattingEdits(edits: ISingleEditOperation[]): void { @@ -354,11 +356,11 @@ export function getOnTypeFormattingEdits( }); } -registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) { - const { resource, range, options } = args; - if (!(resource instanceof URI) || !Range.isIRange(range)) { - throw illegalArgument(); - } +CommandsRegistry.registerCommand('_executeFormatRangeProvider', function (accessor, ...args) { + const [resource, range, options] = args; + assertType(URI.isUri(resource)); + assertType(Range.isIRange(range)); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); @@ -366,11 +368,10 @@ registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) return getDocumentRangeFormattingEditsUntilResult(accessor.get(IEditorWorkerService), model, Range.lift(range), options, CancellationToken.None); }); -registerLanguageCommand('_executeFormatDocumentProvider', function (accessor, args) { - const { resource, options } = args; - if (!(resource instanceof URI)) { - throw illegalArgument('resource'); - } +CommandsRegistry.registerCommand('_executeFormatDocumentProvider', function (accessor, ...args) { + const [resource, options] = args; + assertType(URI.isUri(resource)); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); @@ -379,11 +380,12 @@ registerLanguageCommand('_executeFormatDocumentProvider', function (accessor, ar return getDocumentFormattingEditsUntilResult(accessor.get(IEditorWorkerService), model, options, CancellationToken.None); }); -registerLanguageCommand('_executeFormatOnTypeProvider', function (accessor, args) { - const { resource, position, ch, options } = args; - if (!(resource instanceof URI) || !Position.isIPosition(position) || typeof ch !== 'string') { - throw illegalArgument(); - } +CommandsRegistry.registerCommand('_executeFormatOnTypeProvider', function (accessor, ...args) { + const [resource, position, ch, options] = args; + assertType(URI.isUri(resource)); + assertType(Position.isIPosition(position)); + assertType(typeof ch === 'string'); + const model = accessor.get(IModelService).getModel(resource); if (!model) { throw illegalArgument('resource'); diff --git a/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts b/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts index 4610b7518ac..d478c783204 100644 --- a/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts +++ b/src/vs/editor/contrib/gotoSymbol/goToSymbol.ts @@ -6,7 +6,7 @@ import { flatten, coalesce } from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; -import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { ITextModel } from 'vs/editor/common/model'; import { LocationLink, DefinitionProviderRegistry, ImplementationProviderRegistry, TypeDefinitionProviderRegistry, DeclarationProviderRegistry, ProviderResult, ReferenceProviderRegistry } from 'vs/editor/common/modes'; @@ -72,8 +72,8 @@ export function getReferencesAtPosition(model: ITextModel, position: Position, c }); } -registerDefaultLanguageCommand('_executeDefinitionProvider', (model, position) => getDefinitionsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeDeclarationProvider', (model, position) => getDeclarationsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeImplementationProvider', (model, position) => getImplementationsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeTypeDefinitionProvider', (model, position) => getTypeDefinitionsAtPosition(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeReferenceProvider', (model, position) => getReferencesAtPosition(model, position, false, CancellationToken.None)); +registerModelAndPositionCommand('_executeDefinitionProvider', (model, position) => getDefinitionsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeDeclarationProvider', (model, position) => getDeclarationsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeImplementationProvider', (model, position) => getImplementationsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeTypeDefinitionProvider', (model, position) => getTypeDefinitionsAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeReferenceProvider', (model, position) => getReferencesAtPosition(model, position, false, CancellationToken.None)); diff --git a/src/vs/editor/contrib/hover/getHover.ts b/src/vs/editor/contrib/hover/getHover.ts index d6adae27bdf..db914a798ae 100644 --- a/src/vs/editor/contrib/hover/getHover.ts +++ b/src/vs/editor/contrib/hover/getHover.ts @@ -6,7 +6,7 @@ import { coalesce } from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; -import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { ITextModel } from 'vs/editor/common/model'; import { Hover, HoverProviderRegistry } from 'vs/editor/common/modes'; @@ -27,7 +27,7 @@ export function getHover(model: ITextModel, position: Position, token: Cancellat return Promise.all(promises).then(coalesce); } -registerDefaultLanguageCommand('_executeHoverProvider', (model, position) => getHover(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeHoverProvider', (model, position) => getHover(model, position, CancellationToken.None)); function isValid(result: Hover) { const hasRange = (typeof result.range !== 'undefined'); diff --git a/src/vs/editor/contrib/quickOpen/quickOpen.ts b/src/vs/editor/contrib/quickOpen/quickOpen.ts index 2730114175b..69c379413e2 100644 --- a/src/vs/editor/contrib/quickOpen/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/quickOpen.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { illegalArgument } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; -import { registerLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { DocumentSymbol } from 'vs/editor/common/modes'; import { IModelService } from 'vs/editor/common/services/modelService'; import { CancellationToken } from 'vs/base/common/cancellation'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { OutlineModel, OutlineElement } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { values } from 'vs/base/common/collections'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { assertType } from 'vs/base/common/types'; export async function getDocumentSymbols(document: ITextModel, flat: boolean, token: CancellationToken): Promise { @@ -63,26 +63,19 @@ function flatten(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideCo } -registerLanguageCommand('_executeDocumentSymbolProvider', function (accessor, args) { - const { resource } = args; - if (!(resource instanceof URI)) { - throw illegalArgument('resource'); - } +CommandsRegistry.registerCommand('_executeDocumentSymbolProvider', async function (accessor, ...args) { + const [resource] = args; + assertType(URI.isUri(resource)); + const model = accessor.get(IModelService).getModel(resource); if (model) { return getDocumentSymbols(model, false, CancellationToken.None); } - return accessor.get(ITextModelService).createModelReference(resource).then(reference => { - return new Promise((resolve, reject) => { - try { - const result = getDocumentSymbols(reference.object.textEditorModel, false, CancellationToken.None); - resolve(result); - } catch (err) { - reject(err); - } - }).finally(() => { - reference.dispose(); - }); - }); + const reference = await accessor.get(ITextModelService).createModelReference(resource); + try { + return await getDocumentSymbols(reference.object.textEditorModel, false, CancellationToken.None); + } finally { + reference.dispose(); + } }); diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index a98044f0ada..c5e66c3b2f4 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -7,7 +7,7 @@ import * as arrays from 'vs/base/common/arrays'; import { CancellationToken } from 'vs/base/common/cancellation'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { EditorAction, IActionOptions, registerEditorAction, registerEditorContribution, ServicesAccessor, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; +import { EditorAction, IActionOptions, registerEditorAction, registerEditorContribution, ServicesAccessor, registerModelCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; @@ -302,6 +302,7 @@ export function provideSelectionRanges(model: ITextModel, positions: Position[], }); } -registerDefaultLanguageCommand('_executeSelectionRangeProvider', function (model, _position, args) { - return provideSelectionRanges(model, args.positions, CancellationToken.None); +registerModelCommand('_executeSelectionRangeProvider', function (model, ...args) { + const [positions] = args; + return provideSelectionRanges(model, positions, CancellationToken.None); }); diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts index d3bc5b4e267..e4200b5dcfa 100644 --- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts @@ -11,7 +11,7 @@ import { onUnexpectedError, onUnexpectedExternalError } from 'vs/base/common/err import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Disposable, DisposableStore } from 'vs/base/common/lifecycle'; import { IActiveCodeEditor, ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { EditorAction, IActionOptions, registerDefaultLanguageCommand, registerEditorAction, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; +import { EditorAction, IActionOptions, registerEditorAction, registerEditorContribution, registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions'; import { CursorChangeReason, ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -155,7 +155,7 @@ function computeOccurencesAtPosition(model: ITextModel, selection: Selection, wo return new TextualOccurenceAtPositionRequest(model, selection, wordSeparators); } -registerDefaultLanguageCommand('_executeDocumentHighlights', (model, position) => getOccurrencesAtPosition(model, position, CancellationToken.None)); +registerModelAndPositionCommand('_executeDocumentHighlights', (model, position) => getOccurrencesAtPosition(model, position, CancellationToken.None)); class WordHighlighter { diff --git a/src/vs/workbench/api/common/extHostApiCommands.ts b/src/vs/workbench/api/common/extHostApiCommands.ts index 6cbbe23026a..9bde9324140 100644 --- a/src/vs/workbench/api/common/extHostApiCommands.ts +++ b/src/vs/workbench/api/common/extHostApiCommands.ts @@ -27,6 +27,7 @@ export class ApiCommandArgument { static readonly Uri = new ApiCommandArgument('uri', 'Uri of a text document', v => URI.isUri(v), v => v); static readonly Position = new ApiCommandArgument('position', 'A position in a text document', v => types.Position.isPosition(v), typeConverters.Position.from); + static readonly Range = new ApiCommandArgument('range', 'A range in a text document', v => types.Range.isRange(v), typeConverters.Range.from); static readonly CallHierarchyItem = new ApiCommandArgument('item', 'A call hierarchy item', v => v instanceof types.CallHierarchyItem, typeConverters.CallHierarchyItem.to); @@ -42,7 +43,7 @@ export class ApiCommandResult { constructor( readonly description: string, - readonly convert: (v: V) => O + readonly convert: (v: V, apiArgs: any[]) => O ) { } } @@ -68,7 +69,7 @@ export class ApiCommand { }); const internalResult = await commands.executeCommand(this.internalId, ...internalArgs); - return this.result.convert(internalResult); + return this.result.convert(internalResult, apiArgs); }, undefined, this._getCommandHandlerDesc()); } @@ -83,6 +84,108 @@ export class ApiCommand { const newCommands: ApiCommand[] = [ + // -- document highlights + new ApiCommand( + 'vscode.executeDocumentHighlights', '_executeDocumentHighlights', 'Execute document highlight provider.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.', tryMapWith(typeConverters.DocumentHighlight.to)) + ), + // -- document symbols + new ApiCommand( + 'vscode.executeDocumentSymbolProvider', '_executeDocumentSymbolProvider', 'Execute document symbol provider.', + [ApiCommandArgument.Uri], + new ApiCommandResult('A promise that resolves to an array of DocumentHighlight-instances.', (value, apiArgs) => { + + if (isFalsyOrEmpty(value)) { + return undefined; + } + class MergedInfo extends types.SymbolInformation implements vscode.DocumentSymbol { + static to(symbol: modes.DocumentSymbol): MergedInfo { + const res = new MergedInfo( + symbol.name, + typeConverters.SymbolKind.to(symbol.kind), + symbol.containerName || '', + new types.Location(apiArgs[0], typeConverters.Range.to(symbol.range)) + ); + res.detail = symbol.detail; + res.range = res.location.range; + res.selectionRange = typeConverters.Range.to(symbol.selectionRange); + res.children = symbol.children ? symbol.children.map(MergedInfo.to) : []; + return res; + } + + detail!: string; + range!: vscode.Range; + selectionRange!: vscode.Range; + children!: vscode.DocumentSymbol[]; + containerName!: string; + } + return value.map(MergedInfo.to); + + }) + ), + // -- formatting + new ApiCommand( + 'vscode.executeFormatDocumentProvider', '_executeFormatDocumentProvider', 'Execute document format provider.', + [ApiCommandArgument.Uri, new ApiCommandArgument('options', 'Formatting options', _ => true, v => v)], + new ApiCommandResult('A promise that resolves to an array of TextEdits.', tryMapWith(typeConverters.TextEdit.to)) + ), + new ApiCommand( + 'vscode.executeFormatRangeProvider', '_executeFormatRangeProvider', 'Execute range format provider.', + [ApiCommandArgument.Uri, ApiCommandArgument.Range, new ApiCommandArgument('options', 'Formatting options', _ => true, v => v)], + new ApiCommandResult('A promise that resolves to an array of TextEdits.', tryMapWith(typeConverters.TextEdit.to)) + ), + new ApiCommand( + 'vscode.executeFormatOnTypeProvider', '_executeFormatOnTypeProvider', 'Execute format on type provider.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position, new ApiCommandArgument('ch', 'Trigger character', v => typeof v === 'string', v => v), new ApiCommandArgument('options', 'Formatting options', _ => true, v => v)], + new ApiCommandResult('A promise that resolves to an array of TextEdits.', tryMapWith(typeConverters.TextEdit.to)) + ), + // -- go to symbol (definition, type definition, declaration, impl, references) + new ApiCommand( + 'vscode.executeDefinitionProvider', '_executeDefinitionProvider', 'Execute all definition provider.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to)) + ), + new ApiCommand( + 'vscode.executeTypeDefinitionProvider', '_executeTypeDefinitionProvider', 'Execute all type definition providers.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to)) + ), + new ApiCommand( + 'vscode.executeDeclarationProvider', '_executeDeclarationProvider', 'Execute all declaration providers.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to)) + ), + new ApiCommand( + 'vscode.executeImplementationProvider', '_executeImplementationProvider', 'Execute all implementation providers.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to)) + ), + new ApiCommand( + 'vscode.executeReferenceProvider', '_executeReferenceProvider', 'Execute all reference providers.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Location-instances.', tryMapWith(typeConverters.location.to)) + ), + // -- hover + new ApiCommand( + 'vscode.executeHoverProvider', '_executeHoverProvider', 'Execute all hover provider.', + [ApiCommandArgument.Uri, ApiCommandArgument.Position], + new ApiCommandResult('A promise that resolves to an array of Hover-instances.', tryMapWith(typeConverters.Hover.to)) + ), + // -- selection range + new ApiCommand( + 'vscode.executeSelectionRangeProvider', '_executeSelectionRangeProvider', 'Execute selection range provider.', + [ApiCommandArgument.Uri, new ApiCommandArgument('position', 'A positions in a text document', v => Array.isArray(v) && v.every(v => types.Position.isPosition(v)), v => v.map(typeConverters.Position.from))], + new ApiCommandResult('A promise that resolves to an array of ranges.', result => { + return result.map(ranges => { + let node: types.SelectionRange | undefined; + for (const range of ranges.reverse()) { + node = new types.SelectionRange(typeConverters.Range.to(range), node); + } + return node!; + }); + }) + ), // -- symbol search new ApiCommand( 'vscode.executeWorkspaceSymbolProvider', '_executeWorkspaceSymbolProvider', 'Execute all workspace symbol provider.', @@ -136,62 +239,6 @@ export class ExtHostApiCommands { } registerCommands() { - this._register('vscode.executeDefinitionProvider', this._executeDefinitionProvider, { - description: 'Execute all definition provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position of a symbol', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Location-instances.' - }); - this._register('vscode.executeDeclarationProvider', this._executeDeclaraionProvider, { - description: 'Execute all declaration provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position of a symbol', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Location-instances.' - }); - this._register('vscode.executeTypeDefinitionProvider', this._executeTypeDefinitionProvider, { - description: 'Execute all type definition providers.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position of a symbol', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Location-instances.' - }); - this._register('vscode.executeImplementationProvider', this._executeImplementationProvider, { - description: 'Execute all implementation providers.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position of a symbol', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Location-instance.' - }); - this._register('vscode.executeHoverProvider', this._executeHoverProvider, { - description: 'Execute all hover provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position of a symbol', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Hover-instances.' - }); - this._register('vscode.executeDocumentHighlights', this._executeDocumentHighlights, { - description: 'Execute document highlight provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position in a text document', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of DocumentHighlight-instances.' - }); - this._register('vscode.executeReferenceProvider', this._executeReferenceProvider, { - description: 'Execute reference provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position in a text document', constraint: types.Position } - ], - returns: 'A promise that resolves to an array of Location-instances.' - }); this._register('vscode.executeDocumentRenameProvider', this._executeDocumentRenameProvider, { description: 'Execute rename provider.', args: [ @@ -210,13 +257,6 @@ export class ExtHostApiCommands { ], returns: 'A promise that resolves to SignatureHelp.' }); - this._register('vscode.executeDocumentSymbolProvider', this._executeDocumentSymbolProvider, { - description: 'Execute document symbol provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI } - ], - returns: 'A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.' - }); this._register('vscode.executeCompletionItemProvider', this._executeCompletionItemProvider, { description: 'Execute completion item provider.', args: [ @@ -244,33 +284,7 @@ export class ExtHostApiCommands { ], returns: 'A promise that resolves to an array of CodeLens-instances.' }); - this._register('vscode.executeFormatDocumentProvider', this._executeFormatDocumentProvider, { - description: 'Execute document format provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'options', description: 'Formatting options' } - ], - returns: 'A promise that resolves to an array of TextEdits.' - }); - this._register('vscode.executeFormatRangeProvider', this._executeFormatRangeProvider, { - description: 'Execute range format provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'range', description: 'Range in a text document', constraint: types.Range }, - { name: 'options', description: 'Formatting options' } - ], - returns: 'A promise that resolves to an array of TextEdits.' - }); - this._register('vscode.executeFormatOnTypeProvider', this._executeFormatOnTypeProvider, { - description: 'Execute document format provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position in a text document', constraint: types.Position }, - { name: 'ch', description: 'Character that got typed', constraint: String }, - { name: 'options', description: 'Formatting options' } - ], - returns: 'A promise that resolves to an array of TextEdits.' - }); + this._register('vscode.executeLinkProvider', this._executeDocumentLinkProvider, { description: 'Execute document link provider.', args: [ @@ -293,14 +307,6 @@ export class ExtHostApiCommands { ], returns: 'A promise that resolves to an array of ColorPresentation objects.' }); - this._register('vscode.executeSelectionRangeProvider', this._executeSelectionRangeProvider, { - description: 'Execute selection range provider.', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'positions', description: 'Positions in a text document', constraint: Array.isArray } - ], - returns: 'A promise that resolves to an array of ranges.' - }); // ----------------------------------------------------------------- // The following commands are registered on both sides separately. @@ -371,69 +377,6 @@ export class ExtHostApiCommands { this._disposables.add(disposable); } - private _executeDefinitionProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeDefinitionProvider', args) - .then(tryMapWith(typeConverters.location.to)); - } - - private _executeDeclaraionProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeDeclarationProvider', args) - .then(tryMapWith(typeConverters.location.to)); - } - - private _executeTypeDefinitionProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeTypeDefinitionProvider', args) - .then(tryMapWith(typeConverters.location.to)); - } - - private _executeImplementationProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeImplementationProvider', args) - .then(tryMapWith(typeConverters.location.to)); - } - - private _executeHoverProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeHoverProvider', args) - .then(tryMapWith(typeConverters.Hover.to)); - } - - private _executeDocumentHighlights(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeDocumentHighlights', args) - .then(tryMapWith(typeConverters.DocumentHighlight.to)); - } - - private _executeReferenceProvider(resource: URI, position: types.Position): Promise { - const args = { - resource, - position: position && typeConverters.Position.from(position) - }; - return this._commands.executeCommand('_executeReferenceProvider', args) - .then(tryMapWith(typeConverters.location.to)); - } - private _executeDocumentRenameProvider(resource: URI, position: types.Position, newName: string): Promise { const args = { resource, @@ -493,24 +436,6 @@ export class ExtHostApiCommands { }); } - private _executeSelectionRangeProvider(resource: URI, positions: types.Position[]): Promise { - const pos = positions.map(typeConverters.Position.from); - const args = { - resource, - position: pos[0], - positions: pos - }; - return this._commands.executeCommand('_executeSelectionRangeProvider', args).then(result => { - return result.map(ranges => { - let node: types.SelectionRange | undefined; - for (const range of ranges.reverse()) { - node = new types.SelectionRange(typeConverters.Range.to(range), node); - } - return node!; - }); - }); - } - private _executeColorPresentationProvider(color: types.Color, context: { uri: URI, range: types.Range; }): Promise { const args = { resource: context.uri, @@ -525,38 +450,6 @@ export class ExtHostApiCommands { }); } - private _executeDocumentSymbolProvider(resource: URI): Promise { - const args = { - resource - }; - return this._commands.executeCommand('_executeDocumentSymbolProvider', args).then((value): vscode.SymbolInformation[] | undefined => { - if (isFalsyOrEmpty(value)) { - return undefined; - } - class MergedInfo extends types.SymbolInformation implements vscode.DocumentSymbol { - static to(symbol: modes.DocumentSymbol): MergedInfo { - const res = new MergedInfo( - symbol.name, - typeConverters.SymbolKind.to(symbol.kind), - symbol.containerName || '', - new types.Location(resource, typeConverters.Range.to(symbol.range)) - ); - res.detail = symbol.detail; - res.range = res.location.range; - res.selectionRange = typeConverters.Range.to(symbol.selectionRange); - res.children = symbol.children ? symbol.children.map(MergedInfo.to) : []; - return res; - } - - detail!: string; - range!: vscode.Range; - selectionRange!: vscode.Range; - children!: vscode.DocumentSymbol[]; - containerName!: string; - } - return value.map(MergedInfo.to); - }); - } private _executeCodeActionProvider(resource: URI, rangeOrSelection: types.Range | types.Selection, kind?: string): Promise<(vscode.CodeAction | vscode.Command | undefined)[] | undefined> { const args = { @@ -601,36 +494,6 @@ export class ExtHostApiCommands { } - private _executeFormatDocumentProvider(resource: URI, options: vscode.FormattingOptions): Promise { - const args = { - resource, - options - }; - return this._commands.executeCommand('_executeFormatDocumentProvider', args) - .then(tryMapWith(edit => new types.TextEdit(typeConverters.Range.to(edit.range), edit.text))); - } - - private _executeFormatRangeProvider(resource: URI, range: types.Range, options: vscode.FormattingOptions): Promise { - const args = { - resource, - range: typeConverters.Range.from(range), - options - }; - return this._commands.executeCommand('_executeFormatRangeProvider', args) - .then(tryMapWith(edit => new types.TextEdit(typeConverters.Range.to(edit.range), edit.text))); - } - - private _executeFormatOnTypeProvider(resource: URI, position: types.Position, ch: string, options: vscode.FormattingOptions): Promise { - const args = { - resource, - position: typeConverters.Position.from(position), - ch, - options - }; - return this._commands.executeCommand('_executeFormatOnTypeProvider', args) - .then(tryMapWith(edit => new types.TextEdit(typeConverters.Range.to(edit.range), edit.text))); - } - private _executeDocumentLinkProvider(resource: URI): Promise { return this._commands.executeCommand('_executeLinkProvider', resource) .then(tryMapWith(typeConverters.DocumentLink.to)); diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index bc9ca5a94a3..7b4f95e3aa4 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -30,6 +30,8 @@ import { NullLogService } from 'vs/platform/log/common/log'; import { ITextModel } from 'vs/editor/common/model'; import { nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; import { dispose } from 'vs/base/common/lifecycle'; +import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; +import { mock } from 'vs/workbench/test/electron-browser/api/mock'; const defaultSelector = { scheme: 'far' }; const model: ITextModel = EditorModel.createFromString( @@ -90,6 +92,11 @@ suite('ExtHostLanguageFeatureCommands', function () { onModelRemoved: undefined!, getCreationOptions() { throw new Error(); } }); + instantiationService.stub(IEditorWorkerService, new class extends mock() { + async computeMoreMinimalEdits(_uri: any, edits: any) { + return edits || undefined; + } + }); inst = instantiationService; } @@ -195,6 +202,21 @@ suite('ExtHostLanguageFeatureCommands', function () { assert.equal(symbols.length, 1); }); + // --- formatting + test('executeFormatDocumentProvider, back and forth', async function () { + + disposables.push(extHost.registerDocumentFormattingEditProvider(nullExtensionDescription, defaultSelector, new class implements vscode.DocumentFormattingEditProvider { + provideDocumentFormattingEdits() { + return [types.TextEdit.insert(new types.Position(0, 0), '42')]; + } + })); + + await rpcProtocol.sync(); + let edits = await commands.executeCommand('vscode.executeFormatDocumentProvider', model.uri); + assert.equal(edits.length, 1); + }); + + // --- definition test('Definition, invalid arguments', function () { From 83e7812ecc64446ad719933a88332b36f6606cd8 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 11 Dec 2019 16:41:11 +0100 Subject: [PATCH 339/637] Fixes microsoft/monaco-editor#1560 --- src/vs/editor/standalone/browser/standaloneLanguages.ts | 4 ++-- src/vs/monaco.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index 1818394dfdc..38ff152bdbb 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -424,7 +424,7 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod */ export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable { return modes.CodeActionProviderRegistry.register(languageId, { - provideCodeActions: (model: model.ITextModel, range: Range, context: modes.CodeActionContext, token: CancellationToken): modes.CodeActionList | Promise => { + provideCodeActions: (model: model.ITextModel, range: Range, context: modes.CodeActionContext, token: CancellationToken): modes.ProviderResult => { let markers = StaticServices.markerService.get().read({ resource: model.uri }).filter(m => { return Range.areIntersectingOrTouching(m, range); }); @@ -521,7 +521,7 @@ export interface CodeActionProvider { /** * Provide commands for the given document and range. */ - provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): modes.CodeActionList | Promise; + provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): modes.ProviderResult; } /** diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 53c70b9514e..d85824e5759 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -4524,7 +4524,7 @@ declare namespace monaco.languages { /** * Provide commands for the given document and range. */ - provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): CodeActionList | Promise; + provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult; } /** From 26a8754f970d6a1e5f0756b9f6103b9438c772a9 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Wed, 11 Dec 2019 16:52:11 +0100 Subject: [PATCH 340/637] Fixes microsoft/monaco-editor#1140 --- src/vs/editor/contrib/message/messageController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts index e8214f9a0d9..badf5eb2d6a 100644 --- a/src/vs/editor/contrib/message/messageController.ts +++ b/src/vs/editor/contrib/message/messageController.ts @@ -176,7 +176,7 @@ class MessageWidget implements IContentWidget { } getPosition(): IContentWidgetPosition { - return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE] }; + return { position: this._position, preference: [ContentWidgetPositionPreference.ABOVE, ContentWidgetPositionPreference.BELOW] }; } } From 45b6176b1d15a53827fbcf292e589b7f871b7b35 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 11 Dec 2019 16:55:30 +0100 Subject: [PATCH 341/637] breakpoints: do not redner candidates at the start of line --- .../browser/breakpointEditorContribution.ts | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 8cec3096c76..d77deee93be 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -54,18 +54,19 @@ const breakpointHelperDecoration: IModelDecorationOptions = { function createBreakpointDecorations(model: ITextModel, breakpoints: ReadonlyArray, debugService: IDebugService, debugSettings: IDebugConfiguration): { range: Range; options: IModelDecorationOptions; }[] { const result: { range: Range; options: IModelDecorationOptions; }[] = []; breakpoints.forEach((breakpoint) => { - if (breakpoint.lineNumber <= model.getLineCount()) { - const column = model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber); - const range = model.validateRange( - breakpoint.column ? new Range(breakpoint.lineNumber, breakpoint.column, breakpoint.lineNumber, breakpoint.column + 1) - : new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1) // Decoration has to have a width #20688 - ); - - result.push({ - options: getBreakpointDecorationOptions(model, breakpoint, debugService, debugSettings), - range - }); + if (breakpoint.lineNumber > model.getLineCount()) { + return; } + const column = model.getLineFirstNonWhitespaceColumn(breakpoint.lineNumber); + const range = model.validateRange( + breakpoint.column ? new Range(breakpoint.lineNumber, breakpoint.column, breakpoint.lineNumber, breakpoint.column + 1) + : new Range(breakpoint.lineNumber, column, breakpoint.lineNumber, column + 1) // Decoration has to have a width #20688 + ); + + result.push({ + options: getBreakpointDecorationOptions(model, breakpoint, debugService, debugSettings), + range + }); }); return result; @@ -113,8 +114,14 @@ async function createCandidateDecorations(model: ITextModel, breakpointDecoratio const positions = await session.breakpointsLocations(model.uri, lineNumber); if (positions.length > 1) { // Do not render candidates if there is only one, since it is already covered by the line breakpoint + const firstColumn = model.getLineFirstNonWhitespaceColumn(lineNumber); positions.forEach(p => { const range = new Range(p.lineNumber, p.column, p.lineNumber, p.column + 1); + if (p.column <= firstColumn) { + // Do not render candidates on the start of the line. + return; + } + const breakpointAtPosition = breakpointDecorations.filter(bpd => bpd.range.equalsRange(range)).pop(); if (breakpointAtPosition && breakpointAtPosition.inlineWidget) { // Space already occupied, do not render candidate. From cf9219150209e744620967f9c00fddc1a36ef535 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Wed, 11 Dec 2019 16:40:54 +0100 Subject: [PATCH 342/637] optionally load vs da --- src/vs/platform/sign/node/signService.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/vs/platform/sign/node/signService.ts b/src/vs/platform/sign/node/signService.ts index 4ccd1d1dffb..dac29b90c0c 100644 --- a/src/vs/platform/sign/node/signService.ts +++ b/src/vs/platform/sign/node/signService.ts @@ -5,10 +5,31 @@ import { ISignService } from 'vs/platform/sign/common/sign'; +/* tslint:disable */ + +declare module vsda { + export class signer { + sign(arg: any): any; + } +} + export class SignService implements ISignService { _serviceBrand: undefined; + private vsda(): Promise { + return new Promise((resolve, reject) => require(['vsda'], resolve, reject)); + } + async sign(value: string): Promise { + try { + const vsda = await this.vsda(); + const signer = new vsda.signer(); + if (signer) { + return signer.sign(value); + } + } catch (e) { + // ignore errors silently + } return value; } } From 68db7fc3f79e4fa8438343d9040d6b8aff6020d1 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Wed, 11 Dec 2019 16:55:31 +0100 Subject: [PATCH 343/637] update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 62646daa9a2..96014331af1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.42.0", - "distro": "5335b745c91d972634e882592d5edff5e3609503", + "distro": "f101ccfac35e35b6c4adb3a46f01ac3cd8fdb122", "author": { "name": "Microsoft Corporation" }, From cec6a7df5b5971eb373eab8959ef9869022d3d20 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 11 Dec 2019 16:59:03 +0100 Subject: [PATCH 344/637] complete all validations --- .../common/tokenClassificationRegistry.ts | 140 ++++++++++-------- .../services/themes/common/colorThemeData.ts | 42 ++---- .../tokenClassificationExtensionPoint.ts | 68 +++++++-- 3 files changed, 145 insertions(+), 105 deletions(-) diff --git a/src/vs/platform/theme/common/tokenClassificationRegistry.ts b/src/vs/platform/theme/common/tokenClassificationRegistry.ts index e4cf7231d15..a9355a0eb83 100644 --- a/src/vs/platform/theme/common/tokenClassificationRegistry.ts +++ b/src/vs/platform/theme/common/tokenClassificationRegistry.ts @@ -19,6 +19,7 @@ export const TOKEN_TYPE_WILDCARD_NUM = -1; export type TokenClassificationString = string; export const typeAndModifierIdPattern = '^\\w+[-_\\w+]*$'; +export const fontStylePattern = '^(\\s*(-?italic|-?bold|-?underline))*\\s*$'; export interface TokenClassification { type: number; @@ -54,6 +55,34 @@ export namespace TokenStyle { export function fromData(data: { foreground?: Color, bold?: boolean, underline?: boolean, italic?: boolean }) { return new TokenStyle(data.foreground, data.bold, data.underline, data.italic); } + export function fromSettings(foreground: string | undefined, fontStyle: string | undefined): TokenStyle { + let foregroundColor = undefined; + if (foreground !== undefined) { + foregroundColor = Color.fromHex(foreground); + } + let bold, underline, italic; + if (fontStyle !== undefined) { + fontStyle = fontStyle.trim(); + if (fontStyle.length === 0) { + bold = italic = underline = false; + } else { + const expression = /-?italic|-?bold|-?underline/g; + let match; + while ((match = expression.exec(fontStyle))) { + switch (match[0]) { + case 'bold': bold = true; break; + case '-bold': bold = false; break; + case 'italic': italic = true; break; + case '-italic': italic = false; break; + case 'underline': underline = true; break; + case '-underline': underline = false; break; + } + } + } + } + return new TokenStyle(foregroundColor, bold, underline, italic); + + } } export type ProbeScope = string[]; @@ -63,10 +92,10 @@ export interface TokenStyleFunction { } export interface TokenStyleDefaults { - scopesToProbe: ProbeScope[]; - light: TokenStyleValue | null; - dark: TokenStyleValue | null; - hc: TokenStyleValue | null; + scopesToProbe?: ProbeScope[]; + light?: TokenStyleValue; + dark?: TokenStyleValue; + hc?: TokenStyleValue; } export interface TokenStylingDefaultRule { @@ -192,7 +221,7 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { fontStyle: { type: 'string', description: nls.localize('schema.token.fontStyle', 'Font style of the rule: \'italic\', \'bold\' or \'underline\', \'-italic\', \'-bold\' or \'-underline\'or a combination. The empty string unsets inherited settings.'), - pattern: '^(\\s*(-?italic|-?bold|-?underline))*\\s*$', + pattern: fontStylePattern, patternErrorMessage: nls.localize('schema.fontStyle.error', 'Font style must be \'italic\', \'bold\' or \'underline\' to set a style or \'-italic\', \'-bold\' or \'-underline\' to unset or a combination. The empty string unsets all styles.'), defaultSnippets: [{ label: nls.localize('schema.token.fontStyle.none', 'None (clear inherited style)'), bodyText: '""' }, { body: 'italic' }, { body: 'bold' }, { body: 'underline' }, { body: '-italic' }, { body: '-bold' }, { body: '-underline' }, { body: 'italic bold' }, { body: 'italic underline' }, { body: 'bold underline' }, { body: 'italic bold underline' }] } @@ -208,8 +237,6 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { this.tokenModifierById = {}; this.tokenTypeById[TOKEN_TYPE_WILDCARD] = { num: TOKEN_TYPE_WILDCARD_NUM, id: TOKEN_TYPE_WILDCARD, description: '', deprecationMessage: undefined }; - - this.registerDefaultClassifications(); } public registerTokenType(id: string, description: string, deprecationMessage?: string): void { @@ -290,47 +317,6 @@ class TokenClassificationRegistry implements ITokenClassificationRegistry { return this.tokenStylingDefaultRules; } - private registerDefaultClassifications(): void { - - // default token types - - registerTokenType('comment', nls.localize('comment', "Style for comments."), [['comment']]); - registerTokenType('string', nls.localize('string', "Style for strings."), [['string']]); - registerTokenType('keyword', nls.localize('keyword', "Style for keywords."), [['keyword.control']]); - registerTokenType('number', nls.localize('number', "Style for numbers."), [['constant.numeric']]); - registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); - registerTokenType('operator', nls.localize('operator', "Style for operators."), [['keyword.operator']]); - - registerTokenType('namespace', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); - - registerTokenType('type', nls.localize('type', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); - registerTokenType('struct', nls.localize('struct', "Style for structs."), [['storage.type.struct']], 'type'); - registerTokenType('class', nls.localize('class', "Style for classes."), [['entity.name.class']], 'type'); - registerTokenType('interface', nls.localize('interface', "Style for interfaces."), undefined, 'type'); - registerTokenType('enum', nls.localize('enum', "Style for enums."), undefined, 'type'); - registerTokenType('parameterType', nls.localize('parameterType', "Style for parameter types."), undefined, 'type'); - - registerTokenType('function', nls.localize('function', "Style for functions"), [['entity.name.function'], ['support.function']]); - registerTokenType('macro', nls.localize('macro', "Style for macros."), undefined, 'function'); - - registerTokenType('variable', nls.localize('variable', "Style for variables."), [['variable'], ['entity.name.variable']]); - registerTokenType('constant', nls.localize('constant', "Style for constants."), undefined, 'variable'); - registerTokenType('parameter', nls.localize('parameter', "Style for parameters."), undefined, 'variable'); - registerTokenType('property', nls.localize('propertie', "Style for properties."), undefined, 'variable'); - - registerTokenType('label', nls.localize('labels', "Style for labels. "), undefined); - - // default token modifiers - - registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); - registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); - registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); - registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); - registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); - registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); - registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); - registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); - } public toString() { let sorter = (a: string, b: string) => { @@ -363,19 +349,57 @@ export function matchTokenStylingRule(themeSelector: TokenStylingRule | TokenSty const tokenClassificationRegistry = new TokenClassificationRegistry(); platform.Registry.add(Extensions.TokenClassificationContribution, tokenClassificationRegistry); -export function registerTokenType(id: string, description: string, scopesToProbe: ProbeScope[] = [], extendsTC: string | null = null, deprecationMessage?: string): string { - tokenClassificationRegistry.registerTokenType(id, description, deprecationMessage); +registerDefaultClassifications(); - if (scopesToProbe || extendsTC) { - const classification = tokenClassificationRegistry.getTokenClassification(id, []); - tokenClassificationRegistry.registerTokenStyleDefault(classification!, { scopesToProbe, light: extendsTC, dark: extendsTC, hc: extendsTC }); +function registerDefaultClassifications(): void { + function registerTokenType(id: string, description: string, scopesToProbe: ProbeScope[] = [], extendsTC?: string, deprecationMessage?: string): string { + tokenClassificationRegistry.registerTokenType(id, description, deprecationMessage); + + if (scopesToProbe || extendsTC) { + const classification = tokenClassificationRegistry.getTokenClassification(id, []); + tokenClassificationRegistry.registerTokenStyleDefault(classification!, { scopesToProbe, light: extendsTC, dark: extendsTC, hc: extendsTC }); + } + return id; } - return id; -} -export function registerTokenModifier(id: string, description: string, deprecationMessage?: string): string { - tokenClassificationRegistry.registerTokenModifier(id, description, deprecationMessage); - return id; + // default token types + + registerTokenType('comment', nls.localize('comment', "Style for comments."), [['comment']]); + registerTokenType('string', nls.localize('string', "Style for strings."), [['string']]); + registerTokenType('keyword', nls.localize('keyword', "Style for keywords."), [['keyword.control']]); + registerTokenType('number', nls.localize('number', "Style for numbers."), [['constant.numeric']]); + registerTokenType('regexp', nls.localize('regexp', "Style for expressions."), [['constant.regexp']]); + registerTokenType('operator', nls.localize('operator', "Style for operators."), [['keyword.operator']]); + + registerTokenType('namespace', nls.localize('namespace', "Style for namespaces."), [['entity.name.namespace']]); + + registerTokenType('type', nls.localize('type', "Style for types."), [['entity.name.type'], ['entity.name.class'], ['support.type'], ['support.class']]); + registerTokenType('struct', nls.localize('struct', "Style for structs."), [['storage.type.struct']], 'type'); + registerTokenType('class', nls.localize('class', "Style for classes."), [['entity.name.class']], 'type'); + registerTokenType('interface', nls.localize('interface', "Style for interfaces."), undefined, 'type'); + registerTokenType('enum', nls.localize('enum', "Style for enums."), undefined, 'type'); + registerTokenType('parameterType', nls.localize('parameterType', "Style for parameter types."), undefined, 'type'); + + registerTokenType('function', nls.localize('function', "Style for functions"), [['entity.name.function'], ['support.function']]); + registerTokenType('macro', nls.localize('macro', "Style for macros."), undefined, 'function'); + + registerTokenType('variable', nls.localize('variable', "Style for variables."), [['variable'], ['entity.name.variable']]); + registerTokenType('constant', nls.localize('constant', "Style for constants."), undefined, 'variable'); + registerTokenType('parameter', nls.localize('parameter', "Style for parameters."), undefined, 'variable'); + registerTokenType('property', nls.localize('propertie', "Style for properties."), undefined, 'variable'); + + registerTokenType('label', nls.localize('labels', "Style for labels. "), undefined); + + // default token modifiers + + tokenClassificationRegistry.registerTokenModifier('declaration', nls.localize('declaration', "Style for all symbol declarations."), undefined); + tokenClassificationRegistry.registerTokenModifier('documentation', nls.localize('documentation', "Style to use for references in documentation."), undefined); + tokenClassificationRegistry.registerTokenModifier('member', nls.localize('member', "Style to use for member functions, variables (fields) and types."), undefined); + tokenClassificationRegistry.registerTokenModifier('static', nls.localize('static', "Style to use for symbols that are static."), undefined); + tokenClassificationRegistry.registerTokenModifier('abstract', nls.localize('abstract', "Style to use for symbols that are abstract."), undefined); + tokenClassificationRegistry.registerTokenModifier('deprecated', nls.localize('deprecated', "Style to use for symbols that are deprecated."), undefined); + tokenClassificationRegistry.registerTokenModifier('modification', nls.localize('modification', "Style to use for write accesses."), undefined); + tokenClassificationRegistry.registerTokenModifier('async', nls.localize('async', "Style to use for symbols that are async."), undefined); } export function getTokenClassificationRegistry(): ITokenClassificationRegistry { diff --git a/src/vs/workbench/services/themes/common/colorThemeData.ts b/src/vs/workbench/services/themes/common/colorThemeData.ts index d093aca70c1..34a03efc88b 100644 --- a/src/vs/workbench/services/themes/common/colorThemeData.ts +++ b/src/vs/workbench/services/themes/common/colorThemeData.ts @@ -155,7 +155,10 @@ export class ColorThemeData implements IColorTheme { for (const rule of tokenClassificationRegistry.getTokenStylingDefaultRules()) { const matchScore = matchTokenStylingRule(rule, classification); if (matchScore >= 0) { - let style = this.resolveScopes(rule.defaults.scopesToProbe); + let style: TokenStyle | undefined; + if (rule.defaults.scopesToProbe) { + style = this.resolveScopes(rule.defaults.scopesToProbe); + } if (!style && useDefault !== false) { style = this.resolveTokenStyleValue(rule.defaults[this.type]); } @@ -185,8 +188,8 @@ export class ColorThemeData implements IColorTheme { /** * @param tokenStyleValue Resolve a tokenStyleValue in the context of a theme */ - private resolveTokenStyleValue(tokenStyleValue: TokenStyleValue | null): TokenStyle | undefined { - if (tokenStyleValue === null) { + private resolveTokenStyleValue(tokenStyleValue: TokenStyleValue | undefined): TokenStyle | undefined { + if (tokenStyleValue === undefined) { return undefined; } else if (typeof tokenStyleValue === 'string') { const [type, ...modifiers] = tokenStyleValue.split('.'); @@ -289,7 +292,7 @@ export class ColorThemeData implements IColorTheme { findTokenStyleForScopeInScopes(this.themeTokenScopeMatchers, this.themeTokenColors); findTokenStyleForScopeInScopes(this.customTokenScopeMatchers, this.customTokenColors); if (foreground !== undefined || fontStyle !== undefined) { - return getTokenStyle(foreground, fontStyle); + return TokenStyle.fromSettings(foreground, fontStyle); } } return undefined; @@ -682,34 +685,7 @@ function getScopeMatcher(rule: ITextMateThemingRule): Matcher { }; } -function getTokenStyle(foreground: string | undefined, fontStyle: string | undefined): TokenStyle { - let foregroundColor = undefined; - if (foreground !== undefined) { - foregroundColor = Color.fromHex(foreground); - } - let bold, underline, italic; - if (fontStyle !== undefined) { - fontStyle = fontStyle.trim(); - if (fontStyle.length === 0) { - bold = italic = underline = false; - } else { - const expression = /-?italic|-?bold|-?underline/g; - let match; - while ((match = expression.exec(fontStyle))) { - switch (match[0]) { - case 'bold': bold = true; break; - case '-bold': bold = false; break; - case 'italic': italic = true; break; - case '-italic': italic = false; break; - case 'underline': underline = true; break; - case '-underline': underline = false; break; - } - } - } - } - return new TokenStyle(foregroundColor, bold, underline, italic); -} function readCustomTokenStyleRules(tokenStylingRuleSection: IExperimentalTokenStyleCustomizations, result: TokenStylingRule[] = []) { for (let key in tokenStylingRuleSection) { @@ -720,9 +696,9 @@ function readCustomTokenStyleRules(tokenStylingRuleSection: IExperimentalTokenSt const settings = tokenStylingRuleSection[key]; let style: TokenStyle | undefined; if (typeof settings === 'string') { - style = getTokenStyle(settings, undefined); + style = TokenStyle.fromSettings(settings, undefined); } else if (isTokenColorizationSetting(settings)) { - style = getTokenStyle(settings.foreground, settings.fontStyle); + style = TokenStyle.fromSettings(settings.foreground, settings.fontStyle); } if (style) { result.push(tokenClassificationRegistry.getTokenStylingRule(classification, style)); diff --git a/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts index d2696b72c9d..0d7ba63c543 100644 --- a/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts +++ b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry'; -import { getTokenClassificationRegistry, ITokenClassificationRegistry, typeAndModifierIdPattern } from 'vs/platform/theme/common/tokenClassificationRegistry'; +import { getTokenClassificationRegistry, ITokenClassificationRegistry, typeAndModifierIdPattern, TokenStyleDefaults, TokenStyle, fontStylePattern } from 'vs/platform/theme/common/tokenClassificationRegistry'; import { textmateColorSettingsSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; interface ITokenTypeExtensionPoint { @@ -35,6 +35,9 @@ interface ITokenStyleDefaultExtensionPoint { }; } +const selectorPattern = '^[-_\\w]+|\\*(\\.[-_\\w+]+)*$'; +const colorPattern = '^#([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$'; + const tokenClassificationRegistry: ITokenClassificationRegistry = getTokenClassificationRegistry(); const tokenTypeExtPoint = ExtensionsRegistry.registerExtensionPoint({ @@ -72,11 +75,10 @@ const tokenModifierExtPoint = ExtensionsRegistry.registerExtensionPoint { for (const extension of delta.added) { @@ -150,7 +171,7 @@ export class TokenClassificationExtensionPoints { return; } for (const contribution of extensionValue) { - if (validate(contribution, 'tokenType', collector)) { + if (validateTypeOrModifier(contribution, 'tokenType', collector)) { tokenClassificationRegistry.registerTokenType(contribution.id, contribution.description); } } @@ -172,7 +193,7 @@ export class TokenClassificationExtensionPoints { return; } for (const contribution of extensionValue) { - if (validate(contribution, 'tokenModifier', collector)) { + if (validateTypeOrModifier(contribution, 'tokenModifier', collector)) { tokenClassificationRegistry.registerTokenModifier(contribution.id, contribution.description); } } @@ -196,12 +217,31 @@ export class TokenClassificationExtensionPoints { for (const contribution of extensionValue) { if (typeof contribution.selector !== 'string' || contribution.selector.length === 0) { collector.error(nls.localize('invalid.selector', "'configuration.tokenStyleDefaults.selector' must be defined and can not be empty")); - return; + continue; + } + if (!contribution.selector.match(selectorPattern)) { + collector.error(nls.localize('invalid.selector.format', "'configuration.tokenStyleDefaults.selector' must be in the form (type|*)(.modifier)*")); + continue; + } + + const tokenStyleDefault: TokenStyleDefaults = {}; + + if (contribution.scopes) { + if ((!Array.isArray(contribution.scopes) || contribution.scopes.some(s => typeof s !== 'string'))) { + collector.error(nls.localize('invalid.scopes', "If defined, 'configuration.tokenStyleDefaults.scopes' must must be an array or strings")); + continue; + } + tokenStyleDefault.scopesToProbe = [contribution.scopes]; + } + tokenStyleDefault.light = validateStyle(contribution.light, 'tokenStyleDefaults.light', collector); + tokenStyleDefault.dark = validateStyle(contribution.dark, 'tokenStyleDefaults.dark', collector); + tokenStyleDefault.hc = validateStyle(contribution.highContrast, 'tokenStyleDefaults.highContrast', collector); + + const [type, ...modifiers] = contribution.selector.split('.'); + const classification = tokenClassificationRegistry.getTokenClassification(type, modifiers); + if (classification) { + tokenClassificationRegistry.registerTokenStyleDefault(classification, tokenStyleDefault); } - // if (!contribution.selector.match()) { - // collector.error(nls.localize('invalid.id.format', "'configuration.{0}.id' must follow the letterOrDigit[-_letterOrDigit]*", extensionPoint)); - // return false; - // } } } for (const extension of delta.removed) { From 013132d6577f5b25875faeb3b2bf7fa58b761968 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 11 Dec 2019 17:08:56 +0100 Subject: [PATCH 345/637] fix selectorPattern --- extensions/vscode-colorize-tests/package.json | 29 +++++++++++++++++++ .../tokenClassificationExtensionPoint.ts | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/extensions/vscode-colorize-tests/package.json b/extensions/vscode-colorize-tests/package.json index c9834b05549..152a4c91595 100644 --- a/extensions/vscode-colorize-tests/package.json +++ b/extensions/vscode-colorize-tests/package.json @@ -24,5 +24,34 @@ "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", "vscode": "1.1.5" + }, + "contributes": { + "tokenTypes": [ + { + "id": "testToken", + "description": "A test token" + } + ], + "tokenModifiers": [ + { + "id": "testModifier", + "description": "A test modifier" + } + ], + "tokenStyleDefaults": [ + { + "selector": "testToken.testModifier", + "light": { + "fontStyle": "bold" + }, + "dark": { + "fontStyle": "bold" + }, + "highContrast": { + "fontStyle": "bold" + } + + } + ] } } diff --git a/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts index 0d7ba63c543..77f6a8586c9 100644 --- a/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts +++ b/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.ts @@ -35,7 +35,7 @@ interface ITokenStyleDefaultExtensionPoint { }; } -const selectorPattern = '^[-_\\w]+|\\*(\\.[-_\\w+]+)*$'; +const selectorPattern = '^([-_\\w]+|\\*)(\\.[-_\\w+]+)*$'; const colorPattern = '^#([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$'; const tokenClassificationRegistry: ITokenClassificationRegistry = getTokenClassificationRegistry(); From 57c8caeb7c8b94b143ddc802f8efcf29c0fe1948 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 11 Dec 2019 08:59:06 -0800 Subject: [PATCH 346/637] Improve searchresult textmate scopes --- .../syntaxes/generateTMLanguage.js | 265 +- .../syntaxes/searchResult.tmLanguage.json | 4110 ++++++++++++----- 2 files changed, 3178 insertions(+), 1197 deletions(-) diff --git a/extensions/search-result/syntaxes/generateTMLanguage.js b/extensions/search-result/syntaxes/generateTMLanguage.js index d646b5bf86f..10245850891 100644 --- a/extensions/search-result/syntaxes/generateTMLanguage.js +++ b/extensions/search-result/syntaxes/generateTMLanguage.js @@ -1,36 +1,45 @@ // @ts-check -const languages = [ +const mappings = [ ['bat', 'source.batchfile'], ['c', 'source.c'], + ['cc', 'source.cpp'], ['clj', 'source.clojure'], ['coffee', 'source.coffee'], ['cpp', 'source.cpp'], ['cs', 'source.cs'], + ['cshtml', 'text.html.cshtml'], ['css', 'source.css'], ['dart', 'source.dart'], ['diff', 'source.diff'], - ['dockerfile', 'source.dockerfile'], + ['dockerfile', 'source.dockerfile', '(?:dockerfile|Dockerfile)'], ['fs', 'source.fsharp'], ['go', 'source.go'], ['groovy', 'source.groovy'], ['h', 'source.objc'], + ['handlebars', 'text.html.handlebars'], + ['hbs', 'text.html.handlebars'], + ['hlsl', 'source.hlsl'], ['hpp', 'source.objcpp'], - ['html', 'source.html'], + ['html', 'text.html.basic'], + ['ini', 'source.ini'], ['java', 'source.java'], ['js', 'source.js'], ['json', 'source.json.comments'], ['jsx', 'source.js.jsx'], ['less', 'source.css.less'], + ['log', 'text.log'], ['lua', 'source.lua'], ['m', 'source.objc'], - ['make', 'source.makefile'], + ['makefile', 'source.makefile', '(?:makefile|Makefile)(?:\\..*)?'], + ['md', 'text.html.markdown'], ['mm', 'source.objcpp'], ['p6', 'source.perl.6'], ['perl', 'source.perl'], ['php', 'source.php'], ['pl', 'source.perl'], ['ps1', 'source.powershell'], + ['pug', 'text.pug'], ['py', 'source.python'], ['r', 'source.r'], ['rb', 'source.ruby'], @@ -42,121 +51,193 @@ const languages = [ ['swift', 'source.swift'], ['ts', 'source.ts'], ['tsx', 'source.tsx'], + ['vb', 'source.asp.vb.net'], + ['xml', 'text.xml'], ['yaml', 'source.yaml'], ]; -const repository = {}; -languages.forEach(([ext, scope]) => - repository[ext] = { - begin: `^(?!\\s)(.*?)([^\\\\\\/\\n]*.${ext})(:)$`, - end: "^(?!\\s)", - name: `searchResult.block.${ext}`, - beginCaptures: { - "0": { - name: "string path.searchResult" - }, - "1": { - name: "dirname.path.searchResult" - }, - "2": { - name: "basename.path.searchResult" - }, - "3": { - name: "endingColon.path.searchResult" +const scopes = { + root: 'text.searchResult', + header: { + meta: 'meta.header.search keyword.operator.word.search', + key: 'entity.other.attribute-name', + value: 'entity.other.attribute-value string.unquoted', + flags: { + keyword: 'keyword.other', + }, + contextLines: { + number: 'constant.numeric.integer', + invalid: 'invalid.illegal', + }, + query: { + escape: 'constant.character.escape', + invalid: 'invalid.illegal', + } + }, + resultBlock: { + meta: 'meta.resultBlock.search', + path: { + meta: 'string meta.path.search', + dirname: 'meta.path.dirname.search', + basename: 'meta.path.basename.search', + colon: 'punctuation.separator', + }, + result: { + meta: 'meta.resultLine.search', + metaSingleLine: 'meta.resultLine.singleLine.search', + metaMultiLine: 'meta.resultLine.multiLine.search', + prefix: { + meta: 'constant.numeric.integer meta.resultLinePrefix.search', + metaContext: 'meta.resultLinePrefix.contextLinePrefix.search', + metaMatch: 'meta.resultLinePrefix.matchLinePrefix.search', + lineNumber: 'meta.resultLinePrefix.lineNumber.search', + colon: 'punctuation.separator', } + } + } +}; + +const repository = {}; +mappings.forEach(([ext, scope, regexp]) => + repository[ext] = { + name: scopes.resultBlock.meta, + begin: `^(?!\\s)(.*?)([^\\\\\\/\\n]*${regexp || `\\.${ext}`})(:)$`, + end: "^(?!\\s)", + beginCaptures: { + "0": { name: scopes.resultBlock.path.meta }, + "1": { name: scopes.resultBlock.path.dirname }, + "2": { name: scopes.resultBlock.path.basename }, + "3": { name: scopes.resultBlock.path.colon }, }, patterns: [ { - begin: "^ (\\d+)( )", - while: "^ (\\d+)(:| )", + name: [scopes.resultBlock.result.meta, scopes.resultBlock.result.metaMultiLine].join(' '), + begin: "^ ((\\d+) )", + while: "^ ((\\d+)(:))|((\\d+) )", beginCaptures: { - "1": { - name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } + "0": { name: scopes.resultBlock.result.prefix.meta }, + "1": { name: scopes.resultBlock.result.prefix.metaContext }, + "2": { name: scopes.resultBlock.result.prefix.lineNumber }, }, whileCaptures: { - "1": { - name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } + "0": { name: scopes.resultBlock.result.prefix.meta }, + "1": { name: scopes.resultBlock.result.prefix.metaMatch }, + "2": { name: scopes.resultBlock.result.prefix.lineNumber }, + "3": { name: scopes.resultBlock.result.prefix.colon }, + + "4": { name: scopes.resultBlock.result.prefix.metaContext }, + "5": { name: scopes.resultBlock.result.prefix.lineNumber }, }, - name: `searchResult.resultLine.${ext} searchResult.multiline`, - patterns: [ - { - include: scope - } - ] + patterns: [{ include: scope }] }, { - match: "^ (\\d+)(:)(.*)", - name: `searchResult.resultLine.${ext} searchResult.singleline`, - captures: { - "1": { - name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" - }, - "3": { - patterns: [ - { - include: scope - } - ] - } - } + begin: "^ ((\\d+)(:))", + while: "(?=not)possible", + name: [scopes.resultBlock.result.meta, scopes.resultBlock.result.metaSingleLine].join(' '), + beginCaptures: { + "0": { name: scopes.resultBlock.result.prefix.meta }, + "1": { name: scopes.resultBlock.result.prefix.metaMatch }, + "2": { name: scopes.resultBlock.result.prefix.lineNumber }, + "3": { name: scopes.resultBlock.result.prefix.colon }, + }, + patterns: [{ include: scope }] } ] }); -const header = { - "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", - "name": "comment" -}; +const header = [ + { + begin: "^(# Query): ", + end: "\n", + name: scopes.header.meta, + beginCaptures: { "1": { name: scopes.header.key }, }, + patterns: [ + { + match: '(\\\\n)|(\\\\\\\\)', + name: [scopes.header.value, scopes.header.query.escape].join(' ') + }, + { + match: '\\\\.|\\\\$', + name: [scopes.header.value, scopes.header.query.invalid].join(' ') + }, + { + match: '[^\\\\\\\n]+', + name: [scopes.header.value].join(' ') + }, + ] + }, + { + begin: "^(# Flags): ", + end: "\n", + name: scopes.header.meta, + beginCaptures: { "1": { name: scopes.header.key }, }, + patterns: [ + { + match: '(RegExp|CaseSensitive|IgnoreExcludeSettings|WordMatch)', + name: [scopes.header.value, 'keyword.other'].join(' ') + }, + { match: '.' }, + ] + }, + { + begin: "^(# ContextLines): ", + end: "\n", + name: scopes.header.meta, + beginCaptures: { "1": { name: scopes.header.key }, }, + patterns: [ + { + match: '\\d', + name: [scopes.header.value, scopes.header.contextLines.number].join(' ') + }, + { match: '.', name: scopes.header.contextLines.invalid }, + ] + }, + { + match: "^(# (?:Including|Excluding)): (.*)$", + name: scopes.header.meta, + captures: { + "1": { name: scopes.header.key }, + "2": { name: scopes.header.value } + } + }, +]; -const plainText = [{ - match: "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", - name: "string path.searchResult", - captures: { - "1": { - name: "dirname.path.searchResult" - }, - "2": { - name: "basename.path.searchResult" - }, - "3": { - name: "endingColon.path.searchResult" +const plainText = [ + { + match: "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", + name: [scopes.resultBlock.meta, scopes.resultBlock.path.meta].join(' '), + captures: { + "1": { name: scopes.resultBlock.path.dirname }, + "2": { name: scopes.resultBlock.path.basename }, + "3": { name: scopes.resultBlock.path.colon } + } + }, + { + match: "^ ((\\d+)(:))|((\\d+)( ))(.*)", + name: [scopes.resultBlock.meta, scopes.resultBlock.result.meta].join(' '), + captures: { + "1": { name: [scopes.resultBlock.result.prefix.meta, scopes.resultBlock.result.prefix.metaMatch].join(' ') }, + "2": { name: scopes.resultBlock.result.prefix.lineNumber }, + "3": { name: scopes.resultBlock.result.prefix.colon }, + + "4": { name: [scopes.resultBlock.result.prefix.meta, scopes.resultBlock.result.prefix.metaContext].join(' ') }, + "5": { name: scopes.resultBlock.result.prefix.lineNumber }, } } -}, -{ - match: "^ (\\d+)(:| )", - captures: { - "1": { - name: "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - name: "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - } -}]; +]; const tmLanguage = { "information_for_contributors": "This file is generated from ./generateTMLanguage.js.", name: "Search Results", - scopeName: "text.searchResult", + scopeName: scopes.root, patterns: [ - header, - ...languages.map(([ext]) => ({ include: `#${ext}` })), + ...header, + ...mappings.map(([ext]) => ({ include: `#${ext}` })), ...plainText ], repository }; -require('fs') - .writeFileSync(require('path').join(__dirname, './searchResult.tmLanguage.json'), JSON.stringify(tmLanguage, null, 2)); +require('fs').writeFileSync( + require('path').join(__dirname, './searchResult.tmLanguage.json'), + JSON.stringify(tmLanguage, null, 2)); diff --git a/extensions/search-result/syntaxes/searchResult.tmLanguage.json b/extensions/search-result/syntaxes/searchResult.tmLanguage.json index bfd7504eef3..e16ca1cb95d 100644 --- a/extensions/search-result/syntaxes/searchResult.tmLanguage.json +++ b/extensions/search-result/syntaxes/searchResult.tmLanguage.json @@ -4,8 +4,79 @@ "scopeName": "text.searchResult", "patterns": [ { - "match": "^# (Query|Flags|Including|Excluding|ContextLines): .*$", - "name": "comment" + "begin": "^(# Query): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "(\\\\n)|(\\\\\\\\)", + "name": "entity.other.attribute-value string.unquoted constant.character.escape" + }, + { + "match": "\\\\.|\\\\$", + "name": "entity.other.attribute-value string.unquoted invalid.illegal" + }, + { + "match": "[^\\\\\\\n]+", + "name": "entity.other.attribute-value string.unquoted" + } + ] + }, + { + "begin": "^(# Flags): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "(RegExp|CaseSensitive|IgnoreExcludeSettings|WordMatch)", + "name": "entity.other.attribute-value string.unquoted keyword.other" + }, + { + "match": "." + } + ] + }, + { + "begin": "^(# ContextLines): ", + "end": "\n", + "name": "meta.header.search keyword.operator.word.search", + "beginCaptures": { + "1": { + "name": "entity.other.attribute-name" + } + }, + "patterns": [ + { + "match": "\\d", + "name": "entity.other.attribute-value string.unquoted constant.numeric.integer" + }, + { + "match": ".", + "name": "invalid.illegal" + } + ] + }, + { + "match": "^(# (?:Including|Excluding)): (.*)$", + "name": "meta.header.search keyword.operator.word.search", + "captures": { + "1": { + "name": "entity.other.attribute-name" + }, + "2": { + "name": "entity.other.attribute-value string.unquoted" + } + } }, { "include": "#bat" @@ -13,6 +84,9 @@ { "include": "#c" }, + { + "include": "#cc" + }, { "include": "#clj" }, @@ -25,6 +99,9 @@ { "include": "#cs" }, + { + "include": "#cshtml" + }, { "include": "#css" }, @@ -49,12 +126,24 @@ { "include": "#h" }, + { + "include": "#handlebars" + }, + { + "include": "#hbs" + }, + { + "include": "#hlsl" + }, { "include": "#hpp" }, { "include": "#html" }, + { + "include": "#ini" + }, { "include": "#java" }, @@ -70,6 +159,9 @@ { "include": "#less" }, + { + "include": "#log" + }, { "include": "#lua" }, @@ -77,7 +169,10 @@ "include": "#m" }, { - "include": "#make" + "include": "#makefile" + }, + { + "include": "#md" }, { "include": "#mm" @@ -97,6 +192,9 @@ { "include": "#ps1" }, + { + "include": "#pug" + }, { "include": "#py" }, @@ -130,76 +228,107 @@ { "include": "#tsx" }, + { + "include": "#vb" + }, + { + "include": "#xml" + }, { "include": "#yaml" }, { "match": "^(?!\\s)(.*?)([^\\\\\\/\\n]*)(:)$", - "name": "string path.searchResult", + "name": "meta.resultBlock.search string meta.path.search", "captures": { "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } } }, { - "match": "^ (\\d+)(:| )", + "match": "^ ((\\d+)(:))|((\\d+)( ))(.*)", + "name": "meta.resultBlock.search meta.resultLine.search", "captures": { "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "constant.numeric.integer meta.resultLinePrefix.search meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "constant.numeric.integer meta.resultLinePrefix.search meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } } } ], "repository": { "bat": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.bat)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.bat)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.bat", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.bat searchResult.multiline", "patterns": [ { "include": "source.batchfile" @@ -207,65 +336,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.bat searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.batchfile" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.batchfile" + } + ] } ] }, "c": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.c)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.c)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.c", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.c searchResult.multiline", "patterns": [ { "include": "source.c" @@ -273,197 +422,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.c searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.c" - } - ] - } - } - } - ] - }, - "clj": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.clj)(:)$", - "end": "^(?!\\s)", - "name": "searchResult.block.clj", - "beginCaptures": { - "0": { - "name": "string path.searchResult" - }, - "1": { - "name": "dirname.path.searchResult" - }, - "2": { - "name": "basename.path.searchResult" - }, - "3": { - "name": "endingColon.path.searchResult" - } - }, - "patterns": [ - { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", - "beginCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "punctuation.separator" } }, - "whileCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, - "name": "searchResult.resultLine.clj searchResult.multiline", "patterns": [ { - "include": "source.clojure" + "include": "source.c" } ] - }, - { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.clj searchResult.singleline", - "captures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - }, - "3": { - "patterns": [ - { - "include": "source.clojure" - } - ] - } - } } ] }, - "coffee": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.coffee)(:)$", + "cc": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cc)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.coffee", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, - "name": "searchResult.resultLine.coffee searchResult.multiline", - "patterns": [ - { - "include": "source.coffee" - } - ] - }, - { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.coffee searchResult.singleline", - "captures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.coffee" - } - ] - } - } - } - ] - }, - "cpp": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.cpp)(:)$", - "end": "^(?!\\s)", - "name": "searchResult.block.cpp", - "beginCaptures": { - "0": { - "name": "string path.searchResult" - }, - "1": { - "name": "dirname.path.searchResult" - }, - "2": { - "name": "basename.path.searchResult" - }, - "3": { - "name": "endingColon.path.searchResult" - } - }, - "patterns": [ - { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", - "beginCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "punctuation.separator" }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "whileCaptures": { - "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" - }, - "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" - } - }, - "name": "searchResult.resultLine.cpp searchResult.multiline", "patterns": [ { "include": "source.cpp" @@ -471,65 +508,343 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.cpp searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.cpp" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] } ] }, - "cs": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.cs)(:)$", + "clj": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.clj)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.cs", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.clojure" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.clojure" + } + ] + } + ] + }, + "coffee": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.coffee)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.coffee" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.coffee" + } + ] + } + ] + }, + "cpp": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cpp)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.cpp" + } + ] + } + ] + }, + "cs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.cs searchResult.multiline", "patterns": [ { "include": "source.cs" @@ -537,65 +852,171 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.cs searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.cs" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.cs" + } + ] } ] }, - "css": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.css)(:)$", + "cshtml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.cshtml)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.css", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.cshtml" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.cshtml" + } + ] + } + ] + }, + "css": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.css)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.css searchResult.multiline", "patterns": [ { "include": "source.css" @@ -603,65 +1024,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.css searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.css" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.css" + } + ] } ] }, "dart": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.dart)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.dart)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.dart", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.dart searchResult.multiline", "patterns": [ { "include": "source.dart" @@ -669,65 +1110,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.dart searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.dart" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.dart" + } + ] } ] }, "diff": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.diff)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.diff)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.diff", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.diff searchResult.multiline", "patterns": [ { "include": "source.diff" @@ -735,65 +1196,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.diff searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.diff" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.diff" + } + ] } ] }, "dockerfile": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.dockerfile)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*(?:dockerfile|Dockerfile))(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.dockerfile", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.dockerfile searchResult.multiline", "patterns": [ { "include": "source.dockerfile" @@ -801,65 +1282,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.dockerfile searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.dockerfile" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.dockerfile" + } + ] } ] }, "fs": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.fs)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.fs)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.fs", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.fs searchResult.multiline", "patterns": [ { "include": "source.fsharp" @@ -867,65 +1368,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.fs searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.fsharp" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.fsharp" + } + ] } ] }, "go": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.go)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.go)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.go", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.go searchResult.multiline", "patterns": [ { "include": "source.go" @@ -933,65 +1454,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.go searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.go" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.go" + } + ] } ] }, "groovy": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.groovy)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.groovy)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.groovy", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.groovy searchResult.multiline", "patterns": [ { "include": "source.groovy" @@ -999,65 +1540,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.groovy searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.groovy" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.groovy" + } + ] } ] }, "h": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.h)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.h)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.h", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.h searchResult.multiline", "patterns": [ { "include": "source.objc" @@ -1065,65 +1626,343 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.h searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.objc" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.objc" + } + ] } ] }, - "hpp": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.hpp)(:)$", + "handlebars": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.handlebars)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.hpp", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + } + ] + }, + "hbs": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hbs)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.handlebars" + } + ] + } + ] + }, + "hlsl": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hlsl)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.hlsl" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.hlsl" + } + ] + } + ] + }, + "hpp": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.hpp)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.hpp searchResult.multiline", "patterns": [ { "include": "source.objcpp" @@ -1131,131 +1970,257 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.hpp searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.objcpp" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] } ] }, "html": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.html)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.html)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.html", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.html searchResult.multiline", "patterns": [ { - "include": "source.html" + "include": "text.html.basic" } ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.html searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.html" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "text.html.basic" + } + ] } ] }, - "java": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.java)(:)$", + "ini": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ini)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.java", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.ini" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.ini" + } + ] + } + ] + }, + "java": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.java)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.java searchResult.multiline", "patterns": [ { "include": "source.java" @@ -1263,65 +2228,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.java searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.java" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.java" + } + ] } ] }, "js": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.js)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.js)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.js", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.js searchResult.multiline", "patterns": [ { "include": "source.js" @@ -1329,65 +2314,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.js searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.js" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.js" + } + ] } ] }, "json": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.json)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.json)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.json", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.json searchResult.multiline", "patterns": [ { "include": "source.json.comments" @@ -1395,65 +2400,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.json searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.json.comments" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.json.comments" + } + ] } ] }, "jsx": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.jsx)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.jsx)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.jsx", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.jsx searchResult.multiline", "patterns": [ { "include": "source.js.jsx" @@ -1461,65 +2486,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.jsx searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.js.jsx" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.js.jsx" + } + ] } ] }, "less": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.less)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.less)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.less", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.less searchResult.multiline", "patterns": [ { "include": "source.css.less" @@ -1527,65 +2572,171 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.less searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.css.less" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.css.less" + } + ] } ] }, - "lua": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.lua)(:)$", + "log": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.log)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.lua", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.log" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.log" + } + ] + } + ] + }, + "lua": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.lua)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.lua searchResult.multiline", "patterns": [ { "include": "source.lua" @@ -1593,65 +2744,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.lua searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.lua" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.lua" + } + ] } ] }, "m": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.m)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.m)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.m", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.m searchResult.multiline", "patterns": [ { "include": "source.objc" @@ -1659,65 +2830,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.m searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.objc" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.objc" + } + ] } ] }, - "make": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.make)(:)$", + "makefile": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*(?:makefile|Makefile)(?:\\..*)?)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.make", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.make searchResult.multiline", "patterns": [ { "include": "source.makefile" @@ -1725,65 +2916,171 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.make searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.makefile" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.makefile" + } + ] } ] }, - "mm": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.mm)(:)$", + "md": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.md)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.mm", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.html.markdown" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.html.markdown" + } + ] + } + ] + }, + "mm": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.mm)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.mm searchResult.multiline", "patterns": [ { "include": "source.objcpp" @@ -1791,65 +3088,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.mm searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.objcpp" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.objcpp" + } + ] } ] }, "p6": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.p6)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.p6)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.p6", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.p6 searchResult.multiline", "patterns": [ { "include": "source.perl.6" @@ -1857,65 +3174,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.p6 searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.perl.6" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.perl.6" + } + ] } ] }, "perl": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.perl)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.perl)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.perl", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.perl searchResult.multiline", "patterns": [ { "include": "source.perl" @@ -1923,65 +3260,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.perl searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.perl" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.perl" + } + ] } ] }, "php": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.php)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.php)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.php", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.php searchResult.multiline", "patterns": [ { "include": "source.php" @@ -1989,65 +3346,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.php searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.php" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.php" + } + ] } ] }, "pl": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.pl)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.pl)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.pl", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.pl searchResult.multiline", "patterns": [ { "include": "source.perl" @@ -2055,65 +3432,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.pl searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.perl" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.perl" + } + ] } ] }, "ps1": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ps1)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ps1)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.ps1", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.ps1 searchResult.multiline", "patterns": [ { "include": "source.powershell" @@ -2121,65 +3518,171 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.ps1 searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.powershell" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.powershell" + } + ] } ] }, - "py": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.py)(:)$", + "pug": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.pug)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.py", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.pug" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.pug" + } + ] + } + ] + }, + "py": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.py)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.py searchResult.multiline", "patterns": [ { "include": "source.python" @@ -2187,65 +3690,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.py searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.python" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.python" + } + ] } ] }, "r": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.r)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.r)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.r", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.r searchResult.multiline", "patterns": [ { "include": "source.r" @@ -2253,65 +3776,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.r searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.r" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.r" + } + ] } ] }, "rb": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.rb)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.rb)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.rb", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.rb searchResult.multiline", "patterns": [ { "include": "source.ruby" @@ -2319,65 +3862,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.rb searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.ruby" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.ruby" + } + ] } ] }, "rs": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.rs)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.rs)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.rs", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.rs searchResult.multiline", "patterns": [ { "include": "source.rust" @@ -2385,65 +3948,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.rs searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.rust" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.rust" + } + ] } ] }, "scala": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.scala)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.scala)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.scala", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.scala searchResult.multiline", "patterns": [ { "include": "source.scala" @@ -2451,65 +4034,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.scala searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.scala" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.scala" + } + ] } ] }, "scss": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.scss)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.scss)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.scss", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.scss searchResult.multiline", "patterns": [ { "include": "source.css.scss" @@ -2517,65 +4120,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.scss searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.css.scss" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.css.scss" + } + ] } ] }, "sh": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.sh)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.sh)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.sh", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.sh searchResult.multiline", "patterns": [ { "include": "source.shell" @@ -2583,65 +4206,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.sh searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.shell" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.shell" + } + ] } ] }, "sql": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.sql)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.sql)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.sql", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.sql searchResult.multiline", "patterns": [ { "include": "source.sql" @@ -2649,65 +4292,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.sql searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.sql" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.sql" + } + ] } ] }, "swift": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.swift)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.swift)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.swift", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.swift searchResult.multiline", "patterns": [ { "include": "source.swift" @@ -2715,65 +4378,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.swift searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.swift" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.swift" + } + ] } ] }, "ts": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.ts)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.ts)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.ts", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.ts searchResult.multiline", "patterns": [ { "include": "source.ts" @@ -2781,65 +4464,85 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.ts searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.ts" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.ts" + } + ] } ] }, "tsx": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.tsx)(:)$", + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.tsx)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.tsx", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.tsx searchResult.multiline", "patterns": [ { "include": "source.tsx" @@ -2847,65 +4550,257 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.tsx searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.tsx" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.tsx" + } + ] } ] }, - "yaml": { - "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*.yaml)(:)$", + "vb": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.vb)(:)$", "end": "^(?!\\s)", - "name": "searchResult.block.yaml", "beginCaptures": { "0": { - "name": "string path.searchResult" + "name": "string meta.path.search" }, "1": { - "name": "dirname.path.searchResult" + "name": "meta.path.dirname.search" }, "2": { - "name": "basename.path.searchResult" + "name": "meta.path.basename.search" }, "3": { - "name": "endingColon.path.searchResult" + "name": "punctuation.separator" } }, "patterns": [ { - "begin": "^ (\\d+)( )", - "while": "^ (\\d+)(:| )", + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.contextLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" } }, "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "source.asp.vb.net" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "source.asp.vb.net" + } + ] + } + ] + }, + "xml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.xml)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "patterns": [ + { + "include": "text.xml" + } + ] + }, + { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "include": "text.xml" + } + ] + } + ] + }, + "yaml": { + "name": "meta.resultBlock.search", + "begin": "^(?!\\s)(.*?)([^\\\\\\/\\n]*\\.yaml)(:)$", + "end": "^(?!\\s)", + "beginCaptures": { + "0": { + "name": "string meta.path.search" + }, + "1": { + "name": "meta.path.dirname.search" + }, + "2": { + "name": "meta.path.basename.search" + }, + "3": { + "name": "punctuation.separator" + } + }, + "patterns": [ + { + "name": "meta.resultLine.search meta.resultLine.multiLine.search", + "begin": "^ ((\\d+) )", + "while": "^ ((\\d+)(:))|((\\d+) )", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + } + }, + "whileCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, + "1": { + "name": "meta.resultLinePrefix.matchLinePrefix.search" + }, + "2": { + "name": "meta.resultLinePrefix.lineNumber.search" + }, + "3": { + "name": "punctuation.separator" + }, + "4": { + "name": "meta.resultLinePrefix.contextLinePrefix.search" + }, + "5": { + "name": "meta.resultLinePrefix.lineNumber.search" } }, - "name": "searchResult.resultLine.yaml searchResult.multiline", "patterns": [ { "include": "source.yaml" @@ -2913,23 +4808,28 @@ ] }, { - "match": "^ (\\d+)(:)(.*)", - "name": "searchResult.resultLine.yaml searchResult.singleline", - "captures": { + "begin": "^ ((\\d+)(:))", + "while": "(?=not)possible", + "name": "meta.resultLine.search meta.resultLine.singleLine.search", + "beginCaptures": { + "0": { + "name": "constant.numeric.integer meta.resultLinePrefix.search" + }, "1": { - "name": "constant.numeric lineNumber.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.matchLinePrefix.search" }, "2": { - "name": "resultPrefixSeparator.searchResult resultPrefix.searchResult" + "name": "meta.resultLinePrefix.lineNumber.search" }, "3": { - "patterns": [ - { - "include": "source.yaml" - } - ] + "name": "punctuation.separator" } - } + }, + "patterns": [ + { + "include": "source.yaml" + } + ] } ] } From 5c565a14b03c31449c42df6c5af475174f545740 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 11 Dec 2019 09:11:38 -0800 Subject: [PATCH 347/637] fixes #85304 --- src/vs/platform/windows/common/windows.ts | 2 +- src/vs/platform/windows/electron-main/windowsMainService.ts | 6 +++--- src/vs/workbench/electron-browser/desktop.contribution.ts | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index 6fbb32cbd7a..78210255a5f 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -91,7 +91,7 @@ export interface IWindowSettings { titleBarStyle: 'native' | 'custom'; autoDetectHighContrast: boolean; menuBarVisibility: MenuBarVisibility; - newWindowDimensions: 'default' | 'inherit' | 'maximized' | 'fullscreen'; + newWindowDimensions: 'default' | 'inherit' | 'offset' | 'maximized' | 'fullscreen'; nativeTabs: boolean; nativeFullScreen: boolean; enableMenuBarMnemonics: boolean; diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts index 58183df6c73..8c588ca9a2a 100644 --- a/src/vs/platform/windows/electron-main/windowsMainService.ts +++ b/src/vs/platform/windows/electron-main/windowsMainService.ts @@ -1381,7 +1381,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic // Window state is not from a previous session: only allow fullscreen if we inherit it or user wants fullscreen let allowFullscreen: boolean; if (state.hasDefaultState) { - allowFullscreen = (windowConfig?.newWindowDimensions && ['fullscreen', 'inherit'].indexOf(windowConfig.newWindowDimensions) >= 0); + allowFullscreen = (windowConfig?.newWindowDimensions && ['fullscreen', 'inherit', 'offset'].indexOf(windowConfig.newWindowDimensions) >= 0); } // Window state is from a previous session: only allow fullscreen when we got updated or user wants to restore @@ -1576,7 +1576,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic } else if (windowConfig.newWindowDimensions === 'fullscreen') { state.mode = WindowMode.Fullscreen; ensureNoOverlap = false; - } else if (windowConfig.newWindowDimensions === 'inherit' && lastActive) { + } else if ((windowConfig.newWindowDimensions === 'inherit' || windowConfig.newWindowDimensions === 'offset') && lastActive) { const lastActiveState = lastActive.serializeWindowState(); if (lastActiveState.mode === WindowMode.Fullscreen) { state.mode = WindowMode.Fullscreen; // only take mode (fixes https://github.com/Microsoft/vscode/issues/19331) @@ -1584,7 +1584,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic state = lastActiveState; } - ensureNoOverlap = false; + ensureNoOverlap = state.mode !== WindowMode.Fullscreen && windowConfig.newWindowDimensions === 'offset'; } } diff --git a/src/vs/workbench/electron-browser/desktop.contribution.ts b/src/vs/workbench/electron-browser/desktop.contribution.ts index af5f55407ef..821219da530 100644 --- a/src/vs/workbench/electron-browser/desktop.contribution.ts +++ b/src/vs/workbench/electron-browser/desktop.contribution.ts @@ -256,10 +256,11 @@ import product from 'vs/platform/product/common/product'; }, 'window.newWindowDimensions': { 'type': 'string', - 'enum': ['default', 'inherit', 'maximized', 'fullscreen'], + 'enum': ['default', 'inherit', 'offset', 'maximized', 'fullscreen'], 'enumDescriptions': [ nls.localize('window.newWindowDimensions.default', "Open new windows in the center of the screen."), nls.localize('window.newWindowDimensions.inherit', "Open new windows with same dimension as last active one."), + nls.localize('window.newWindowDimensions.offset', "Open new windows with same dimension as last active one with an offset position."), nls.localize('window.newWindowDimensions.maximized', "Open new windows maximized."), nls.localize('window.newWindowDimensions.fullscreen', "Open new windows in full screen mode.") ], From 26c955f0dad0a83a4c50553c7e34f7cdd056810d Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 11 Dec 2019 09:18:25 -0800 Subject: [PATCH 348/637] More conservative parse caching in search editor --- extensions/search-result/src/extension.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index 6956a63d329..0c5c85bfe60 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -12,7 +12,7 @@ const SEARCH_RESULT_SELECTOR = { language: 'search-result' }; const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# ContextLines:']; const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch']; -let cachedLastParse: { version: number, parse: ParsedSearchResults } | undefined; +let cachedLastParse: { version: number, parse: ParsedSearchResults, uri: vscode.Uri } | undefined; export function activate(context: vscode.ExtensionContext) { context.subscriptions.push( @@ -136,7 +136,7 @@ const isFileLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line i function parseSearchResults(document: vscode.TextDocument, token: vscode.CancellationToken): ParsedSearchResults { - if (cachedLastParse && cachedLastParse.version === document.version) { + if (cachedLastParse && cachedLastParse.uri === document.uri && cachedLastParse.version === document.version) { return cachedLastParse.parse; } @@ -192,7 +192,8 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell cachedLastParse = { version: document.version, - parse: links + parse: links, + uri: document.uri }; return links; From e4162e3813571402e8753ecac79db573e281bd14 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 17:36:52 +0100 Subject: [PATCH 349/637] move output channel registry to workbench services --- .../api/browser/mainThreadOutputService.ts | 3 +- .../browser/extensions.contribution.ts | 2 +- .../contrib/logs/common/logs.contribution.ts | 2 +- .../contrib/output/browser/logViewer.ts | 3 +- .../contrib/output/browser/outputActions.ts | 3 +- .../contrib/output/browser/outputServices.ts | 3 +- .../workbench/contrib/output/common/output.ts | 80 +----------------- .../remote/common/remote.contribution.ts | 2 +- .../tasks/browser/task.contribution.ts | 2 +- .../services/output/common/output.ts | 83 +++++++++++++++++++ 10 files changed, 97 insertions(+), 86 deletions(-) create mode 100644 src/vs/workbench/services/output/common/output.ts diff --git a/src/vs/workbench/api/browser/mainThreadOutputService.ts b/src/vs/workbench/api/browser/mainThreadOutputService.ts index 9eb8abcdfa8..57930adeddc 100644 --- a/src/vs/workbench/api/browser/mainThreadOutputService.ts +++ b/src/vs/workbench/api/browser/mainThreadOutputService.ts @@ -4,7 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { Registry } from 'vs/platform/registry/common/platform'; -import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID, Extensions, IOutputChannelRegistry } from 'vs/workbench/contrib/output/common/output'; +import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID } from 'vs/workbench/contrib/output/common/output'; +import { Extensions, IOutputChannelRegistry } from 'vs/workbench/services/output/common/output'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { MainThreadOutputServiceShape, MainContext, IExtHostContext, ExtHostOutputServiceShape, ExtHostContext } from '../common/extHost.protocol'; diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index e1527477edd..a083e174f82 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -12,7 +12,7 @@ import { ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManag import { IExtensionManagementServerService, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions'; -import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/services/output/common/output'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { VIEWLET_ID, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService'; diff --git a/src/vs/workbench/contrib/logs/common/logs.contribution.ts b/src/vs/workbench/contrib/logs/common/logs.contribution.ts index 09b25d44c91..70b5d458802 100644 --- a/src/vs/workbench/contrib/logs/common/logs.contribution.ts +++ b/src/vs/workbench/contrib/logs/common/logs.contribution.ts @@ -14,7 +14,7 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IFileService, FileChangeType, whenProviderRegistered } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; -import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/services/output/common/output'; import { Disposable } from 'vs/base/common/lifecycle'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; import { dirname } from 'vs/base/common/resources'; diff --git a/src/vs/workbench/contrib/output/browser/logViewer.ts b/src/vs/workbench/contrib/output/browser/logViewer.ts index e1f3a1fd3b4..4dba3a914e7 100644 --- a/src/vs/workbench/contrib/output/browser/logViewer.ts +++ b/src/vs/workbench/contrib/output/browser/logViewer.ts @@ -14,7 +14,8 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { URI } from 'vs/base/common/uri'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; -import { LOG_SCHEME, IFileOutputChannelDescriptor } from 'vs/workbench/contrib/output/common/output'; +import { LOG_SCHEME } from 'vs/workbench/contrib/output/common/output'; +import { IFileOutputChannelDescriptor } from 'vs/workbench/services/output/common/output'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; diff --git a/src/vs/workbench/contrib/output/browser/outputActions.ts b/src/vs/workbench/contrib/output/browser/outputActions.ts index 869b8da42d6..1d16cfea3b1 100644 --- a/src/vs/workbench/contrib/output/browser/outputActions.ts +++ b/src/vs/workbench/contrib/output/browser/outputActions.ts @@ -6,7 +6,8 @@ import * as nls from 'vs/nls'; import * as aria from 'vs/base/browser/ui/aria/aria'; import { IAction, Action } from 'vs/base/common/actions'; -import { IOutputService, OUTPUT_PANEL_ID, IOutputChannelRegistry, Extensions as OutputExt, IOutputChannelDescriptor, IFileOutputChannelDescriptor } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelRegistry, Extensions as OutputExt, IOutputChannelDescriptor, IFileOutputChannelDescriptor } from 'vs/workbench/services/output/common/output'; +import { IOutputService, OUTPUT_PANEL_ID } from 'vs/workbench/contrib/output/common/output'; import { SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; diff --git a/src/vs/workbench/contrib/output/browser/outputServices.ts b/src/vs/workbench/contrib/output/browser/outputServices.ts index 940441708e4..7c21239ae09 100644 --- a/src/vs/workbench/contrib/output/browser/outputServices.ts +++ b/src/vs/workbench/contrib/output/browser/outputServices.ts @@ -11,7 +11,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { Registry } from 'vs/platform/registry/common/platform'; import { EditorOptions } from 'vs/workbench/common/editor'; -import { IOutputChannelDescriptor, IOutputChannel, IOutputService, Extensions, OUTPUT_PANEL_ID, IOutputChannelRegistry, OUTPUT_SCHEME, LOG_SCHEME, CONTEXT_ACTIVE_LOG_OUTPUT, LOG_MIME, OUTPUT_MIME } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannel, IOutputService, OUTPUT_PANEL_ID, OUTPUT_SCHEME, LOG_SCHEME, CONTEXT_ACTIVE_LOG_OUTPUT, LOG_MIME, OUTPUT_MIME } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelDescriptor, Extensions, IOutputChannelRegistry } from 'vs/workbench/services/output/common/output'; import { OutputPanel } from 'vs/workbench/contrib/output/browser/outputPanel'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { OutputLinkProvider } from 'vs/workbench/contrib/output/common/outputLinkProvider'; diff --git a/src/vs/workbench/contrib/output/common/output.ts b/src/vs/workbench/contrib/output/common/output.ts index 75abffaa04d..d90dcb9908f 100644 --- a/src/vs/workbench/contrib/output/common/output.ts +++ b/src/vs/workbench/contrib/output/common/output.ts @@ -3,11 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Event, Emitter } from 'vs/base/common/event'; -import { Registry } from 'vs/platform/registry/common/platform'; +import { Event } from 'vs/base/common/event'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { URI } from 'vs/base/common/uri'; +import { IOutputChannelDescriptor } from 'vs/workbench/services/output/common/output'; /** * Mime type used by the output editor. @@ -44,10 +43,6 @@ export const LOG_MODE_ID = 'log'; */ export const OUTPUT_PANEL_ID = 'workbench.panel.output'; -export const Extensions = { - OutputChannels: 'workbench.contributions.outputChannels' -}; - export const OUTPUT_SERVICE_ID = 'outputService'; export const MAX_OUTPUT_LENGTH = 10000 /* Max. number of output lines to show in output */ * 100 /* Guestimated chars per line */; @@ -129,74 +124,3 @@ export interface IOutputChannel { */ dispose(): void; } - -export interface IOutputChannelDescriptor { - id: string; - label: string; - log: boolean; - file?: URI; -} - -export interface IFileOutputChannelDescriptor extends IOutputChannelDescriptor { - file: URI; -} - -export interface IOutputChannelRegistry { - - readonly onDidRegisterChannel: Event; - readonly onDidRemoveChannel: Event; - - /** - * Make an output channel known to the output world. - */ - registerChannel(descriptor: IOutputChannelDescriptor): void; - - /** - * Returns the list of channels known to the output world. - */ - getChannels(): IOutputChannelDescriptor[]; - - /** - * Returns the channel with the passed id. - */ - getChannel(id: string): IOutputChannelDescriptor | undefined; - - /** - * Remove the output channel with the passed id. - */ - removeChannel(id: string): void; -} - -class OutputChannelRegistry implements IOutputChannelRegistry { - private channels = new Map(); - - private readonly _onDidRegisterChannel = new Emitter(); - readonly onDidRegisterChannel: Event = this._onDidRegisterChannel.event; - - private readonly _onDidRemoveChannel = new Emitter(); - readonly onDidRemoveChannel: Event = this._onDidRemoveChannel.event; - - public registerChannel(descriptor: IOutputChannelDescriptor): void { - if (!this.channels.has(descriptor.id)) { - this.channels.set(descriptor.id, descriptor); - this._onDidRegisterChannel.fire(descriptor.id); - } - } - - public getChannels(): IOutputChannelDescriptor[] { - const result: IOutputChannelDescriptor[] = []; - this.channels.forEach(value => result.push(value)); - return result; - } - - public getChannel(id: string): IOutputChannelDescriptor | undefined { - return this.channels.get(id); - } - - public removeChannel(id: string): void { - this.channels.delete(id); - this._onDidRemoveChannel.fire(id); - } -} - -Registry.add(Extensions.OutputChannels, new OutputChannelRegistry()); \ No newline at end of file diff --git a/src/vs/workbench/contrib/remote/common/remote.contribution.ts b/src/vs/workbench/contrib/remote/common/remote.contribution.ts index 5d12781e767..3135630c1b4 100644 --- a/src/vs/workbench/contrib/remote/common/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/common/remote.contribution.ts @@ -12,7 +12,7 @@ import { Schemas } from 'vs/base/common/network'; import { IRemoteAgentService, RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService'; import { ILogService } from 'vs/platform/log/common/log'; import { LoggerChannelClient } from 'vs/platform/log/common/logIpc'; -import { IOutputChannelRegistry, Extensions as OutputExt, } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelRegistry, Extensions as OutputExt, } from 'vs/workbench/services/output/common/output'; import { localize } from 'vs/nls'; import { joinPath } from 'vs/base/common/resources'; import { Disposable } from 'vs/base/common/lifecycle'; diff --git a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts index 12092eb95e7..e55480f7c8b 100644 --- a/src/vs/workbench/contrib/tasks/browser/task.contribution.ts +++ b/src/vs/workbench/contrib/tasks/browser/task.contribution.ts @@ -20,7 +20,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatusbarEntry } from 'vs/workbench/services/statusbar/common/statusbar'; import { IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen'; -import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/contrib/output/common/output'; +import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/services/output/common/output'; import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions'; import { TaskEvent, TaskEventKind, TaskGroup, TASK_RUNNING_STATE } from 'vs/workbench/contrib/tasks/common/tasks'; diff --git a/src/vs/workbench/services/output/common/output.ts b/src/vs/workbench/services/output/common/output.ts new file mode 100644 index 00000000000..1a0833dd8f1 --- /dev/null +++ b/src/vs/workbench/services/output/common/output.ts @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Event, Emitter } from 'vs/base/common/event'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { URI } from 'vs/base/common/uri'; + +export const Extensions = { + OutputChannels: 'workbench.contributions.outputChannels' +}; + +export interface IOutputChannelDescriptor { + id: string; + label: string; + log: boolean; + file?: URI; +} + +export interface IFileOutputChannelDescriptor extends IOutputChannelDescriptor { + file: URI; +} + +export interface IOutputChannelRegistry { + + readonly onDidRegisterChannel: Event; + readonly onDidRemoveChannel: Event; + + /** + * Make an output channel known to the output world. + */ + registerChannel(descriptor: IOutputChannelDescriptor): void; + + /** + * Returns the list of channels known to the output world. + */ + getChannels(): IOutputChannelDescriptor[]; + + /** + * Returns the channel with the passed id. + */ + getChannel(id: string): IOutputChannelDescriptor | undefined; + + /** + * Remove the output channel with the passed id. + */ + removeChannel(id: string): void; +} + +class OutputChannelRegistry implements IOutputChannelRegistry { + private channels = new Map(); + + private readonly _onDidRegisterChannel = new Emitter(); + readonly onDidRegisterChannel: Event = this._onDidRegisterChannel.event; + + private readonly _onDidRemoveChannel = new Emitter(); + readonly onDidRemoveChannel: Event = this._onDidRemoveChannel.event; + + public registerChannel(descriptor: IOutputChannelDescriptor): void { + if (!this.channels.has(descriptor.id)) { + this.channels.set(descriptor.id, descriptor); + this._onDidRegisterChannel.fire(descriptor.id); + } + } + + public getChannels(): IOutputChannelDescriptor[] { + const result: IOutputChannelDescriptor[] = []; + this.channels.forEach(value => result.push(value)); + return result; + } + + public getChannel(id: string): IOutputChannelDescriptor | undefined { + return this.channels.get(id); + } + + public removeChannel(id: string): void { + this.channels.delete(id); + this._onDidRemoveChannel.fire(id); + } +} + +Registry.add(Extensions.OutputChannels, new OutputChannelRegistry()); From 201b5a20571c4d7df816816297fb556ea56d58b0 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 11 Dec 2019 18:21:16 +0100 Subject: [PATCH 350/637] move ext host log chanel contribution to ext host starter --- .../workbench/api/common/extHost.protocol.ts | 1 + .../api/common/extHostContributions.ts | 82 ------------------- .../api/common/extHostInitDataService.ts | 2 - .../workbench/api/node/extHostLogService.ts | 21 ----- .../workbench/api/worker/extHostLogService.ts | 20 ----- .../browser/webWorkerExtensionHostStarter.ts | 14 +++- .../extensions/common/extensionHostMain.ts | 14 +--- .../common/remoteExtensionHostClient.ts | 19 ++++- .../electron-browser/extensionHost.ts | 13 ++- 9 files changed, 45 insertions(+), 141 deletions(-) delete mode 100644 src/vs/workbench/api/common/extHostContributions.ts diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 91f9d879c62..f37e0e96236 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -87,6 +87,7 @@ export interface IInitData { telemetryInfo: ITelemetryInfo; logLevel: LogLevel; logsLocation: URI; + logFile: URI; autoStart: boolean; remote: { isRemote: boolean; authority: string | undefined; }; uiKind: UIKind; diff --git a/src/vs/workbench/api/common/extHostContributions.ts b/src/vs/workbench/api/common/extHostContributions.ts deleted file mode 100644 index e496cd73cdc..00000000000 --- a/src/vs/workbench/api/common/extHostContributions.ts +++ /dev/null @@ -1,82 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { BrandedService, IInstantiationService, ServicesAccessor, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; - -/** - * An ext host contribution that will be loaded when the extension host starts and disposed when the extension host shuts down. - */ -export interface IExtHostContribution extends IDisposable { - // Marker Interface -} - -export namespace Extensions { - export const ExtHost = 'exthost.contributions.kind'; -} - -type IExtHostContributionSignature = new (...services: Service) => IExtHostContribution; - -export interface IExtHostContributionsRegistry { - - /** - * Registers a ext host contribution to the platform that will be loaded when the extension host starts and disposed when the extension host shuts down. - */ - registerExtHostContribution(contribution: IExtHostContributionSignature): void; - - /** - * Starts the registry by providing the required services. - */ - start(accessor: ServicesAccessor): void; - - /** - * Stops the registry by disposing the instantiated contributions - */ - stop(): void; -} - -class ExtHostContributionsRegistry implements IExtHostContributionsRegistry { - - private instantiationService: IInstantiationService | undefined; - private readonly contributions: IConstructorSignature0[] = []; - private toBeInstantiated: IConstructorSignature0[] = []; - private instantiated: IExtHostContribution[] = []; - - registerExtHostContribution(ctor: { new(...services: Services): IExtHostContribution }): void { - this.contributions.push(ctor); - - // Instantiate directly if started - if (this.instantiationService) { - this.instantiate(ctor); - } - - // Otherwise keep contributions to be instantiated - else { - this.toBeInstantiated.push(ctor); - } - } - - start(accessor: ServicesAccessor): void { - this.instantiationService = accessor.get(IInstantiationService); - this.toBeInstantiated.forEach(ctor => this.instantiate(ctor), this); - this.toBeInstantiated = []; - } - - private instantiate(ctor: { new(...services: Services): IExtHostContribution }) { - this.instantiated.push(this.instantiationService!.createInstance(ctor)); - } - - stop(): void { - this.instantiationService = undefined; - this.instantiated.forEach(dispose); - this.instantiated = []; - this.toBeInstantiated = [...this.contributions]; - } - -} - -Registry.add(Extensions.ExtHost, new ExtHostContributionsRegistry()); - diff --git a/src/vs/workbench/api/common/extHostInitDataService.ts b/src/vs/workbench/api/common/extHostInitDataService.ts index cefea262ce3..2f0acd57a3c 100644 --- a/src/vs/workbench/api/common/extHostInitDataService.ts +++ b/src/vs/workbench/api/common/extHostInitDataService.ts @@ -5,12 +5,10 @@ import { IInitData } from './extHost.protocol'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { URI } from 'vs/base/common/uri'; export const IExtHostInitDataService = createDecorator('IExtHostInitDataService'); export interface IExtHostInitDataService extends Readonly { _serviceBrand: undefined; - readonly logFile: URI; } diff --git a/src/vs/workbench/api/node/extHostLogService.ts b/src/vs/workbench/api/node/extHostLogService.ts index 263758ec40a..bf84de74cd8 100644 --- a/src/vs/workbench/api/node/extHostLogService.ts +++ b/src/vs/workbench/api/node/extHostLogService.ts @@ -10,11 +10,6 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData import { Schemas } from 'vs/base/common/network'; import { SpdLogService } from 'vs/platform/log/node/spdlogService'; import { dirname } from 'vs/base/common/resources'; -import { IExtHostContribution, IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; -import { IExtHostOutputService } from 'vs/workbench/api/common/extHostOutput'; -import { localize } from 'vs/nls'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { Disposable } from 'vs/base/common/lifecycle'; export class ExtHostLogService extends DelegatedLogService implements ILogService, ExtHostLogServiceShape { @@ -29,19 +24,3 @@ export class ExtHostLogService extends DelegatedLogService implements ILogServic this.setLevel(level); } } - -class ExtHostLogChannelContribution extends Disposable implements IExtHostContribution { - - constructor( - @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtHostOutputService outputSerice: IExtHostOutputService, - ) { - super(); - outputSerice.createOutputChannelFromLogFile( - initData.remote.isRemote ? localize('remote extension host Log', "Remote Extension Host") : localize('extension host Log', "Extension Host"), - initData.logFile); - } - -} - -Registry.as(Extensions.ExtHost).registerExtHostContribution(ExtHostLogChannelContribution); diff --git a/src/vs/workbench/api/worker/extHostLogService.ts b/src/vs/workbench/api/worker/extHostLogService.ts index 7625e52cca4..2c0cb0592a4 100644 --- a/src/vs/workbench/api/worker/extHostLogService.ts +++ b/src/vs/workbench/api/worker/extHostLogService.ts @@ -6,13 +6,8 @@ import { ILogService, LogLevel, AbstractLogService } from 'vs/platform/log/common/log'; import { ExtHostLogServiceShape, MainThreadLogShape, MainContext } from 'vs/workbench/api/common/extHost.protocol'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; -import { IExtHostOutputService } from 'vs/workbench/api/common/extHostOutput'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { UriComponents } from 'vs/base/common/uri'; -import { localize } from 'vs/nls'; -import { IExtHostContribution, IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { Disposable } from 'vs/base/common/lifecycle'; export class ExtHostLogService extends AbstractLogService implements ILogService, ExtHostLogServiceShape { @@ -73,18 +68,3 @@ export class ExtHostLogService extends AbstractLogService implements ILogService flush(): void { } } - - -class ExtHostLogChannelContribution extends Disposable implements IExtHostContribution { - - constructor( - @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtHostOutputService outputSerice: IExtHostOutputService, - ) { - super(); - outputSerice.createOutputChannelFromLogFile(localize('name', "Worker Extension Host"), initData.logFile); - } - -} - -Registry.as(Extensions.ExtHost).registerExtHostContribution(ExtHostLogChannelContribution); diff --git a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHostStarter.ts b/src/vs/workbench/services/extensions/browser/webWorkerExtensionHostStarter.ts index e74228ce1dc..5e099346248 100644 --- a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHostStarter.ts +++ b/src/vs/workbench/services/extensions/browser/webWorkerExtensionHostStarter.ts @@ -17,9 +17,13 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import * as platform from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; -import { IExtensionHostStarter } from 'vs/workbench/services/extensions/common/extensions'; +import { IExtensionHostStarter, ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; import { IProductService } from 'vs/platform/product/common/productService'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { joinPath } from 'vs/base/common/resources'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output'; +import { localize } from 'vs/nls'; export class WebWorkerExtensionHostStarter implements IExtensionHostStarter { @@ -30,6 +34,8 @@ export class WebWorkerExtensionHostStarter implements IExtensionHostStarter { private readonly _onDidExit = new Emitter<[number, string | null]>(); readonly onExit: Event<[number, string | null]> = this._onDidExit.event; + private readonly _extensionHostLogFile: URI; + constructor( private readonly _autoStart: boolean, private readonly _extensions: Promise, @@ -41,7 +47,7 @@ export class WebWorkerExtensionHostStarter implements IExtensionHostStarter { @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @IProductService private readonly _productService: IProductService, ) { - + this._extensionHostLogFile = joinPath(this._extensionHostLogsLocation, `${ExtensionHostLogFileName}.log`); } async start(): Promise { @@ -90,6 +96,9 @@ export class WebWorkerExtensionHostStarter implements IExtensionHostStarter { protocol.send(VSBuffer.fromString(JSON.stringify(await this._createExtHostInitData()))); await Event.toPromise(Event.filter(protocol.onMessage, msg => isMessageOfType(msg, MessageType.Initialized))); + // Register log channel for web worker exthost log + Registry.as(Extensions.OutputChannels).registerChannel({ id: 'webWorkerExtHostLog', label: localize('name', "Worker Extension Host"), file: this._extensionHostLogFile, log: true }); + this._protocol = protocol; } return this._protocol; @@ -149,6 +158,7 @@ export class WebWorkerExtensionHostStarter implements IExtensionHostStarter { telemetryInfo, logLevel: this._logService.getLevel(), logsLocation: this._extensionHostLogsLocation, + logFile: this._extensionHostLogFile, autoStart: this._autoStart, remote: { authority: this._environmentService.configuration.remoteAuthority, diff --git a/src/vs/workbench/services/extensions/common/extensionHostMain.ts b/src/vs/workbench/services/extensions/common/extensionHostMain.ts index 105756420fc..caebe7634f3 100644 --- a/src/vs/workbench/services/extensions/common/extensionHostMain.ts +++ b/src/vs/workbench/services/extensions/common/extensionHostMain.ts @@ -5,7 +5,7 @@ import { timeout } from 'vs/base/common/async'; import * as errors from 'vs/base/common/errors'; -import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; +import { DisposableStore } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IURITransformer } from 'vs/base/common/uriIpc'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; @@ -21,10 +21,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IExtHostRpcService, ExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IURITransformerService, URITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService'; import { IExtHostExtensionService, IHostUtils } from 'vs/workbench/api/common/extHostExtensionService'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { IExtHostContributionsRegistry, Extensions } from 'vs/workbench/api/common/extHostContributions'; -import { joinPath } from 'vs/base/common/resources'; -import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; export interface IExitFn { (code?: number): any; @@ -56,18 +52,13 @@ export class ExtensionHostMain { // bootstrap services const services = new ServiceCollection(...getSingletonServiceDescriptors()); - services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData, logFile: joinPath(initData.logsLocation, `${ExtensionHostLogFileName}.log`) }); + services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData }); services.set(IExtHostRpcService, new ExtHostRpcService(rpcProtocol)); services.set(IURITransformerService, new URITransformerService(uriTransformer)); services.set(IHostUtils, hostUtils); const instaService: IInstantiationService = new InstantiationService(services, true); - // start ext host contributions - const extHostContributionsRegistry = Registry.as(Extensions.ExtHost); - instaService.invokeFunction(accessor => extHostContributionsRegistry.start(accessor)); - this._disposables.add(toDisposable(() => extHostContributionsRegistry.stop())); - // todo@joh // ugly self - inject const logService = instaService.invokeFunction(accessor => accessor.get(ILogService)); @@ -150,6 +141,7 @@ export class ExtensionHostMain { initData.environment.globalStorageHome = URI.revive(rpcProtocol.transformIncomingURIs(initData.environment.globalStorageHome)); initData.environment.userHome = URI.revive(rpcProtocol.transformIncomingURIs(initData.environment.userHome)); initData.logsLocation = URI.revive(rpcProtocol.transformIncomingURIs(initData.logsLocation)); + initData.logFile = URI.revive(rpcProtocol.transformIncomingURIs(initData.logFile)); initData.workspace = rpcProtocol.transformIncomingURIs(initData.workspace); return initData; } diff --git a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts index 83b800cad49..cb751b89e8f 100644 --- a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts +++ b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts @@ -13,7 +13,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IInitData, UIKind } from 'vs/workbench/api/common/extHost.protocol'; import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; -import { IExtensionHostStarter } from 'vs/workbench/services/extensions/common/extensions'; +import { IExtensionHostStarter, ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; import { parseExtensionDevOptions } from 'vs/workbench/services/extensions/common/extensionDevOptions'; import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; @@ -27,6 +27,11 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug'; import { IProductService } from 'vs/platform/product/common/productService'; import { ISignService } from 'vs/platform/sign/common/sign'; +import { joinPath } from 'vs/base/common/resources'; +import { URI } from 'vs/base/common/uri'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output'; +import { localize } from 'vs/nls'; export interface IInitDataProvider { readonly remoteAuthority: string; @@ -131,11 +136,16 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH reject('timeout'); }, 60 * 1000); + let logFile: URI; + const disposable = protocol.onMessage(msg => { if (isMessageOfType(msg, MessageType.Ready)) { // 1) Extension Host is ready to receive messages, initialize it - this._createExtHostInitData(isExtensionDevelopmentDebug).then(data => protocol.send(VSBuffer.fromString(JSON.stringify(data)))); + this._createExtHostInitData(isExtensionDevelopmentDebug).then(data => { + logFile = data.logFile; + protocol.send(VSBuffer.fromString(JSON.stringify(data))); + }); return; } @@ -147,9 +157,13 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH // stop listening for messages here disposable.dispose(); + // Register log channel for remote exthost log + Registry.as(Extensions.OutputChannels).registerChannel({ id: 'remoteExtHostLog', label: localize('remote extension host Log', "Remote Extension Host"), file: logFile, log: true }); + // release this promise this._protocol = protocol; resolve(protocol); + return; } @@ -214,6 +228,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH telemetryInfo, logLevel: this._logService.getLevel(), logsLocation: remoteExtensionHostData.extensionHostLogsPath, + logFile: joinPath(remoteExtensionHostData.extensionHostLogsPath, `${ExtensionHostLogFileName}.log`), autoStart: true, uiKind: platform.isWeb ? UIKind.Web : UIKind.Desktop }; diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts index c1dd257533a..b009292b709 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts @@ -36,9 +36,12 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions' import { parseExtensionDevOptions } from '../common/extensionDevOptions'; import { VSBuffer } from 'vs/base/common/buffer'; import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug'; -import { IExtensionHostStarter } from 'vs/workbench/services/extensions/common/extensions'; +import { IExtensionHostStarter, ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions'; import { isUntitledWorkspace } from 'vs/platform/workspaces/common/workspaces'; import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { joinPath } from 'vs/base/common/resources'; +import { Registry } from 'vs/platform/registry/common/platform'; +import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output'; export class ExtensionHostProcessWorker implements IExtensionHostStarter { @@ -65,6 +68,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { private _extensionHostConnection: Socket | null; private _messageProtocol: Promise | null; + private readonly _extensionHostLogFile: URI; + constructor( private readonly _autoStart: boolean, private readonly _extensions: Promise, @@ -95,6 +100,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { this._extensionHostConnection = null; this._messageProtocol = null; + this._extensionHostLogFile = joinPath(this._extensionHostLogsLocation, `${ExtensionHostLogFileName}.log`); + this._toDispose.add(this._onExit); this._toDispose.add(this._lifecycleService.onWillShutdown(e => this._onWillShutdown(e))); this._toDispose.add(this._lifecycleService.onShutdown(reason => this.terminate())); @@ -373,6 +380,9 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { // stop listening for messages here disposable.dispose(); + // Register log channel for exthost log + Registry.as(Extensions.OutputChannels).registerChannel({ id: 'extHostLog', label: nls.localize('extension host Log', "Extension Host"), file: this._extensionHostLogFile, log: true }); + // release this promise resolve(protocol); return; @@ -424,6 +434,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { telemetryInfo, logLevel: this._logService.getLevel(), logsLocation: this._extensionHostLogsLocation, + logFile: this._extensionHostLogFile, autoStart: this._autoStart, uiKind: UIKind.Desktop }; From f149dbbedf99267b175bd6c4abae2341102aa408 Mon Sep 17 00:00:00 2001 From: SteVen Batten Date: Wed, 11 Dec 2019 09:46:09 -0800 Subject: [PATCH 351/637] promote menu widgets above quick(open|input) --- src/vs/base/browser/ui/contextview/contextview.css | 4 ++-- .../workbench/browser/parts/titlebar/media/titlebarpart.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/base/browser/ui/contextview/contextview.css b/src/vs/base/browser/ui/contextview/contextview.css index af3ead17a6b..b1b67bbe3c3 100644 --- a/src/vs/base/browser/ui/contextview/contextview.css +++ b/src/vs/base/browser/ui/contextview/contextview.css @@ -5,5 +5,5 @@ .context-view { position: absolute; - z-index: 2000; -} \ No newline at end of file + z-index: 2500; +} diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 2725a7d5da5..e414da015b0 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -59,7 +59,7 @@ .monaco-workbench .part.titlebar > .menubar { /* move menubar above drag region as negative z-index on drag region cause greyscale AA */ - z-index: 2000; + z-index: 2500; } .monaco-workbench.linux .part.titlebar > .window-title { From bacbfd2302c8d5cd4792b20a0756388671438973 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 11 Dec 2019 11:55:54 -0800 Subject: [PATCH 352/637] use built-in queue(), pr comments --- .../debug/common/abstractDebugAdapter.ts | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts index 29b4889ca3f..f060ba6c665 100644 --- a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts +++ b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts @@ -5,7 +5,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IDebugAdapter } from 'vs/workbench/contrib/debug/common/debug'; -import { timeout } from 'vs/base/common/async'; +import { timeout, Queue } from 'vs/base/common/async'; /** * Abstract implementation of the low level API for a debug adapter. @@ -18,7 +18,7 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { private requestCallback: ((request: DebugProtocol.Request) => void) | undefined; private eventCallback: ((request: DebugProtocol.Event) => void) | undefined; private messageCallback: ((message: DebugProtocol.ProtocolMessage) => void) | undefined; - private readonly queue: DebugProtocol.ProtocolMessage[] = []; + private readonly queue = new Queue(); protected readonly _onError = new Emitter(); protected readonly _onExit = new Emitter(); @@ -109,41 +109,33 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { this.messageCallback(message); } else { - // Artificially queueing protocol messages guarantees that any microtasks for - // previous message finish before next message is processed. This is essential - // to guarantee ordering when using promises anywhere along the call path. - this.queue.push(message); - if (this.queue.length === 1) { - setTimeout(() => this.processQueue(), 0); - } - } - } + this.queue.queue(() => { + switch (message.type) { + case 'event': + if (this.eventCallback) { + this.eventCallback(message); + } + break; + case 'request': + if (this.requestCallback) { + this.requestCallback(message); + } + break; + case 'response': + const response = message; + const clb = this.pendingRequests.get(response.request_seq); + if (clb) { + this.pendingRequests.delete(response.request_seq); + clb(response); + } + break; + } - private processQueue(): void { - const message = this.queue!.shift()!; - switch (message.type) { - case 'event': - if (this.eventCallback) { - this.eventCallback(message); - } - break; - case 'request': - if (this.requestCallback) { - this.requestCallback(message); - } - break; - case 'response': - const response = message; - const clb = this.pendingRequests.get(response.request_seq); - if (clb) { - this.pendingRequests.delete(response.request_seq); - clb(response); - } - break; - } - - if (this.queue.length) { - setTimeout(() => this.processQueue(), 0); + // Artificially queueing protocol messages guarantees that any microtasks for + // previous message finish before next message is processed. This is essential + // to guarantee ordering when using promises anywhere along the call path. + return timeout(0); + }); } } @@ -180,6 +172,6 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { } dispose(): void { - // noop + this.queue.dispose(); } } From a4880b13a2154ce3040fb4322a6dfc90e5d343e5 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 11 Dec 2019 11:59:31 -0800 Subject: [PATCH 353/637] Allow checking contrast of transparent colors in TM scope viewer. --- .../codeEditor/browser/inspectTMScopes/inspectTMScopes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts b/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts index 19fa1197cad..c2a701f247d 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts @@ -266,10 +266,10 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget { result += `font style${this._fontStyleToString(metadata.fontStyle)}`; result += `foreground${Color.Format.CSS.formatHexA(metadata.foreground)}`; result += `background${Color.Format.CSS.formatHexA(metadata.background)}`; - if (metadata.background.isOpaque() && metadata.foreground.isOpaque()) { - result += `contrast ratio${metadata.background.getContrastRatio(metadata.foreground).toFixed(2)}`; + if (metadata.background.isOpaque()) { + result += `contrast ratio${metadata.background.getContrastRatio(metadata.foreground.makeOpaque(metadata.background)).toFixed(2)}`; } else { - result += 'Contrast ratio cannot be precise for colors that use transparency'; + result += 'Contrast ratio cannot be precise for background colors that use transparency'; } result += ``; From cc70266d0453640367992308069a7d4f84c6b24e Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Wed, 11 Dec 2019 13:35:47 -0800 Subject: [PATCH 354/637] Update checkbox to use icon font check #86708 --- src/vs/base/browser/ui/checkbox/check-dark.svg | 3 --- src/vs/base/browser/ui/checkbox/check-light.svg | 3 --- src/vs/base/browser/ui/checkbox/checkbox.css | 9 +++------ src/vs/base/browser/ui/checkbox/checkbox.ts | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 src/vs/base/browser/ui/checkbox/check-dark.svg delete mode 100644 src/vs/base/browser/ui/checkbox/check-light.svg diff --git a/src/vs/base/browser/ui/checkbox/check-dark.svg b/src/vs/base/browser/ui/checkbox/check-dark.svg deleted file mode 100644 index 865cc83c347..00000000000 --- a/src/vs/base/browser/ui/checkbox/check-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/checkbox/check-light.svg b/src/vs/base/browser/ui/checkbox/check-light.svg deleted file mode 100644 index e1a546660ed..00000000000 --- a/src/vs/base/browser/ui/checkbox/check-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/vs/base/browser/ui/checkbox/checkbox.css b/src/vs/base/browser/ui/checkbox/checkbox.css index fa9aa082d39..972e94f7175 100644 --- a/src/vs/base/browser/ui/checkbox/checkbox.css +++ b/src/vs/base/browser/ui/checkbox/checkbox.css @@ -44,10 +44,7 @@ background-size: 16px !important; } -.monaco-custom-checkbox.monaco-simple-checkbox.checked { - background: url('check-light.svg') center center no-repeat; -} - -.monaco-custom-checkbox.monaco-simple-checkbox.checked { - background: url('check-dark.svg') center center no-repeat; +/* hide check when unchecked */ +.monaco-custom-checkbox.monaco-simple-checkbox.unchecked:not(.checked)::before { + visibility: hidden;; } diff --git a/src/vs/base/browser/ui/checkbox/checkbox.ts b/src/vs/base/browser/ui/checkbox/checkbox.ts index 8eb398bf2db..e7c16234f63 100644 --- a/src/vs/base/browser/ui/checkbox/checkbox.ts +++ b/src/vs/base/browser/ui/checkbox/checkbox.ts @@ -192,7 +192,7 @@ export class SimpleCheckbox extends Widget { constructor(private title: string, private isChecked: boolean) { super(); - this.checkbox = new Checkbox({ title: this.title, isChecked: this.isChecked, actionClassName: 'monaco-simple-checkbox' }); + this.checkbox = new Checkbox({ title: this.title, isChecked: this.isChecked, actionClassName: 'monaco-simple-checkbox codicon-check' }); this.domNode = this.checkbox.domNode; From 7bb8b0084fa60b9e476ac1140ed187516fa7d1e0 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 11 Dec 2019 13:13:34 -0500 Subject: [PATCH 355/637] Fixes #84695 - codicons in hovers --- src/vs/base/browser/markdownRenderer.ts | 11 +- .../browser/ui/codiconLabel/codiconLabel.ts | 13 +- .../ui/highlightedlabel/highlightedLabel.ts | 8 +- src/vs/base/common/codicons.ts | 29 +++++ src/vs/base/common/htmlContent.ts | 35 +++-- .../test/browser/markdownRenderer.test.ts | 122 +++++++++++++----- .../base/test/common/markdownString.test.ts | 61 ++++++++- .../editor/contrib/codelens/codelensWidget.ts | 5 +- src/vs/monaco.d.ts | 1 + src/vs/vscode.d.ts | 9 +- src/vs/vscode.proposed.d.ts | 12 ++ .../api/common/extHostTypeConverters.ts | 2 +- src/vs/workbench/api/common/extHostTypes.ts | 16 ++- .../runtimeExtensionsEditor.ts | 13 +- .../workbench/contrib/scm/browser/mainPane.ts | 5 +- 15 files changed, 271 insertions(+), 71 deletions(-) create mode 100644 src/vs/base/common/codicons.ts diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index 58da2e0be68..2918133f5e5 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -15,6 +15,7 @@ import { cloneAndChange } from 'vs/base/common/objects'; import { escape } from 'vs/base/common/strings'; import { URI } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; +import { renderCodicons, markdownEscapeEscapedCodicons } from 'vs/base/common/codicons'; export interface MarkdownRenderOptions extends FormattedTextRenderOptions { codeBlockRenderer?: (modeId: string, value: string) => Promise; @@ -118,7 +119,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende } }; renderer.paragraph = (text): string => { - return `

${text}

`; + return `

${markdown.supportThemeIcons ? renderCodicons(text) : text}

`; }; if (options.codeBlockRenderer) { @@ -178,7 +179,13 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende allowedSchemes.push(Schemas.command); } - const renderedMarkdown = marked.parse(markdown.value, markedOptions); + const renderedMarkdown = marked.parse( + markdown.supportThemeIcons + ? markdownEscapeEscapedCodicons(markdown.value) + : markdown.value, + markedOptions + ); + element.innerHTML = insane(renderedMarkdown, { allowedSchemes, allowedAttributes: { diff --git a/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts b/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts index e496fd3a164..ccec1f655bb 100644 --- a/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts +++ b/src/vs/base/browser/ui/codiconLabel/codiconLabel.ts @@ -6,16 +6,7 @@ import 'vs/css!./codicon/codicon'; import 'vs/css!./codicon/codicon-animations'; import { escape } from 'vs/base/common/strings'; - -function expand(text: string): string { - return text.replace(/\$\((([a-z0-9\-]+?)(~([a-z0-9\-]*?))?)\)/gi, (_match, _g1, name, _g3, animation) => { - return ``; - }); -} - -export function renderCodicons(label: string): string { - return expand(escape(label)); -} +import { renderCodicons } from 'vs/base/common/codicons'; export class CodiconLabel { @@ -24,7 +15,7 @@ export class CodiconLabel { ) { } set text(text: string) { - this._container.innerHTML = renderCodicons(text || ''); + this._container.innerHTML = renderCodicons(escape(text ?? '')); } set title(title: string) { diff --git a/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts b/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts index 8980c3e5b0d..163dffb2d5a 100644 --- a/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts +++ b/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as objects from 'vs/base/common/objects'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import { renderCodicons } from 'vs/base/common/codicons'; import { escape } from 'vs/base/common/strings'; export interface IHighlight { @@ -65,13 +65,13 @@ export class HighlightedLabel { if (pos < highlight.start) { htmlContent += ''; const substring = this.text.substring(pos, highlight.start); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; pos = highlight.end; } htmlContent += ''; const substring = this.text.substring(highlight.start, highlight.end); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; pos = highlight.end; } @@ -79,7 +79,7 @@ export class HighlightedLabel { if (pos < this.text.length) { htmlContent += ''; const substring = this.text.substring(pos); - htmlContent += this.supportCodicons ? renderCodicons(substring) : escape(substring); + htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring); htmlContent += ''; } diff --git a/src/vs/base/common/codicons.ts b/src/vs/base/common/codicons.ts new file mode 100644 index 00000000000..414410812a4 --- /dev/null +++ b/src/vs/base/common/codicons.ts @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const escapeCodiconsRegex = /(? `\\${match}`); +} + +const markdownEscapedCodiconsRegex = /\\\$\([a-z0-9\-]+?(?:~[a-z0-9\-]*?)?\)/gi; +export function markdownEscapeEscapedCodicons(text: string): string { + // Need to add an extra \ for escaping in markdown + return text.replace(markdownEscapedCodiconsRegex, match => `\\${match}`); +} + +const markdownUnescapeCodiconsRegex = /(? `$(${codicon})`); +} + +const renderCodiconsRegex = /(\\)?\$\((([a-z0-9\-]+?)(?:~([a-z0-9\-]*?))?)\)/gi; +export function renderCodicons(text: string): string { + return text.replace(renderCodiconsRegex, (_, escape, codicon, name, animation) => { + return escape + ? `$(${codicon})` + : ``; + }); +} diff --git a/src/vs/base/common/htmlContent.ts b/src/vs/base/common/htmlContent.ts index c9bfed7ea8f..59e2359e090 100644 --- a/src/vs/base/common/htmlContent.ts +++ b/src/vs/base/common/htmlContent.ts @@ -5,37 +5,51 @@ import { equals } from 'vs/base/common/arrays'; import { UriComponents } from 'vs/base/common/uri'; +import { escapeCodicons, markdownUnescapeCodicons } from 'vs/base/common/codicons'; export interface IMarkdownString { readonly value: string; readonly isTrusted?: boolean; + readonly supportThemeIcons?: boolean; uris?: { [href: string]: UriComponents }; } export class MarkdownString implements IMarkdownString { + private readonly _isTrusted: boolean; + private readonly _supportThemeIcons: boolean; - private _value: string; - private _isTrusted: boolean; + constructor( + private _value: string = '', + isTrustedOrOptions: boolean | { isTrusted?: boolean, supportThemeIcons?: boolean } = false, + ) { + if (typeof isTrustedOrOptions === 'boolean') { + this._isTrusted = isTrustedOrOptions; + this._supportThemeIcons = false; + } + else { + this._isTrusted = isTrustedOrOptions.isTrusted ?? false; + this._supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false; + } - constructor(value: string = '', isTrusted = false) { - this._value = value; - this._isTrusted = isTrusted; } get value() { return this._value; } get isTrusted() { return this._isTrusted; } + get supportThemeIcons() { return this._supportThemeIcons; } appendText(value: string): MarkdownString { // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash - this._value += value + value = value .replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&') .replace('\n', '\n\n'); + this._value += this.supportThemeIcons ? markdownUnescapeCodicons(value) : value; return this; } appendMarkdown(value: string): MarkdownString { this._value += value; + return this; } @@ -47,6 +61,10 @@ export class MarkdownString implements IMarkdownString { this._value += '\n```\n'; return this; } + + static escapeThemeIcons(value: string): string { + return escapeCodicons(value); + } } export function isEmptyMarkdownString(oneOrMany: IMarkdownString | IMarkdownString[] | null | undefined): boolean { @@ -64,7 +82,8 @@ export function isMarkdownString(thing: any): thing is IMarkdownString { return true; } else if (thing && typeof thing === 'object') { return typeof (thing).value === 'string' - && (typeof (thing).isTrusted === 'boolean' || (thing).isTrusted === undefined); + && (typeof (thing).isTrusted === 'boolean' || (thing).isTrusted === undefined) + && (typeof (thing).supportThemeIcons === 'boolean' || (thing).supportThemeIcons === undefined); } return false; } @@ -89,7 +108,7 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean { } else if (!a || !b) { return false; } else { - return a.value === b.value && a.isTrusted === b.isTrusted; + return a.value === b.value && a.isTrusted === b.isTrusted && a.supportThemeIcons === b.supportThemeIcons; } } diff --git a/src/vs/base/test/browser/markdownRenderer.test.ts b/src/vs/base/test/browser/markdownRenderer.test.ts index 525eb86e741..128c483aa12 100644 --- a/src/vs/base/test/browser/markdownRenderer.test.ts +++ b/src/vs/base/test/browser/markdownRenderer.test.ts @@ -6,42 +6,104 @@ import * as assert from 'assert'; import * as marked from 'vs/base/common/marked/marked'; import { renderMarkdown } from 'vs/base/browser/markdownRenderer'; +import { MarkdownString } from 'vs/base/common/htmlContent'; suite('MarkdownRenderer', () => { - test('image rendering conforms to default', () => { - const markdown = { value: `![image](someimageurl 'caption')` }; - const result: HTMLElement = renderMarkdown(markdown); - const renderer = new marked.Renderer(); - const imageFromMarked = marked(markdown.value, { - sanitize: true, - renderer - }).trim(); - assert.strictEqual(result.innerHTML, imageFromMarked); + suite('Images', () => { + + test('image rendering conforms to default', () => { + const markdown = { value: `![image](someimageurl 'caption')` }; + const result: HTMLElement = renderMarkdown(markdown); + const renderer = new marked.Renderer(); + const imageFromMarked = marked(markdown.value, { + sanitize: true, + renderer + }).trim(); + assert.strictEqual(result.innerHTML, imageFromMarked); + }); + + test('image rendering conforms to default without title', () => { + const markdown = { value: `![image](someimageurl)` }; + const result: HTMLElement = renderMarkdown(markdown); + const renderer = new marked.Renderer(); + const imageFromMarked = marked(markdown.value, { + sanitize: true, + renderer + }).trim(); + assert.strictEqual(result.innerHTML, imageFromMarked); + }); + + test('image width from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|width=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); + + test('image height from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); + + test('image width and height from title params', () => { + let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=200,width=100 'caption')` }); + assert.strictEqual(result.innerHTML, `

image

`); + }); + }); - test('image rendering conforms to default without title', () => { - const markdown = { value: `![image](someimageurl)` }; - const result: HTMLElement = renderMarkdown(markdown); - const renderer = new marked.Renderer(); - const imageFromMarked = marked(markdown.value, { - sanitize: true, - renderer - }).trim(); - assert.strictEqual(result.innerHTML, imageFromMarked); + suite('ThemeIcons Support On', () => { + + test('render appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText('$(zap) $(dont match me)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(dont match me)

`); + }); + + test('render appendText escaped', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText(MarkdownString.escapeThemeIcons('$(zap) $(dont match me)')); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(dont match me)

`); + }); + + test('render appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('$(zap) $(dont match me)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(dont match me)

`); + }); + + test('render appendMarkdown escaped', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown(MarkdownString.escapeThemeIcons('$(zap) $(dont match me)')); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(dont match me)

`); + }); + }); - test('image width from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|width=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); + suite('ThemeIcons Support Off', () => { + + test('render appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendText('$(zap) $(dont match me)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(dont match me)

`); + }); + + test('render appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendMarkdown('$(zap) $(dont match me)'); + + let result: HTMLElement = renderMarkdown(mds); + assert.strictEqual(result.innerHTML, `

$(zap) $(dont match me)

`); + }); + }); - test('image height from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); - }); - - test('image width and height from title params', () => { - let result: HTMLElement = renderMarkdown({ value: `![image](someimageurl|height=200,width=100 'caption')` }); - assert.strictEqual(result.innerHTML, `

image

`); - }); }); diff --git a/src/vs/base/test/common/markdownString.test.ts b/src/vs/base/test/common/markdownString.test.ts index 69d33de8f17..ee165144e32 100644 --- a/src/vs/base/test/common/markdownString.test.ts +++ b/src/vs/base/test/common/markdownString.test.ts @@ -6,7 +6,7 @@ import * as assert from 'assert'; import { MarkdownString } from 'vs/base/common/htmlContent'; -suite('markdownString', () => { +suite('MarkdownString', () => { test('escape', () => { @@ -16,4 +16,63 @@ suite('markdownString', () => { assert.equal(mds.value, '\\# foo\n\n\\*bar\\*'); }); + + suite('ThemeIcons', () => { + + test('escapeThemeIcons', () => { + assert.equal( + MarkdownString.escapeThemeIcons('$(zap) $(not an icon) foo$(bar)'), + '\\$(zap) $(not an icon) foo\\$(bar)' + ); + }); + + suite('Support On', () => { + + test('appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText('$(zap)'); + + assert.equal(mds.value, '$(zap)'); + }); + + test('appendText escaped', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendText(MarkdownString.escapeThemeIcons('$(zap)')); + + assert.equal(mds.value, '\\\\$\\(zap\\)'); + }); + + test('appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown('$(zap)'); + + assert.equal(mds.value, '$(zap)'); + }); + + test('appendMarkdown escaped', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: true }); + mds.appendMarkdown(MarkdownString.escapeThemeIcons('$(zap)')); + + assert.equal(mds.value, '\\$(zap)'); + }); + }); + + suite('Support Off', () => { + + test('appendText', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendText('$(zap)'); + + assert.equal(mds.value, '$\\(zap\\)'); + }); + + test('appendMarkdown', () => { + const mds = new MarkdownString(undefined, { supportThemeIcons: false }); + mds.appendMarkdown('$(zap)'); + + assert.equal(mds.value, '$(zap)'); + }); + }); + + }); }); diff --git a/src/vs/editor/contrib/codelens/codelensWidget.ts b/src/vs/editor/contrib/codelens/codelensWidget.ts index a0bde211451..fbdf4a94f34 100644 --- a/src/vs/editor/contrib/codelens/codelensWidget.ts +++ b/src/vs/editor/contrib/codelens/codelensWidget.ts @@ -5,7 +5,8 @@ import 'vs/css!./codelensWidget'; import * as dom from 'vs/base/browser/dom'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import { renderCodicons } from 'vs/base/common/codicons'; +import { escape } from 'vs/base/common/strings'; import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import { Range } from 'vs/editor/common/core/range'; import { IModelDecorationsChangeAccessor, IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model'; @@ -88,7 +89,7 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget { } hasSymbol = true; if (lens.command) { - const title = renderCodicons(lens.command.title); + const title = renderCodicons(escape(lens.command.title)); if (lens.command.id) { innerHtml += `
${title}`; this._commands.set(String(i), lens.command); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index d85824e5759..8f26213c1f1 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -380,6 +380,7 @@ declare namespace monaco { export interface IMarkdownString { readonly value: string; readonly isTrusted?: boolean; + readonly supportThemeIcons?: boolean; uris?: { [href: string]: UriComponents; }; diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index c07725c609b..90b446a8075 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2341,6 +2341,12 @@ declare module 'vscode' { */ export class MarkdownString { + /** + * Escapes any [ThemeIcons](#ThemeIcon), e.g. `$(zap)`, in the string. + * @param value A string. + */ + static escapeThemeIcons(value: string): string; + /** * The markdown string. */ @@ -2356,8 +2362,9 @@ declare module 'vscode' { * Creates a new markdown string with the given value. * * @param value Optional, initial value. + * @param options Optional, options to specify whether [ThemeIcons](#ThemeIcon) are supported within the [`MarkdownString`](#MarkdownString). */ - constructor(value?: string); + constructor(value?: string, options?: { supportThemeIcons?: boolean }); /** * Appends and escapes the given string to this markdown string. diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index fa31dcb8423..09a9d256f0f 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1338,4 +1338,16 @@ declare module 'vscode' { } //#endregion + + //#region Allow theme icons in hovers: https://github.com/microsoft/vscode/issues/84695 + + export interface MarkdownString { + + /** + * Indicates that this markdown string can contain [ThemeIcons](#ThemeIcon), e.g. `$(zap)`. + */ + readonly supportThemeIcons?: boolean; + } + + //#endregion } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index a1d98fee135..2f67f3c99d3 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -309,7 +309,7 @@ export namespace MarkdownString { } export function to(value: htmlContent.IMarkdownString): vscode.MarkdownString { - return new htmlContent.MarkdownString(value.value, value.isTrusted); + return new htmlContent.MarkdownString(value.value, { isTrusted: value.isTrusted, supportThemeIcons: value.supportThemeIcons }); } export function fromStrict(value: string | types.MarkdownString): undefined | string | htmlContent.IMarkdownString { diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 8f89d246b5a..d8afcf43654 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -14,6 +14,7 @@ import { generateUuid } from 'vs/base/common/uuid'; import * as vscode from 'vscode'; import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files'; import { RemoteAuthorityResolverErrorCode } from 'vs/platform/remote/common/remoteAuthorityResolver'; +import { markdownUnescapeCodicons, escapeCodicons } from 'vs/base/common/codicons'; function es5ClassCompat(target: Function): any { ///@ts-ignore @@ -1231,21 +1232,26 @@ export class MarkdownString { value: string; isTrusted?: boolean; + readonly supportThemeIcons?: boolean; - constructor(value?: string) { - this.value = value || ''; + constructor(value?: string, { supportThemeIcons }: { supportThemeIcons?: boolean } = {}) { + this.value = value ?? ''; + this.supportThemeIcons = supportThemeIcons ?? false; } appendText(value: string): MarkdownString { // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash - this.value += value + value = value .replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&') .replace('\n', '\n\n'); + this.value += this.supportThemeIcons ? markdownUnescapeCodicons(value) : value; + return this; } appendMarkdown(value: string): MarkdownString { this.value += value; + return this; } @@ -1257,6 +1263,10 @@ export class MarkdownString { this.value += '\n```\n'; return this; } + + static escapeThemeIcons(value: string): string { + return escapeCodicons(value); + } } @es5ClassCompat diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts index a7cb0168bfc..d1ad6303939 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -38,7 +38,8 @@ import { randomPort } from 'vs/base/node/ports'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { ILabelService } from 'vs/platform/label/common/label'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import { renderCodicons } from 'vs/base/common/codicons'; +import { escape } from 'vs/base/common/strings'; import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; import { SlowExtensionAction } from 'vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions'; @@ -365,31 +366,31 @@ export class RuntimeExtensionsEditor extends BaseEditor { if (this._extensionHostProfileService.getUnresponsiveProfile(element.description.identifier)) { const el = $('span'); - el.innerHTML = renderCodicons(` $(alert) Unresponsive`); + el.innerHTML = renderCodicons(escape(` $(alert) Unresponsive`)); el.title = nls.localize('unresponsive.title', "Extension has caused the extension host to freeze."); data.msgContainer.appendChild(el); } if (isNonEmptyArray(element.status.runtimeErrors)) { const el = $('span'); - el.innerHTML = renderCodicons(`$(bug) ${nls.localize('errors', "{0} uncaught errors", element.status.runtimeErrors.length)}`); + el.innerHTML = renderCodicons(escape(`$(bug) ${nls.localize('errors', "{0} uncaught errors", element.status.runtimeErrors.length)}`)); data.msgContainer.appendChild(el); } if (element.status.messages && element.status.messages.length > 0) { const el = $('span'); - el.innerHTML = renderCodicons(`$(alert) ${element.status.messages[0].message}`); + el.innerHTML = renderCodicons(escape(`$(alert) ${element.status.messages[0].message}`)); data.msgContainer.appendChild(el); } if (element.description.extensionLocation.scheme !== 'file') { const el = $('span'); - el.innerHTML = renderCodicons(`$(remote) ${element.description.extensionLocation.authority}`); + el.innerHTML = renderCodicons(escape(`$(remote) ${element.description.extensionLocation.authority}`)); data.msgContainer.appendChild(el); const hostLabel = this._labelService.getHostLabel(REMOTE_HOST_SCHEME, this._environmentService.configuration.remoteAuthority); if (hostLabel) { - el.innerHTML = renderCodicons(`$(remote) ${hostLabel}`); + el.innerHTML = renderCodicons(escape(`$(remote) ${hostLabel}`)); } } diff --git a/src/vs/workbench/contrib/scm/browser/mainPane.ts b/src/vs/workbench/contrib/scm/browser/mainPane.ts index bb822b61f1a..d5ec661f87b 100644 --- a/src/vs/workbench/contrib/scm/browser/mainPane.ts +++ b/src/vs/workbench/contrib/scm/browser/mainPane.ts @@ -25,7 +25,8 @@ import { ActionBar, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionba import { IThemeService } from 'vs/platform/theme/common/themeService'; import { attachBadgeStyler } from 'vs/platform/theme/common/styler'; import { Command } from 'vs/editor/common/modes'; -import { renderCodicons } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import { renderCodicons } from 'vs/base/common/codicons'; +import { escape } from 'vs/base/common/strings'; import { WorkbenchList } from 'vs/platform/list/browser/listService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IViewDescriptor } from 'vs/workbench/common/views'; @@ -83,7 +84,7 @@ class StatusBarActionViewItem extends ActionViewItem { updateLabel(): void { if (this.options.label && this.label) { - this.label.innerHTML = renderCodicons(this.getAction().label); + this.label.innerHTML = renderCodicons(escape(this.getAction().label)); } } } From 59ee3ceeec992d51f62155b6de1de1f845fd54ef Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 10 Dec 2019 17:14:49 -0800 Subject: [PATCH 356/637] Strict function fix --- src/vs/workbench/api/browser/mainThreadDiagnostics.ts | 2 +- src/vs/workbench/services/keybinding/browser/keymapService.ts | 2 +- .../services/preferences/browser/preferencesService.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadDiagnostics.ts b/src/vs/workbench/api/browser/mainThreadDiagnostics.ts index eb26b62da3a..ca934673534 100644 --- a/src/vs/workbench/api/browser/mainThreadDiagnostics.ts +++ b/src/vs/workbench/api/browser/mainThreadDiagnostics.ts @@ -33,7 +33,7 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape { this._activeOwners.clear(); } - private _forwardMarkers(resources: URI[]): void { + private _forwardMarkers(resources: readonly URI[]): void { const data: [UriComponents, IMarkerData[]][] = []; for (const resource of resources) { data.push([ diff --git a/src/vs/workbench/services/keybinding/browser/keymapService.ts b/src/vs/workbench/services/keybinding/browser/keymapService.ts index 4a22d72e0d3..ea5cd3a04d3 100644 --- a/src/vs/workbench/services/keybinding/browser/keymapService.ts +++ b/src/vs/workbench/services/keybinding/browser/keymapService.ts @@ -349,7 +349,7 @@ export class BrowserKeyboardMapperFactoryBase { // The value is empty when the key is not a printable character, we skip validation. if (keyboardEvent.ctrlKey || keyboardEvent.metaKey) { setTimeout(() => { - this._getBrowserKeyMapping().then((keymap: IKeyboardMapping) => { + this._getBrowserKeyMapping().then((keymap: IRawMixedKeyboardMapping | null) => { if (this.isKeyMappingActive(keymap)) { return; } diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index db55635c1f9..1e52b5bb0b2 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -314,9 +314,9 @@ export class PreferencesService extends Disposable implements IPreferencesServic configureSettingsForLanguage(language: string): void { this.openGlobalSettings(true) .then(editor => this.createPreferencesEditorModel(this.userSettingsResource) - .then((settingsModel: IPreferencesEditorModel) => { + .then((settingsModel: IPreferencesEditorModel | null) => { const codeEditor = editor ? getCodeEditor(editor.getControl()) : null; - if (codeEditor) { + if (codeEditor && settingsModel) { this.addLanguageOverrideEntry(language, settingsModel, codeEditor) .then(position => { if (codeEditor && position) { From 7e2d7965e5d5728c53996f0024be9b0681369b2a Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 11 Dec 2019 14:53:28 -0800 Subject: [PATCH 357/637] vscode-editor-font-size should have units Fixes #86722 --- src/vs/workbench/contrib/webview/common/themeing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/webview/common/themeing.ts b/src/vs/workbench/contrib/webview/common/themeing.ts index 9b2684fd3ae..8ee85c8aa55 100644 --- a/src/vs/workbench/contrib/webview/common/themeing.ts +++ b/src/vs/workbench/contrib/webview/common/themeing.ts @@ -68,7 +68,7 @@ export class WebviewThemeDataProvider extends Disposable { 'vscode-font-size': '13px', 'vscode-editor-font-family': editorFontFamily, 'vscode-editor-font-weight': editorFontWeight, - 'vscode-editor-font-size': editorFontSize, + 'vscode-editor-font-size': editorFontSize + 'px', ...exportedColors }; From 007b3032ad685544bd5d65d39a9ef835e3bc915e Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 11 Dec 2019 15:58:59 -0800 Subject: [PATCH 358/637] Update to TS 3.7.3 for building VS Code --- build/package.json | 2 +- build/yarn.lock | 8 ++++---- extensions/markdown-language-features/package.json | 2 +- extensions/markdown-language-features/yarn.lock | 8 ++++---- package.json | 2 +- yarn.lock | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build/package.json b/build/package.json index a685a901b88..bafb409c97b 100644 --- a/build/package.json +++ b/build/package.json @@ -40,7 +40,7 @@ "request": "^2.85.0", "terser": "4.3.8", "tslint": "^5.9.1", - "typescript": "3.7.2", + "typescript": "3.7.3", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.5.4", "xml2js": "^0.4.17" diff --git a/build/yarn.lock b/build/yarn.lock index 36f6c025d48..3f9e5f1cda7 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -2441,10 +2441,10 @@ typed-rest-client@^0.9.0: tunnel "0.0.4" underscore "1.8.3" -typescript@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== typescript@^3.0.1: version "3.5.3" diff --git a/extensions/markdown-language-features/package.json b/extensions/markdown-language-features/package.json index 303bd99f702..6fe2e99814f 100644 --- a/extensions/markdown-language-features/package.json +++ b/extensions/markdown-language-features/package.json @@ -345,7 +345,7 @@ "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7", "ts-loader": "^6.2.1", - "typescript": "^3.7.2", + "typescript": "^3.7.3", "vscode": "^1.1.10", "webpack": "^4.41.2", "webpack-cli": "^3.3.0" diff --git a/extensions/markdown-language-features/yarn.lock b/extensions/markdown-language-features/yarn.lock index 956c4571523..8ec43a6d0ec 100644 --- a/extensions/markdown-language-features/yarn.lock +++ b/extensions/markdown-language-features/yarn.lock @@ -4528,10 +4528,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@^3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== uc.micro@^1.0.1: version "1.0.3" diff --git a/package.json b/package.json index 96014331af1..0004b65227c 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "source-map": "^0.4.4", "ts-loader": "^4.4.2", "tslint": "^5.16.0", - "typescript": "3.7.2", + "typescript": "3.7.3", "typescript-formatter": "7.1.0", "underscore": "^1.8.2", "vinyl": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index c90d2e63b0e..390ecff7bd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8824,10 +8824,10 @@ typescript-formatter@7.1.0: commandpost "^1.0.0" editorconfig "^0.15.0" -typescript@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" - integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== +typescript@3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== typescript@^2.6.2: version "2.6.2" From efd8d258eda0e86b2984fe96fdb82a99736fc7fb Mon Sep 17 00:00:00 2001 From: kevinn Date: Thu, 12 Dec 2019 08:20:53 +0800 Subject: [PATCH 359/637] fix minimal wrong spell (#86744) --- src/vs/platform/state/node/stateService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/platform/state/node/stateService.ts b/src/vs/platform/state/node/stateService.ts index d5146ec25ac..badf5115935 100644 --- a/src/vs/platform/state/node/stateService.ts +++ b/src/vs/platform/state/node/stateService.ts @@ -11,16 +11,16 @@ import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types'; import { IStateService } from 'vs/platform/state/node/state'; import { ILogService } from 'vs/platform/log/common/log'; -type StorageDatebase = { [key: string]: any; }; +type StorageDatabase = { [key: string]: any; }; export class FileStorage { - private _database: StorageDatebase | null = null; + private _database: StorageDatabase | null = null; private lastFlushedSerializedDatabase: string | null = null; constructor(private dbPath: string, private onError: (error: Error) => void) { } - private get database(): StorageDatebase { + private get database(): StorageDatabase { if (!this._database) { this._database = this.loadSync(); } @@ -42,7 +42,7 @@ export class FileStorage { this._database = database; } - private loadSync(): StorageDatebase { + private loadSync(): StorageDatabase { try { this.lastFlushedSerializedDatabase = fs.readFileSync(this.dbPath).toString(); @@ -56,7 +56,7 @@ export class FileStorage { } } - private async loadAsync(): Promise { + private async loadAsync(): Promise { try { this.lastFlushedSerializedDatabase = (await readFile(this.dbPath)).toString(); From 70fb5c6c542d5f0af8511c6fabdbeccab57a16f1 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Wed, 11 Dec 2019 16:24:07 -0800 Subject: [PATCH 360/637] Show warning when filing issue report on extension that does not have a GitHub bugs/repository url, fixes #73515 --- .../issue/issueReporterMain.ts | 113 +++++++++++++----- .../issue/issueReporterPage.ts | 7 +- 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts index cbb2e5c5269..cc60334760f 100644 --- a/src/vs/code/electron-browser/issue/issueReporterMain.ts +++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts @@ -3,43 +3,43 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import 'vs/css!./media/issueReporter'; -import { shell, ipcRenderer, webFrame, clipboard } from 'electron'; -import { localize } from 'vs/nls'; -import { $ } from 'vs/base/browser/dom'; -import * as collections from 'vs/base/common/collections'; -import * as browser from 'vs/base/browser/browser'; -import { escape } from 'vs/base/common/strings'; -import product from 'vs/platform/product/common/product'; +import { clipboard, ipcRenderer, shell, webFrame } from 'electron'; import * as os from 'os'; +import * as browser from 'vs/base/browser/browser'; +import { $ } from 'vs/base/browser/dom'; +import { Button } from 'vs/base/browser/ui/button/button'; +import { CodiconLabel } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; +import * as collections from 'vs/base/common/collections'; import { debounce } from 'vs/base/common/decorators'; -import * as platform from 'vs/base/common/platform'; import { Disposable } from 'vs/base/common/lifecycle'; +import * as platform from 'vs/base/common/platform'; +import { escape } from 'vs/base/common/strings'; import { getDelayedChannel } from 'vs/base/parts/ipc/common/ipc'; import { createChannelSender } from 'vs/base/parts/ipc/node/ipc'; import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net'; -import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; -import { NullTelemetryService, combinedAppender, LogAppender } from 'vs/platform/telemetry/common/telemetryUtils'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; -import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; -import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; -import { MainProcessService, IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; -import { IssueReporterModel, IssueReporterData as IssueReporterModelData } from 'vs/code/electron-browser/issue/issueReporterModel'; -import { IssueReporterData, IssueReporterStyles, IssueType, ISettingsSearchIssueReporterData, IssueReporterFeatures, IssueReporterExtensionData } from 'vs/platform/issue/node/issue'; -import BaseHtml from 'vs/code/electron-browser/issue/issueReporterPage'; -import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc'; -import { ILogService, getLogLevel } from 'vs/platform/log/common/log'; -import { CodiconLabel } from 'vs/base/browser/ui/codiconLabel/codiconLabel'; import { normalizeGitHubUrl } from 'vs/code/common/issue/issueReporterUtil'; -import { Button } from 'vs/base/browser/ui/button/button'; -import { SystemInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; -import { SpdLogService } from 'vs/platform/log/node/spdlogService'; +import { IssueReporterData as IssueReporterModelData, IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel'; +import BaseHtml from 'vs/code/electron-browser/issue/issueReporterPage'; +import 'vs/css!./media/issueReporter'; +import { localize } from 'vs/nls'; +import { isRemoteDiagnosticError, SystemInfo } from 'vs/platform/diagnostics/common/diagnostics'; +import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; +import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; +import { IMainProcessService, MainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService'; import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; +import { ISettingsSearchIssueReporterData, IssueReporterData, IssueReporterExtensionData, IssueReporterFeatures, IssueReporterStyles, IssueType } from 'vs/platform/issue/node/issue'; +import { getLogLevel, ILogService } from 'vs/platform/log/common/log'; +import { FollowerLogService, LoggerChannelClient } from 'vs/platform/log/common/logIpc'; +import { SpdLogService } from 'vs/platform/log/node/spdlogService'; +import product from 'vs/platform/product/common/product'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; +import { combinedAppender, LogAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; +import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; +import { TelemetryAppenderClient } from 'vs/platform/telemetry/node/telemetryIpc'; +import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; const MAX_URL_LENGTH = 2045; @@ -226,7 +226,7 @@ export class IssueReporter extends Disposable { } if (styles.buttonHoverBackground) { - content.push(`.monaco-text-button:hover, .monaco-text-button:focus { background-color: ${styles.buttonHoverBackground} !important; }`); + content.push(`.monaco-text-button:not(.disabled):hover, .monaco-text-button:focus { background-color: ${styles.buttonHoverBackground} !important; }`); } styleTag.innerHTML = content.join('\n'); @@ -432,6 +432,11 @@ export class IssueReporter extends Disposable { sendWorkbenchCommand('workbench.action.reloadWindowWithExtensionsDisabled'); }); + this.addEventListener('extensionBugsLink', 'click', (e: MouseEvent) => { + const url = (e.target).innerText; + shell.openExternal(url); + }); + this.addEventListener('disableExtensions', 'keydown', (e: Event) => { e.stopPropagation(); if ((e as KeyboardEvent).keyCode === 13 || (e as KeyboardEvent).keyCode === 32) { @@ -1028,15 +1033,63 @@ export class IssueReporter extends Disposable { const matches = extensions.filter(extension => extension.id === selectedExtensionId); if (matches.length) { this.issueReporterModel.update({ selectedExtension: matches[0] }); + this.validateSelectedExtension(); const title = (this.getElementById('issue-title')).value; this.searchExtensionIssues(title); } else { this.issueReporterModel.update({ selectedExtension: undefined }); this.clearSearchResults(); + this.validateSelectedExtension(); } }); } + + this.addEventListener('problem-source', 'change', (_) => { + this.validateSelectedExtension(); + }); + } + + private validateSelectedExtension(): void { + const extensionValidationMessage = this.getElementById('extension-selection-validation-error')!; + const extensionValidationNoUrlsMessage = this.getElementById('extension-selection-validation-error-no-url')!; + hide(extensionValidationMessage); + hide(extensionValidationNoUrlsMessage); + + if (!this.issueReporterModel.getData().selectedExtension) { + this.previewButton.enabled = true; + return; + } + + const hasValidGitHubUrl = this.getExtensionGitHubUrl(); + if (hasValidGitHubUrl) { + this.previewButton.enabled = true; + } else { + this.setExtensionValidationMessage(); + this.previewButton.enabled = false; + } + } + + private setExtensionValidationMessage(): void { + const extensionValidationMessage = this.getElementById('extension-selection-validation-error')!; + const extensionValidationNoUrlsMessage = this.getElementById('extension-selection-validation-error-no-url')!; + const bugsUrl = this.getExtensionBugsUrl(); + if (bugsUrl) { + show(extensionValidationMessage); + const link = this.getElementById('extensionBugsLink')!; + link.textContent = bugsUrl; + return; + } + + const extensionUrl = this.getExtensionRepositoryUrl(); + if (extensionUrl) { + show(extensionValidationMessage); + const link = this.getElementById('extensionBugsLink'); + link!.textContent = extensionUrl; + return; + } + + show(extensionValidationNoUrlsMessage); } private updateProcessInfo(state: IssueReporterModelData) { diff --git a/src/vs/code/electron-browser/issue/issueReporterPage.ts b/src/vs/code/electron-browser/issue/issueReporterPage.ts index 63f42d9b960..0b027996986 100644 --- a/src/vs/code/electron-browser/issue/issueReporterPage.ts +++ b/src/vs/code/electron-browser/issue/issueReporterPage.ts @@ -32,6 +32,11 @@ export default (): string => ` + + @@ -124,4 +129,4 @@ export default (): string => ` -`; \ No newline at end of file +`; From 542b0145b3244f3a24b662240574d7b57fc3a4d7 Mon Sep 17 00:00:00 2001 From: Jackson Kearl Date: Wed, 11 Dec 2019 16:31:05 -0800 Subject: [PATCH 361/637] Dim the line numbers of context results --- extensions/search-result/src/extension.ts | 43 ++++++++++++++++--- .../theme-defaults/themes/hc_black.json | 7 +++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index 0c5c85bfe60..0bd5e12188e 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -13,8 +13,26 @@ const DIRECTIVES = ['# Query:', '# Flags:', '# Including:', '# Excluding:', '# C const FLAGS = ['RegExp', 'CaseSensitive', 'IgnoreExcludeSettings', 'WordMatch']; let cachedLastParse: { version: number, parse: ParsedSearchResults, uri: vscode.Uri } | undefined; +let documentChangeListener: vscode.Disposable | undefined; + export function activate(context: vscode.ExtensionContext) { + + const contextLineDecorations = vscode.window.createTextEditorDecorationType({ opacity: '0.7' }); + const matchLineDecorations = vscode.window.createTextEditorDecorationType({ fontWeight: 'bold' }); + + const decorate = (editor: vscode.TextEditor) => { + const parsed = parseSearchResults(editor.document).filter(isResultLine); + const contextRanges = parsed.filter(line => line.isContext).map(line => line.prefixRange); + const matchRanges = parsed.filter(line => !line.isContext).map(line => line.prefixRange); + editor.setDecorations(contextLineDecorations, contextRanges); + editor.setDecorations(matchLineDecorations, matchRanges); + }; + + if (vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.languageId === 'search-result') { + decorate(vscode.window.activeTextEditor); + } + context.subscriptions.push( vscode.commands.registerCommand('searchResult.rerunSearch', () => vscode.commands.executeCommand('search.action.rerunEditorSearch')), vscode.commands.registerCommand('searchResult.rerunSearchWithContext', () => vscode.commands.executeCommand('search.action.rerunEditorSearchWithContext')), @@ -84,15 +102,24 @@ export function activate(context: vscode.ExtensionContext) { } }), - vscode.window.onDidChangeActiveTextEditor(e => { - if (e?.document.languageId === 'search-result') { + vscode.window.onDidChangeActiveTextEditor(editor => { + if (editor?.document.languageId === 'search-result') { // Clear the parse whenever we open a new editor. // Conservative because things like the URI might remain constant even if the contents change, and re-parsing even large files is relatively fast. cachedLastParse = undefined; + + documentChangeListener?.dispose(); + documentChangeListener = vscode.workspace.onDidChangeTextDocument(doc => { + if (doc.document.uri === editor.document.uri) { + decorate(editor); + } + }); + + decorate(editor); } }), - { dispose() { cachedLastParse = undefined; } } + { dispose() { cachedLastParse = undefined; documentChangeListener?.dispose(); } } ); } @@ -129,12 +156,13 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u } type ParsedSearchFileLine = { type: 'file', location: vscode.LocationLink, allLocations: vscode.LocationLink[], path: string }; -type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink }; +type ParsedSearchResultLine = { type: 'result', location: vscode.LocationLink, isContext: boolean, prefixRange: vscode.Range }; type ParsedSearchResults = Array; const isFileLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchFileLine => line.type === 'file'; +const isResultLine = (line: ParsedSearchResultLine | ParsedSearchFileLine): line is ParsedSearchResultLine => line.type === 'result'; -function parseSearchResults(document: vscode.TextDocument, token: vscode.CancellationToken): ParsedSearchResults { +function parseSearchResults(document: vscode.TextDocument, token?: vscode.CancellationToken): ParsedSearchResults { if (cachedLastParse && cachedLastParse.uri === document.uri && cachedLastParse.version === document.version) { return cachedLastParse.parse; @@ -147,7 +175,8 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell let currentTargetLocations: vscode.LocationLink[] | undefined = undefined; for (let i = 0; i < lines.length; i++) { - if (token.isCancellationRequested) { return []; } + // TODO: This is probably always false, given we're pegging the thread... + if (token?.isCancellationRequested) { return []; } const line = lines[i]; const fileLine = FILE_LINE_REGEX.exec(line); @@ -186,7 +215,7 @@ function parseSearchResults(document: vscode.TextDocument, token: vscode.Cancell currentTargetLocations?.push(location); - links[i] = { type: 'result', location }; + links[i] = { type: 'result', location, isContext: seperator === ' ', prefixRange: new vscode.Range(i, 0, i, metadataOffset) }; } } diff --git a/extensions/theme-defaults/themes/hc_black.json b/extensions/theme-defaults/themes/hc_black.json index f76d7bb960f..73309c34b44 100644 --- a/extensions/theme-defaults/themes/hc_black.json +++ b/extensions/theme-defaults/themes/hc_black.json @@ -114,6 +114,13 @@ "settings": { "foreground": "#CE9178" } + }, + { + "name": "HC Search Editor context line override", + "scope": "meta.resultLinePrefix.contextLinePrefix.search", + "settings": { + "foreground": "#CBEDCB", + } } ] } From ba2524065b199509f40eaff1cfe20ed9f9725751 Mon Sep 17 00:00:00 2001 From: Andrii Dieiev Date: Thu, 12 Dec 2019 02:48:13 +0200 Subject: [PATCH 362/637] Debounce on type history entries for "files to include/exclude" fields --- .../contrib/search/browser/patternInputWidget.ts | 1 + src/vs/workbench/contrib/search/browser/searchView.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/patternInputWidget.ts b/src/vs/workbench/contrib/search/browser/patternInputWidget.ts index b5502c58cf9..8b34c22cea7 100644 --- a/src/vs/workbench/contrib/search/browser/patternInputWidget.ts +++ b/src/vs/workbench/contrib/search/browser/patternInputWidget.ts @@ -164,6 +164,7 @@ export class PatternInputWidget extends Widget { private onInputKeyUp(keyboardEvent: IKeyboardEvent) { switch (keyboardEvent.keyCode) { case KeyCode.Enter: + this.onSearchSubmit(); this.searchOnTypeDelayer.trigger(() => this._onSubmit.fire(false), 0); return; case KeyCode.Escape: diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 123329082c9..1540549709e 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1286,9 +1286,11 @@ export class SearchView extends ViewPane { } private onQueryTriggered(query: ITextQuery, options: ITextQueryBuilderOptions, excludePatternText: string, includePatternText: string, triggeredOnType: boolean): void { - this.addToSearchHistoryDelayer.trigger(() => this.searchWidget.searchInput.onSearchSubmit()); - this.inputPatternExcludes.onSearchSubmit(); - this.inputPatternIncludes.onSearchSubmit(); + this.addToSearchHistoryDelayer.trigger(() => { + this.searchWidget.searchInput.onSearchSubmit(); + this.inputPatternExcludes.onSearchSubmit(); + this.inputPatternIncludes.onSearchSubmit(); + }); this.viewModel.cancelSearch(); From a4177f50c475fc0fa278a78235e3bee9ffdec781 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 11 Dec 2019 20:15:07 -0800 Subject: [PATCH 363/637] Use object for `refactor.disabled` For #85160 Using an object is more explict with property names and will let us introduce additional properties in the future if needed --- .../src/features/refactor.ts | 4 +++- src/vs/vscode.proposed.d.ts | 12 +++++++++--- .../workbench/api/common/extHostLanguageFeatures.ts | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/extensions/typescript-language-features/src/features/refactor.ts b/extensions/typescript-language-features/src/features/refactor.ts index a6ed687fbc2..3ccb5969913 100644 --- a/extensions/typescript-language-features/src/features/refactor.ts +++ b/extensions/typescript-language-features/src/features/refactor.ts @@ -314,7 +314,9 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider { private appendInvalidActions(actions: vscode.CodeAction[]): vscode.CodeAction[] { if (!actions.some(action => action.kind && Extract_Constant.kind.contains(action.kind))) { const disabledAction = new vscode.CodeAction('Extract to constant', Extract_Constant.kind); - disabledAction.disabled = localize('extract.disabled', "The current selection cannot be extracted"); + disabledAction.disabled = { + reason: localize('extract.disabled', "The current selection cannot be extracted"), + }; disabledAction.isPreferred = true; actions.push(disabledAction); } diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 09a9d256f0f..36683346748 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1331,10 +1331,16 @@ declare module 'vscode' { /** * Marks that the code action cannot currently be applied. * - * This should be a human readable description of why the code action is currently disabled. Disabled code actions - * will be surfaced in the refactor UI but cannot be applied. + * Disabled code actions will be surfaced in the refactor UI but cannot be applied. */ - disabled?: string; + disabled?: { + /** + * Human readable description of why the code action is currently disabled. + * + * This is displayed in the UI. + */ + reason: string; + }; } //#endregion diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index bd569e64b04..a9482c1616c 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -389,7 +389,7 @@ class CodeActionAdapter { edit: candidate.edit && typeConvert.WorkspaceEdit.from(candidate.edit), kind: candidate.kind && candidate.kind.value, isPreferred: candidate.isPreferred, - disabled: candidate.disabled + disabled: candidate.disabled?.reason }); } } From cc1ba3c0215af60ad3574baaa3223c9f1875d964 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 12 Dec 2019 07:12:58 +0100 Subject: [PATCH 364/637] add tracing for #86771 --- src/vs/code/electron-main/window.ts | 9 +++++++++ .../platform/windows/electron-main/windowsMainService.ts | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 38c4a8e1140..01eee8e6688 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -114,6 +114,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { // Load window state const [state, hasMultipleDisplays] = this.restoreWindowState(config.state); this.windowState = state; + this.logService.trace('window#ctor: using window state', state); // in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below) const isFullscreenOrMaximized = (this.windowState.mode === WindowMode.Maximized || this.windowState.mode === WindowMode.Fullscreen); @@ -782,10 +783,12 @@ export class CodeWindow extends Disposable implements ICodeWindow { || typeof state.width !== 'number' || typeof state.height !== 'number' ) { + this.logService.trace('window#validateWindowState: unexpected type of state values'); return undefined; } if (state.width <= 0 || state.height <= 0) { + this.logService.trace('window#validateWindowState: unexpected negative values'); return undefined; } @@ -793,6 +796,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { if (displays.length === 1) { const displayWorkingArea = this.getWorkingArea(displays[0]); if (displayWorkingArea) { + this.logService.trace('window#validateWindowState: 1 display', displayWorkingArea); + if (state.x < displayWorkingArea.x) { state.x = displayWorkingArea.x; // prevent window from falling out of the screen to the left } @@ -825,6 +830,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { if (state.display && state.mode === WindowMode.Fullscreen) { const display = displays.filter(d => d.id === state.display)[0]; if (display && typeof display.bounds?.x === 'number' && typeof display.bounds?.y === 'number') { + this.logService.trace('window#validateWindowState: restoring fullscreen to previous display'); + const defaults = defaultWindowState(WindowMode.Fullscreen); // make sure we have good values when the user restores the window defaults.x = display.bounds.x; // carefull to use displays x/y position so that the window ends up on the correct monitor defaults.y = display.bounds.y; @@ -845,6 +852,8 @@ export class CodeWindow extends Disposable implements ICodeWindow { bounds.x + bounds.width > displayWorkingArea.x && // prevent window from falling out of the screen to the left bounds.y + bounds.height > displayWorkingArea.y // prevent window from falling out of the scree nto the top ) { + this.logService.trace('window#validateWindowState: multi display', displayWorkingArea); + return state; } diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts index 8c588ca9a2a..101dd334ad3 100644 --- a/src/vs/platform/windows/electron-main/windowsMainService.ts +++ b/src/vs/platform/windows/electron-main/windowsMainService.ts @@ -326,7 +326,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic } // Persist - this.stateService.setItem(WindowsMainService.windowsStateStorageKey, getWindowsStateStoreData(currentWindowsState)); + const state = getWindowsStateStoreData(currentWindowsState); + this.logService.trace('onBeforeShutdown', state); + this.stateService.setItem(WindowsMainService.windowsStateStorageKey, state); } // See note on #onBeforeShutdown() for details how these events are flowing From 101335eaf0ff3a15ad38732323df637efb5f9bb3 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 12 Dec 2019 08:57:52 +0100 Subject: [PATCH 365/637] Editors: mru list in editor group not ideal when opening inactive editors (fix #86801) --- src/vs/workbench/common/editor/editorGroup.ts | 16 ++++++++-- .../test/common/editor/editorGroups.test.ts | 30 +++++++++---------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index b929d86881d..27cee4afde0 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -486,7 +486,19 @@ export class EditorGroup extends Disposable { // Add if (!del && editor) { - this.mru.push(editor); // make it LRU editor + if (this.mru.length === 0) { + // the list of most recent editors is empty + // so this editor can only be the most recent + this.mru.push(editor); + } else { + // we have most recent editors. as such we + // put this newly opened editor right after + // the current most recent one because it cannot + // be the most recently active one unless + // it becomes active. but it is still more + // active then any other editor in the list. + this.mru.splice(1, 0, editor); + } } // Remove / Replace @@ -546,7 +558,7 @@ export class EditorGroup extends Disposable { // Remove old index this.mru.splice(mruIndex, 1); - // Set editor to front + // Set editor as most recent one (first) this.mru.unshift(editor); } diff --git a/src/vs/workbench/test/common/editor/editorGroups.test.ts b/src/vs/workbench/test/common/editor/editorGroups.test.ts index 6cacfb90746..aa3b4d2f7ce 100644 --- a/src/vs/workbench/test/common/editor/editorGroups.test.ts +++ b/src/vs/workbench/test/common/editor/editorGroups.test.ts @@ -521,8 +521,8 @@ suite('Workbench editor groups', () => { const mru = group.getEditors(true); assert.equal(mru[0], input1); - assert.equal(mru[1], input2); - assert.equal(mru[2], input3); + assert.equal(mru[1], input3); + assert.equal(mru[2], input2); }); test('Multiple Editors - Preview gets overwritten', function () { @@ -1115,12 +1115,12 @@ suite('Workbench editor groups', () => { assert.equal(group2.previewEditor!.matches(g2_input2), true); assert.equal(group1.getEditors(true)[0].matches(g1_input2), true); - assert.equal(group1.getEditors(true)[1].matches(g1_input1), true); - assert.equal(group1.getEditors(true)[2].matches(g1_input3), true); + assert.equal(group1.getEditors(true)[1].matches(g1_input3), true); + assert.equal(group1.getEditors(true)[2].matches(g1_input1), true); assert.equal(group2.getEditors(true)[0].matches(g2_input1), true); - assert.equal(group2.getEditors(true)[1].matches(g2_input2), true); - assert.equal(group2.getEditors(true)[2].matches(g2_input3), true); + assert.equal(group2.getEditors(true)[1].matches(g2_input3), true); + assert.equal(group2.getEditors(true)[2].matches(g2_input2), true); // Create model again - should load from storage group1 = inst.createInstance(EditorGroup, group1.serialize()); @@ -1134,12 +1134,12 @@ suite('Workbench editor groups', () => { assert.equal(group2.previewEditor!.matches(g2_input2), true); assert.equal(group1.getEditors(true)[0].matches(g1_input2), true); - assert.equal(group1.getEditors(true)[1].matches(g1_input1), true); - assert.equal(group1.getEditors(true)[2].matches(g1_input3), true); + assert.equal(group1.getEditors(true)[1].matches(g1_input3), true); + assert.equal(group1.getEditors(true)[2].matches(g1_input1), true); assert.equal(group2.getEditors(true)[0].matches(g2_input1), true); - assert.equal(group2.getEditors(true)[1].matches(g2_input2), true); - assert.equal(group2.getEditors(true)[2].matches(g2_input3), true); + assert.equal(group2.getEditors(true)[1].matches(g2_input3), true); + assert.equal(group2.getEditors(true)[2].matches(g2_input2), true); }); test('Single group, multiple editors - persist (some not persistable)', function () { @@ -1172,18 +1172,18 @@ suite('Workbench editor groups', () => { assert.equal(group.previewEditor!.matches(nonSerializableInput2), true); assert.equal(group.getEditors(true)[0].matches(nonSerializableInput2), true); - assert.equal(group.getEditors(true)[1].matches(serializableInput1), true); - assert.equal(group.getEditors(true)[2].matches(serializableInput2), true); + assert.equal(group.getEditors(true)[1].matches(serializableInput2), true); + assert.equal(group.getEditors(true)[2].matches(serializableInput1), true); // Create model again - should load from storage group = inst.createInstance(EditorGroup, group.serialize()); assert.equal(group.count, 2); - assert.equal(group.activeEditor!.matches(serializableInput1), true); + assert.equal(group.activeEditor!.matches(serializableInput2), true); assert.equal(group.previewEditor, null); - assert.equal(group.getEditors(true)[0].matches(serializableInput1), true); - assert.equal(group.getEditors(true)[1].matches(serializableInput2), true); + assert.equal(group.getEditors(true)[0].matches(serializableInput2), true); + assert.equal(group.getEditors(true)[1].matches(serializableInput1), true); }); test('Multiple groups, multiple editors - persist (some not persistable, causes empty group)', function () { From 2cbd162c66150797066a88ba6283abf8827deb37 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 12 Dec 2019 09:16:59 +0100 Subject: [PATCH 366/637] remove inspectValue and use inspect Add override information to inspect --- .../services/resourceConfigurationImpl.ts | 98 ++++++------ .../standalone/browser/simpleServices.ts | 12 +- .../resourceConfigurationService.test.ts | 141 +++++++----------- .../configuration/common/configuration.ts | 51 +++---- .../common/configurationModels.ts | 91 ++++------- .../node/configurationService.ts | 12 +- .../test/common/configurationModels.test.ts | 30 ++-- .../test/common/testConfigurationService.ts | 28 +--- .../test/node/configurationService.test.ts | 20 +-- .../api/common/extHostConfiguration.ts | 8 +- src/vs/workbench/browser/layout.ts | 2 +- .../browser/parts/editor/editorStatus.ts | 4 +- .../browser/debugConfigurationManager.ts | 6 +- .../extensions/browser/extensionsActions.ts | 4 +- .../preferences/browser/settingsEditor2.ts | 2 +- .../preferences/browser/settingsTreeModels.ts | 23 +-- .../tasks/browser/abstractTaskService.ts | 6 +- .../terminal/browser/terminalConfigHelper.ts | 18 +-- .../terminal/common/terminalEnvironment.ts | 8 +- .../themes/browser/themes.contribution.ts | 4 +- .../welcome/page/browser/welcomePage.ts | 2 +- .../browser/configurationService.ts | 21 +-- .../common/configurationModels.ts | 15 +- .../configurationService.test.ts | 76 +++++----- .../common/filesConfigurationService.ts | 4 +- .../themes/browser/workbenchThemeService.ts | 10 +- .../abstractWorkspaceEditingService.ts | 2 +- 27 files changed, 273 insertions(+), 425 deletions(-) diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts index 09cdbea7b0f..c2d013b7ccd 100644 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ b/src/vs/editor/common/services/resourceConfigurationImpl.ts @@ -10,7 +10,7 @@ import { IPosition, Position } from 'vs/editor/common/core/position'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; -import { IConfigurationChangeEvent, IConfigurationService, ConfigurationTarget, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationChangeEvent, IConfigurationService, ConfigurationTarget, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService { @@ -37,63 +37,67 @@ export class TextResourceConfigurationService extends Disposable implements ITex return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined); } - updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { + updateValue(resource: URI, key: string, value: any, configurationTarget?: ConfigurationTarget): Promise { const language = this.getLanguage(resource, null); - - if (!language) { - if (configurationTarget !== undefined) { - return this.configurationService.updateValue(key, value, configurationTarget); - } - return this.configurationService.updateValue(key, value); + const configurationValue = this.configurationService.inspect(key, { resource, overrideIdentifier: language }); + if (configurationTarget === undefined) { + configurationTarget = this.deriveConfigurationTarget(configurationValue, language); } - - const configurationValue = this.configurationService.inspectValue(key); - - if (configurationTarget !== undefined) { - switch (configurationTarget) { - case ConfigurationTarget.MEMORY: - return this.configurationService.updateValue(key, value, configurationTarget); - case ConfigurationTarget.WORKSPACE_FOLDER: - return this._updateValue(key, value, configurationTarget, configurationValue.getWorkspaceFolderValue(resource), resource, language); - case ConfigurationTarget.WORKSPACE: - return this._updateValue(key, value, configurationTarget, configurationValue.workspace, resource, language); - case ConfigurationTarget.USER_REMOTE: - return this._updateValue(key, value, configurationTarget, configurationValue.userRemote, resource, language); - case ConfigurationTarget.USER_LOCAL: - case ConfigurationTarget.USER: - return this._updateValue(key, value, configurationTarget, configurationValue.userLocal, resource, language); - } + switch (configurationTarget) { + case ConfigurationTarget.MEMORY: + return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language); + case ConfigurationTarget.WORKSPACE_FOLDER: + return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language); + case ConfigurationTarget.WORKSPACE: + return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language); + case ConfigurationTarget.USER_REMOTE: + return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language); + default: + return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language); } - - if (configurationValue.workspaceFolders) { - const workspaceFolderValue = configurationValue.getWorkspaceFolderValue(resource); - if (workspaceFolderValue) { - return this._updateValue(key, value, ConfigurationTarget.WORKSPACE_FOLDER, workspaceFolderValue, resource, language); - } - } - - if (configurationValue.workspace) { - return this._updateValue(key, value, ConfigurationTarget.WORKSPACE, configurationValue.workspace, resource, language); - } - - if (configurationValue.userRemote) { - return this._updateValue(key, value, ConfigurationTarget.USER_REMOTE, configurationValue.userRemote, resource, language); - } - - return this._updateValue(key, value, ConfigurationTarget.USER_LOCAL, configurationValue.userLocal, resource, language); } - private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, configurationTargetValue: IConfigurationTargetValue | undefined, resource: URI, language: string): Promise { - if (!configurationTargetValue) { - return this.configurationService.updateValue(key, value, configurationTarget); - } - if (configurationTargetValue.overrides.some(({ overrideIdentifier }) => overrideIdentifier === language)) { + private _updateValue(key: string, value: any, configurationTarget: ConfigurationTarget, overriddenValue: any | undefined, resource: URI, language: string | null): Promise { + if (language && overriddenValue !== undefined) { return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget); } else { return this.configurationService.updateValue(key, value, { resource }, configurationTarget); } } + private deriveConfigurationTarget(configurationValue: IConfigurationValue, language: string | null): ConfigurationTarget { + if (language) { + if (configurationValue.memory?.override !== undefined) { + return ConfigurationTarget.MEMORY; + } + if (configurationValue.workspaceFolder?.override !== undefined) { + return ConfigurationTarget.WORKSPACE_FOLDER; + } + if (configurationValue.workspace?.override !== undefined) { + return ConfigurationTarget.WORKSPACE; + } + if (configurationValue.userRemote?.override !== undefined) { + return ConfigurationTarget.USER_REMOTE; + } + if (configurationValue.userLocal?.override !== undefined) { + return ConfigurationTarget.USER_LOCAL; + } + } + if (configurationValue.memory?.value !== undefined) { + return ConfigurationTarget.MEMORY; + } + if (configurationValue.workspaceFolder?.value !== undefined) { + return ConfigurationTarget.WORKSPACE_FOLDER; + } + if (configurationValue.workspace?.value !== undefined) { + return ConfigurationTarget.WORKSPACE; + } + if (configurationValue.userRemote?.value !== undefined) { + return ConfigurationTarget.USER_REMOTE; + } + return ConfigurationTarget.USER_LOCAL; + } + private _getValue(resource: URI, position: IPosition | null, section: string | undefined): T { const language = resource ? this.getLanguage(resource, position) : undefined; if (typeof section === 'undefined') { diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index e9be9f21df7..3c102ff62af 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -460,17 +460,7 @@ export class SimpleConfigurationService implements IConfigurationService { return Promise.resolve(); } - public inspectValue(key: string): IConfigurationValue { - return this.configuration().inspectValue(key, undefined); - } - - public inspect(key: string, options: IConfigurationOverrides = {}): { - default: C, - user: C, - workspace?: C, - workspaceFolder?: C - value: C, - } { + public inspect(key: string, options: IConfigurationOverrides = {}): IConfigurationValue { return this.configuration().inspect(key, options, undefined); } diff --git a/src/vs/editor/test/common/services/resourceConfigurationService.test.ts b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts index 241acf9dc8f..740970888f3 100644 --- a/src/vs/editor/test/common/services/resourceConfigurationService.test.ts +++ b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts @@ -18,7 +18,7 @@ suite('TextResourceConfigurationService - Update', () => { let configurationValue: IConfigurationValue; let updateArgs: any[]; let configurationService = new class extends TestConfigurationService { - inspectValue(key: string) { + inspect() { return configurationValue; } updateValue() { @@ -50,12 +50,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given memory target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceFolderValue: '2' }; const resource = URI.file('someFile'); @@ -66,12 +63,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given workspace target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceFolderValue: '2' }; const resource = URI.file('someFile'); @@ -82,12 +76,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given user target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'b', value: '1' }] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceFolderValue: '2' }; const resource = URI.file('someFile'); @@ -98,12 +89,10 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given workspace folder target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'a', value: '1' }] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceFolderValue: '2', + workspaceFolderOverridden: '1' }; const resource = URI.file('someFile'); @@ -114,12 +103,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace folder target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceFolderValue: '2', }; const resource = URI.file('someFile'); @@ -130,12 +116,12 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace folder target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, - workspaceFolders: [], - getWorkspaceFolderValue() { return { value: '2', overrides: [{ overrideIdentifier: 'a', value: '1' }] }; }, + defaultValue: '1', + userLocalValue: '2', + workspaceValue: '2', + workspaceFolderValue: '2', + workspaceOverridden: '3', + workspaceFolderOverridden: '1' }; const resource = URI.file('someFile'); @@ -146,12 +132,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: { value: '2', overrides: [{ overrideIdentifier: 'c', value: '3' }] }, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + workspaceValue: '2', }; const resource = URI.file('someFile'); @@ -162,12 +145,10 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: undefined, - workspace: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + workspaceValue: '2', + workspaceOverridden: 3 }; const resource = URI.file('someFile'); @@ -178,12 +159,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: { value: '3', overrides: [] }, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + userRemoteValue: '3', }; const resource = URI.file('someFile'); @@ -194,12 +172,10 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: { value: '3', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + userRemoteValue: '3', + userRemoteOverridden: '3', }; const resource = URI.file('someFile'); @@ -209,12 +185,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: { value: '3', overrides: [] }, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + userRemoteValue: '3', }; const resource = URI.file('someFile'); @@ -225,12 +198,10 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [] }, - userRemote: { value: '3', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + userRemoteValue: '3', + userRemoteOverridden: '3', }; const resource = URI.file('someFile'); @@ -241,12 +212,8 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user target without overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [{ overrideIdentifier: 'b', value: '3' }] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', }; const resource = URI.file('someFile'); @@ -257,12 +224,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user target with overrides', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: { value: '2', overrides: [{ overrideIdentifier: 'a', value: '3' }] }, - userRemote: undefined, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', + userLocalValue: '2', + userLocalOverridden: '3' }; const resource = URI.file('someFile'); @@ -273,12 +237,7 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue when not changed', async () => { language = 'a'; configurationValue = { - default: { value: '1', overrides: [] }, - userLocal: undefined, - userRemote: undefined, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; }, + defaultValue: '1', }; const resource = URI.file('someFile'); diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 6aa0c506c8c..64ad58f18af 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -63,18 +63,24 @@ export interface IConfigurationChangeEvent { changedConfigurationByResource: ResourceMap; } -export interface IConfigurationTargetValue { - value: T | undefined; - overrides: { overrideIdentifier: string, value: T }[]; -} - export interface IConfigurationValue { - default: IConfigurationTargetValue | undefined; - userLocal: IConfigurationTargetValue | undefined; - userRemote: IConfigurationTargetValue | undefined; - workspace: IConfigurationTargetValue | undefined; - workspaceFolders: [IWorkspaceFolder, IConfigurationTargetValue][] | undefined; - getWorkspaceFolderValue(resource: URI): IConfigurationTargetValue | undefined; + + readonly defaultValue?: T; + readonly userValue?: T; + readonly userLocalValue?: T; + readonly userRemoteValue?: T; + readonly workspaceValue?: T; + readonly workspaceFolderValue?: T; + readonly memoryValue?: T; + readonly value?: T; + + readonly default?: { value?: T, override?: T }; + readonly user?: { value?: T, override?: T }; + readonly userLocal?: { value?: T, override?: T }; + readonly userRemote?: { value?: T, override?: T }; + readonly workspace?: { value?: T, override?: T }; + readonly workspaceFolder?: { value?: T, override?: T }; + readonly memory?: { value?: T, override?: T }; } export interface IConfigurationService { @@ -102,21 +108,10 @@ export interface IConfigurationService { updateValue(key: string, value: any, target: ConfigurationTarget): Promise; updateValue(key: string, value: any, overrides: IConfigurationOverrides, target: ConfigurationTarget, donotNotifyError?: boolean): Promise; - inspectValue(key: string): IConfigurationValue; + inspect(key: string, overrides?: IConfigurationOverrides): IConfigurationValue; reloadConfiguration(folder?: IWorkspaceFolder): Promise; - inspect(key: string, overrides?: IConfigurationOverrides): { - default: T, - user: T, - userLocal?: T, - userRemote?: T, - workspace?: T, - workspaceFolder?: T, - memory?: T, - value: T, - }; - keys(): { default: string[]; user: string[]; @@ -362,11 +357,11 @@ export function getMigratedSettingValue(configurationService: IConfigurationS const setting = configurationService.inspect(currentSettingName); const legacySetting = configurationService.inspect(legacySettingName); - if (typeof setting.user !== 'undefined' || typeof setting.workspace !== 'undefined' || typeof setting.workspaceFolder !== 'undefined') { - return setting.value; - } else if (typeof legacySetting.user !== 'undefined' || typeof legacySetting.workspace !== 'undefined' || typeof legacySetting.workspaceFolder !== 'undefined') { - return legacySetting.value; + if (typeof setting.userValue !== 'undefined' || typeof setting.workspaceValue !== 'undefined' || typeof setting.workspaceFolderValue !== 'undefined') { + return setting.value!; + } else if (typeof legacySetting.userValue !== 'undefined' || typeof legacySetting.workspaceValue !== 'undefined' || typeof legacySetting.workspaceFolderValue !== 'undefined') { + return legacySetting.value!; } else { - return setting.default; + return setting.defaultValue!; } } diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index be4d11e757a..fd2a7e4f20b 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -10,8 +10,8 @@ import * as types from 'vs/base/common/types'; import * as objects from 'vs/base/common/objects'; import { URI, UriComponents } from 'vs/base/common/uri'; import { OVERRIDE_PROPERTY_PATTERN, ConfigurationScope, IConfigurationRegistry, Extensions, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; -import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, IConfigurationChangeEvent, ConfigurationTarget, removeFromValueTree, toOverrides, IConfigurationValue, IConfigurationTargetValue } from 'vs/platform/configuration/common/configuration'; -import { Workspace, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; +import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, IConfigurationChangeEvent, ConfigurationTarget, removeFromValueTree, toOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; +import { Workspace } from 'vs/platform/workspace/common/workspace'; import { Registry } from 'vs/platform/registry/common/platform'; export class ConfigurationModel implements IConfigurationModel { @@ -369,70 +369,37 @@ export class Configuration { } } - inspectValue(key: string, workspace: Workspace | undefined): IConfigurationValue { - const defaultValue = this.getConfigurationTargetValue(key, this._defaultConfiguration.freeze()); - const userLocalValue = this.getConfigurationTargetValue(key, this.localUserConfiguration.freeze()); - const userRemoteValue = this.getConfigurationTargetValue(key, this.remoteUserConfiguration.freeze()); - const workspaceValue = this.getConfigurationTargetValue(key, this._workspaceConfiguration.freeze()); - const workspaceFolderValues: [IWorkspaceFolder, IConfigurationTargetValue][] = []; - if (workspace) { - for (const workspaceFolder of workspace.folders) { - const folderConfigurationModel = this.getFolderConfigurationModelForResource(workspaceFolder.uri, workspace); - if (folderConfigurationModel) { - const workspaceFolderValue = this.getConfigurationTargetValue(key, folderConfigurationModel.freeze()); - if (workspaceFolderValue) { - workspaceFolderValues.push([workspaceFolder, workspaceFolderValue]); - } - } - } - } - return { - default: defaultValue!, - userLocal: userLocalValue, - userRemote: userRemoteValue, - workspace: workspaceValue, - workspaceFolders: workspaceFolderValues.length ? workspaceFolderValues : undefined, - getWorkspaceFolderValue: (resource): IConfigurationTargetValue | undefined => { - const folderConfigurationModel = this.getFolderConfigurationModelForResource(resource, workspace); - return folderConfigurationModel ? this.getConfigurationTargetValue(key, folderConfigurationModel.freeze()) : undefined; - } - }; - } - - private getConfigurationTargetValue(key: string, configurationModel: ConfigurationModel): IConfigurationTargetValue | undefined { - const value = configurationModel.getValue(key); - const overrides: { overrideIdentifier: string, value: C }[] = []; - for (const { identifiers } of configurationModel.overrides) { - const value = configurationModel.getOverrideValue(key, identifiers[0]); - if (value !== undefined) { - overrides.push({ overrideIdentifier: identifiers[0], value }); - } - } - return value !== undefined || overrides.length > 0 ? { value, overrides } : undefined; - } - - inspect(key: string, overrides: IConfigurationOverrides, workspace: Workspace | undefined): { - default: C, - user: C, - userLocal?: C, - userRemote?: C, - workspace?: C, - workspaceFolder?: C - memory?: C - value: C, - } { + inspect(key: string, overrides: IConfigurationOverrides, workspace: Workspace | undefined): IConfigurationValue { const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace); const folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace); const memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration; + + const defaultValue = overrides.overrideIdentifier ? this._defaultConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._defaultConfiguration.freeze().getValue(key); + const userValue = overrides.overrideIdentifier ? this.userConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.userConfiguration.freeze().getValue(key); + const userLocalValue = overrides.overrideIdentifier ? this.localUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.localUserConfiguration.freeze().getValue(key); + const userRemoteValue = overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.remoteUserConfiguration.freeze().getValue(key); + const workspaceValue = workspace ? overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._workspaceConfiguration.freeze().getValue(key) : undefined; //Check on workspace exists or not because _workspaceConfiguration is never null + const workspaceFolderValue = folderConfigurationModel ? overrides.overrideIdentifier ? folderConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : folderConfigurationModel.freeze().getValue(key) : undefined; + const memoryValue = overrides.overrideIdentifier ? memoryConfigurationModel.override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.getValue(key); + const value = consolidateConfigurationModel.getValue(key); + return { - default: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._defaultConfiguration.freeze().getValue(key), - user: overrides.overrideIdentifier ? this.userConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.userConfiguration.freeze().getValue(key), - userLocal: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.localUserConfiguration.freeze().getValue(key), - userRemote: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.remoteUserConfiguration.freeze().getValue(key), - workspace: workspace ? overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._workspaceConfiguration.freeze().getValue(key) : undefined, //Check on workspace exists or not because _workspaceConfiguration is never null - workspaceFolder: folderConfigurationModel ? overrides.overrideIdentifier ? folderConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : folderConfigurationModel.freeze().getValue(key) : undefined, - memory: overrides.overrideIdentifier ? memoryConfigurationModel.override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.getValue(key), - value: consolidateConfigurationModel.getValue(key) + defaultValue, + userValue, + userLocalValue, + userRemoteValue, + workspaceValue, + workspaceFolderValue, + memoryValue, + value, + + default: defaultValue !== undefined ? { value: this._defaultConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + user: userValue !== undefined ? { value: this.userConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.userConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + userLocal: userLocalValue !== undefined ? { value: this.localUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + userRemote: userRemoteValue !== undefined ? { value: this.remoteUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + workspace: workspaceValue !== undefined ? { value: this._workspaceConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + workspaceFolder: workspaceFolderValue !== undefined ? { value: folderConfigurationModel?.freeze().getValue(key), override: overrides.overrideIdentifier ? folderConfigurationModel?.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + memory: memoryValue !== undefined ? { value: memoryConfigurationModel.getValue(key), override: overrides.overrideIdentifier ? memoryConfigurationModel.getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, }; } diff --git a/src/vs/platform/configuration/node/configurationService.ts b/src/vs/platform/configuration/node/configurationService.ts index a9f45eed478..ed6d2e88c3c 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -79,17 +79,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe return Promise.reject(new Error('not supported')); } - inspectValue(key: string): IConfigurationValue { - return this.configuration.inspectValue(key, undefined); - } - - inspect(key: string): { - default: T, - user: T, - workspace?: T, - workspaceFolder?: T - value: T - } { + inspect(key: string): IConfigurationValue { return this.configuration.inspect(key, {}, undefined); } diff --git a/src/vs/platform/configuration/test/common/configurationModels.test.ts b/src/vs/platform/configuration/test/common/configurationModels.test.ts index 5e52e61ef90..bf54767e4fd 100644 --- a/src/vs/platform/configuration/test/common/configurationModels.test.ts +++ b/src/vs/platform/configuration/test/common/configurationModels.test.ts @@ -103,7 +103,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration model for an existing identifier', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': 1 }, [], - [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } } }]); + [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } }, keys: ['a'] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1, 'd': 1 }, 'f': 1 }); }); @@ -111,7 +111,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration model for an identifier that does not exist', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': 1 }, [], - [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } } }]); + [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } }, keys: ['a'] }]); assert.deepEqual(testObject.override('xyz').contents, { 'a': { 'b': 1 }, 'f': 1 }); }); @@ -119,7 +119,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration when one of the keys does not exist in base', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': 1 }, [], - [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'g': 1 } }]); + [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'g': 1 }, keys: ['a', 'g'] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1, 'd': 1 }, 'f': 1, 'g': 1 }); }); @@ -127,7 +127,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration when one of the key in base is not of object type', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': 1 }, [], - [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'f': { 'g': 1 } } }]); + [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'f': { 'g': 1 } }, keys: ['a', 'f'] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1, 'd': 1 }, 'f': { 'g': 1 } }); }); @@ -135,7 +135,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration when one of the key in overriding contents is not of object type', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': { 'g': 1 } }, [], - [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'f': 1 } }]); + [{ identifiers: ['c'], contents: { 'a': { 'd': 1 }, 'f': 1 }, keys: ['a', 'f'] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1, 'd': 1 }, 'f': 1 }); }); @@ -143,7 +143,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration if the value of overriding identifier is not object', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': { 'g': 1 } }, [], - [{ identifiers: ['c'], contents: 'abc' }]); + [{ identifiers: ['c'], contents: 'abc', keys: [] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1 }, 'f': { 'g': 1 } }); }); @@ -151,7 +151,7 @@ suite('ConfigurationModel', () => { test('get overriding configuration if the value of overriding identifier is an empty object', () => { let testObject = new ConfigurationModel( { 'a': { 'b': 1 }, 'f': { 'g': 1 } }, [], - [{ identifiers: ['c'], contents: {} }]); + [{ identifiers: ['c'], contents: {}, keys: [] }]); assert.deepEqual(testObject.override('c').contents, { 'a': { 'b': 1 }, 'f': { 'g': 1 } }); }); @@ -176,8 +176,8 @@ suite('ConfigurationModel', () => { }); test('simple merge overrides', () => { - let base = new ConfigurationModel({ 'a': { 'b': 1 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': 2 } }]); - let add = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'b': 2 } }]); + let base = new ConfigurationModel({ 'a': { 'b': 1 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': 2 }, keys: ['a'] }]); + let add = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'b': 2 }, keys: ['b'] }]); let result = base.merge(add); assert.deepEqual(result.contents, { 'a': { 'b': 2 } }); @@ -187,8 +187,8 @@ suite('ConfigurationModel', () => { }); test('recursive merge overrides', () => { - let base = new ConfigurationModel({ 'a': { 'b': 1 }, 'f': 1 }, ['a.b', 'f'], [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } } }]); - let add = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': { 'e': 2 } } }]); + let base = new ConfigurationModel({ 'a': { 'b': 1 }, 'f': 1 }, ['a.b', 'f'], [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } }, keys: ['a'] }]); + let add = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': { 'e': 2 } }, keys: ['a'] }]); let result = base.merge(add); assert.deepEqual(result.contents, { 'a': { 'b': 2 }, 'f': 1 }); @@ -198,8 +198,8 @@ suite('ConfigurationModel', () => { }); test('merge overrides when frozen', () => { - let model1 = new ConfigurationModel({ 'a': { 'b': 1 }, 'f': 1 }, ['a.b', 'f'], [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } } }]).freeze(); - let model2 = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': { 'e': 2 } } }]).freeze(); + let model1 = new ConfigurationModel({ 'a': { 'b': 1 }, 'f': 1 }, ['a.b', 'f'], [{ identifiers: ['c'], contents: { 'a': { 'd': 1 } }, keys: ['a'] }]).freeze(); + let model2 = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b'], [{ identifiers: ['c'], contents: { 'a': { 'e': 2 } }, keys: ['a'] }]).freeze(); let result = new ConfigurationModel().merge(model1, model2); assert.deepEqual(result.contents, { 'a': { 'b': 2 }, 'f': 1 }); @@ -223,7 +223,7 @@ suite('ConfigurationModel', () => { }); test('Test override gives all content merged with overrides', () => { - const testObject = new ConfigurationModel({ 'a': 1, 'c': 1 }, [], [{ identifiers: ['b'], contents: { 'a': 2 } }]); + const testObject = new ConfigurationModel({ 'a': 1, 'c': 1 }, [], [{ identifiers: ['b'], contents: { 'a': 2 }, keys: ['a'] }]); assert.deepEqual(testObject.override('b').contents, { 'a': 2, 'c': 1 }); }); @@ -492,4 +492,4 @@ suite('Configuration', () => { }); -}); \ No newline at end of file +}); diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index 0c3132542bf..01b942cf531 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -55,35 +55,13 @@ export class TestConfigurationService implements IConfigurationService { return Promise.resolve(undefined); } - public inspectValue(key: string): IConfigurationValue { - const inspect = this.inspect(key); - return { - default: inspect.default ? { value: inspect.default, overrides: [] } : undefined, - userLocal: inspect.userLocal ? { value: inspect.userLocal, overrides: [] } : undefined, - userRemote: undefined, - workspace: undefined, - workspaceFolders: undefined, - getWorkspaceFolderValue() { return undefined; } - }; - } - - public inspect(key: string, overrides?: IConfigurationOverrides): { - default: T, - user: T, - userLocal?: T, - userRemote?: T, - workspace?: T, - workspaceFolder?: T - value: T, - } { + public inspect(key: string, overrides?: IConfigurationOverrides): IConfigurationValue { const config = this.getValue(undefined, overrides); return { value: getConfigurationValue(config, key), - default: getConfigurationValue(config, key), - user: getConfigurationValue(config, key), - workspace: undefined, - workspaceFolder: undefined + defaultValue: getConfigurationValue(config, key), + userValue: getConfigurationValue(config, key) }; } diff --git a/src/vs/platform/configuration/test/node/configurationService.test.ts b/src/vs/platform/configuration/test/node/configurationService.test.ts index 83507dd2f96..40ca4dce883 100644 --- a/src/vs/platform/configuration/test/node/configurationService.test.ts +++ b/src/vs/platform/configuration/test/node/configurationService.test.ts @@ -210,20 +210,20 @@ suite('ConfigurationService - Node', () => { let res = service.inspect('something.missing'); assert.strictEqual(res.value, undefined); - assert.strictEqual(res.default, undefined); - assert.strictEqual(res.user, undefined); + assert.strictEqual(res.defaultValue, undefined); + assert.strictEqual(res.userValue, undefined); res = service.inspect('lookup.service.testSetting'); - assert.strictEqual(res.default, 'isSet'); + assert.strictEqual(res.defaultValue, 'isSet'); assert.strictEqual(res.value, 'isSet'); - assert.strictEqual(res.user, undefined); + assert.strictEqual(res.userValue, undefined); fs.writeFileSync(r.testFile, '{ "lookup.service.testSetting": "bar" }'); await service.reloadConfiguration(); res = service.inspect('lookup.service.testSetting'); - assert.strictEqual(res.default, 'isSet'); - assert.strictEqual(res.user, 'bar'); + assert.strictEqual(res.defaultValue, 'isSet'); + assert.strictEqual(res.userValue, 'bar'); assert.strictEqual(res.value, 'bar'); service.dispose(); @@ -247,18 +247,18 @@ suite('ConfigurationService - Node', () => { service.initialize(); let res = service.inspect('lookup.service.testNullSetting'); - assert.strictEqual(res.default, null); + assert.strictEqual(res.defaultValue, null); assert.strictEqual(res.value, null); - assert.strictEqual(res.user, undefined); + assert.strictEqual(res.userValue, undefined); fs.writeFileSync(r.testFile, '{ "lookup.service.testNullSetting": null }'); await service.reloadConfiguration(); res = service.inspect('lookup.service.testNullSetting'); - assert.strictEqual(res.default, null); + assert.strictEqual(res.defaultValue, null); assert.strictEqual(res.value, null); - assert.strictEqual(res.user, null); + assert.strictEqual(res.userValue, null); service.dispose(); return r.cleanUp(); diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 9acade4b04c..9413b336c18 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -204,10 +204,10 @@ export class ExtHostConfigProvider { if (config) { return { key, - defaultValue: config.default, - globalValue: config.user, - workspaceValue: config.workspace, - workspaceFolderValue: config.workspaceFolder + defaultValue: config.defaultValue, + globalValue: config.userValue, + workspaceValue: config.workspaceValue, + workspaceFolderValue: config.workspaceFolderValue }; } return undefined; diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 94382d7ceb4..6423aeaaf75 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -542,7 +542,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } // Empty workbench - else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.inspect('workbench.startupEditor').value === 'newUntitledFile') { + else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.getValue('workbench.startupEditor') === 'newUntitledFile') { if (this.editorGroupService.willRestoreEditors) { return []; // do not open any empty untitled file if we restored editors from previous session } diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 848ff70c8d7..3ee96eb6183 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -1158,12 +1158,12 @@ export class ChangeModeAction extends Action { // If the association is already being made in the workspace, make sure to target workspace settings let target = ConfigurationTarget.USER; - if (fileAssociationsConfig.workspace && !!(fileAssociationsConfig.workspace as any)[associationKey]) { + if (fileAssociationsConfig.workspaceValue && !!(fileAssociationsConfig.workspaceValue as any)[associationKey]) { target = ConfigurationTarget.WORKSPACE; } // Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config - const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user) || Object.create(null); + const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspaceValue : fileAssociationsConfig.userValue) || Object.create(null); currentAssociations[associationKey] = language.id; this.configurationService.updateValue(FILES_ASSOCIATIONS_CONFIG, currentAssociations, target); diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index ba79a6e94b6..c653b018cb3 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -551,7 +551,7 @@ class Launch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch', { resource: this.workspace.uri }).workspaceFolder; + return this.configurationService.inspect('launch', { resource: this.workspace.uri }).workspaceFolderValue; } async openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string, token?: CancellationToken): Promise<{ editor: IEditor | null, created: boolean }> { @@ -631,7 +631,7 @@ class WorkspaceLaunch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch').workspace; + return this.configurationService.inspect('launch').workspaceValue; } async openConfigFile(sideBySide: boolean, preserveFocus: boolean): Promise<{ editor: IEditor | null, created: boolean }> { @@ -674,7 +674,7 @@ class UserLaunch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch').user; + return this.configurationService.inspect('launch').userValue; } async openConfigFile(_: boolean, preserveFocus: boolean): Promise<{ editor: IEditor | null, created: boolean }> { diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 3e4d0427d96..b999f540f0b 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -1379,7 +1379,7 @@ export class SetColorThemeAction extends ExtensionAction { ignoreFocusLost }); let confValue = this.configurationService.inspect(COLOR_THEME_SETTING); - const target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; return this.workbenchThemeService.setColorTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target); } } @@ -1445,7 +1445,7 @@ export class SetFileIconThemeAction extends ExtensionAction { ignoreFocusLost }); let confValue = this.configurationService.inspect(ICON_THEME_SETTING); - const target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; return this.workbenchThemeService.setFileIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target); } } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 571022f6a29..e8562ee5c05 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -799,7 +799,7 @@ export class SettingsEditor2 extends BaseEditor { // If the user is changing the value back to the default, do a 'reset' instead const inspected = this.configurationService.inspect(key, overrides); - if (inspected.default === value) { + if (inspected.defaultValue === value) { value = undefined; } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts index 5c48e7c6fe9..35b2fdb558b 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts @@ -8,7 +8,7 @@ import { isFalsyOrWhitespace } from 'vs/base/common/strings'; import { isArray, withUndefinedAsNull } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { localize } from 'vs/nls'; -import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { ConfigurationTarget, IConfigurationService, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; import { SettingsTarget } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets'; import { ITOCEntry, knownAcronyms, knownTermMappings } from 'vs/workbench/contrib/preferences/browser/settingsLayout'; import { MODIFIED_SETTING_TAG } from 'vs/workbench/contrib/preferences/common/preferences'; @@ -155,23 +155,23 @@ export class SettingsTreeSettingElement extends SettingsTreeElement { update(inspectResult: IInspectResult): void { const { isConfigured, inspected, targetSelector } = inspectResult; - const displayValue = isConfigured ? inspected[targetSelector] : inspected.default; + const displayValue = isConfigured ? inspected[targetSelector] : inspected.defaultValue; const overriddenScopeList: string[] = []; - if (targetSelector !== 'workspace' && typeof inspected.workspace !== 'undefined') { + if (targetSelector !== 'workspace' && typeof inspected.workspaceValue !== 'undefined') { overriddenScopeList.push(localize('workspace', "Workspace")); } - if (targetSelector !== 'userRemote' && typeof inspected.userRemote !== 'undefined') { + if (targetSelector !== 'userRemote' && typeof inspected.userRemoteValue !== 'undefined') { overriddenScopeList.push(localize('remote', "Remote")); } - if (targetSelector !== 'userLocal' && typeof inspected.userLocal !== 'undefined') { + if (targetSelector !== 'userLocal' && typeof inspected.userLocalValue !== 'undefined') { overriddenScopeList.push(localize('user', "User")); } this.value = displayValue; this.scopeValue = isConfigured && inspected[targetSelector]; - this.defaultValue = inspected.default; + this.defaultValue = inspected.defaultValue; this.isConfigured = isConfigured; if (isConfigured || this.setting.tags || this.tags) { @@ -374,16 +374,7 @@ export class SettingsTreeModel { interface IInspectResult { isConfigured: boolean; - inspected: { - default: any, - user: any, - userLocal?: any, - userRemote?: any, - workspace?: any, - workspaceFolder?: any, - memory?: any, - value: any, - }; + inspected: IConfigurationValue; targetSelector: 'userLocal' | 'userRemote' | 'workspace' | 'workspaceFolder'; } diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index b77f7278b72..19760bb59a7 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -1667,7 +1667,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').workspace, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); + const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').workspaceValue, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -1686,7 +1686,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').user, nls.localize('TasksSystem.locationUserConfig', 'user settings')); + const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').userValue, nls.localize('TasksSystem.locationUserConfig', 'user settings')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -1789,7 +1789,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer protected getConfiguration(workspaceFolder: IWorkspaceFolder): { config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } { let result = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY - ? Objects.deepClone(this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }).workspaceFolder) + ? Objects.deepClone(this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }).workspaceFolderValue) : undefined; if (!result) { return { config: undefined, hasParseErrors: false }; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index 8bb8bc11c40..660a8c8b501 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -196,13 +196,13 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { // Check if workspace setting exists and whether it's whitelisted let isWorkspaceShellAllowed: boolean | undefined = false; - if (shellConfigValue.workspace !== undefined || shellArgsConfigValue.workspace !== undefined || envConfigValue.workspace !== undefined) { + if (shellConfigValue.workspaceValue !== undefined || shellArgsConfigValue.workspaceValue !== undefined || envConfigValue.workspaceValue !== undefined) { isWorkspaceShellAllowed = this.isWorkspaceShellAllowed(undefined); } // Always allow [] args as it would lead to an odd error message and should not be dangerous - if (shellConfigValue.workspace === undefined && envConfigValue.workspace === undefined && - shellArgsConfigValue.workspace && shellArgsConfigValue.workspace.length === 0) { + if (shellConfigValue.workspaceValue === undefined && envConfigValue.workspaceValue === undefined && + shellArgsConfigValue.workspaceValue && shellArgsConfigValue.workspaceValue.length === 0) { isWorkspaceShellAllowed = true; } @@ -210,16 +210,16 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { // permission if (isWorkspaceShellAllowed === undefined) { let shellString: string | undefined; - if (shellConfigValue.workspace) { - shellString = `shell: "${shellConfigValue.workspace}"`; + if (shellConfigValue.workspaceValue) { + shellString = `shell: "${shellConfigValue.workspaceValue}"`; } let argsString: string | undefined; - if (shellArgsConfigValue.workspace) { - argsString = `shellArgs: [${shellArgsConfigValue.workspace.map(v => '"' + v + '"').join(', ')}]`; + if (shellArgsConfigValue.workspaceValue) { + argsString = `shellArgs: [${shellArgsConfigValue.workspaceValue.map(v => '"' + v + '"').join(', ')}]`; } let envString: string | undefined; - if (envConfigValue.workspace) { - envString = `env: {${Object.keys(envConfigValue.workspace).map(k => `${k}:${envConfigValue.workspace![k]}`).join(', ')}}`; + if (envConfigValue.workspaceValue) { + envString = `env: {${Object.keys(envConfigValue.workspaceValue).map(k => `${k}:${envConfigValue.workspaceValue![k]}`).join(', ')}}`; } // Should not be localized as it's json-like syntax referencing settings keys const workspaceConfigStrings: string[] = []; diff --git a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts index cb2aebdc148..d755cb24d07 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts @@ -246,7 +246,7 @@ export function escapeNonWindowsPath(path: string): string { } export function getDefaultShell( - fetchSetting: (key: string) => { user: string | string[] | undefined, value: string | string[] | undefined, default: string | string[] | undefined }, + fetchSetting: (key: string) => { user?: string | string[], value?: string | string[], default?: string | string[] }, isWorkspaceShellAllowed: boolean, defaultShell: string, isWoW64: boolean, @@ -294,7 +294,7 @@ export function getDefaultShell( } export function getDefaultShellArgs( - fetchSetting: (key: string) => { user: string | string[] | undefined, value: string | string[] | undefined, default: string | string[] | undefined }, + fetchSetting: (key: string) => { user?: string | string[], value?: string | string[], default?: string | string[] }, isWorkspaceShellAllowed: boolean, useAutomationShell: boolean, lastActiveWorkspace: IWorkspaceFolder | undefined, @@ -330,7 +330,7 @@ export function getDefaultShellArgs( } function getShellSetting( - fetchSetting: (key: string) => { user: string | string[] | undefined, value: string | string[] | undefined, default: string | string[] | undefined }, + fetchSetting: (key: string) => { user?: string | string[], value?: string | string[], default?: string | string[] }, isWorkspaceShellAllowed: boolean, type: 'automationShell' | 'shell', platformOverride: platform.Platform = platform.platform, @@ -344,7 +344,7 @@ function getShellSetting( export function createTerminalEnvironment( shellLaunchConfig: IShellLaunchConfig, lastActiveWorkspace: IWorkspaceFolder | null, - envFromConfig: { user: ITerminalEnvironment | undefined, value: ITerminalEnvironment | undefined, default: ITerminalEnvironment | undefined }, + envFromConfig: { user?: ITerminalEnvironment, value?: ITerminalEnvironment, default?: ITerminalEnvironment }, configurationResolverService: IConfigurationResolverService | undefined, isWorkspaceShellAllowed: boolean, version: string | undefined, diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts index eaee0e3cd4e..0643cb30048 100644 --- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts +++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts @@ -63,7 +63,7 @@ export class SelectColorThemeAction extends Action { let target: ConfigurationTarget | undefined = undefined; if (applyTheme) { const confValue = this.configurationService.inspect(COLOR_THEME_SETTING); - target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; } this.themeService.setColorTheme(themeId, target).then(undefined, @@ -148,7 +148,7 @@ class SelectIconThemeAction extends Action { let target: ConfigurationTarget | undefined = undefined; if (applyTheme) { const confValue = this.configurationService.inspect(ICON_THEME_SETTING); - target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; } this.themeService.setFileIconTheme(themeId, target).then(undefined, err => { diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts index e3b413f69e7..bf3dd942d3e 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts @@ -108,7 +108,7 @@ export class WelcomePageContribution implements IWorkbenchContribution { function isWelcomePageEnabled(configurationService: IConfigurationService, contextService: IWorkspaceContextService) { const startupEditor = configurationService.inspect(configurationKey); - if (!startupEditor.user && !startupEditor.workspace) { + if (!startupEditor.userValue && !startupEditor.workspaceValue) { const welcomeEnabled = configurationService.inspect(oldConfigurationKey); if (welcomeEnabled.value !== undefined && welcomeEnabled.value !== null) { return welcomeEnabled.value; diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 31d6f585995..7081ef157ca 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -262,10 +262,6 @@ export class WorkspaceService extends Disposable implements IConfigurationServic }); } - inspectValue(key: string): IConfigurationValue { - return this._configuration.inspectValue(key); - } - reloadConfiguration(folder?: IWorkspaceFolder, key?: string): Promise { if (folder) { return this.reloadWorkspaceFolderConfiguration(folder, key); @@ -275,16 +271,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic .then(() => this.loadConfiguration(local, remote))); } - inspect(key: string, overrides?: IConfigurationOverrides): { - default: T, - user: T, - userLocal?: T, - userRemote?: T, - workspace?: T, - workspaceFolder?: T, - memory?: T, - value: T - } { + inspect(key: string, overrides?: IConfigurationOverrides): IConfigurationValue { return this._configuration.inspect(key, overrides); } @@ -666,11 +653,11 @@ export class WorkspaceService extends Disposable implements IConfigurationServic return undefined; } - if (inspect.workspaceFolder !== undefined) { + if (inspect.workspaceFolderValue !== undefined) { return ConfigurationTarget.WORKSPACE_FOLDER; } - if (inspect.workspace !== undefined) { + if (inspect.workspaceValue !== undefined) { return ConfigurationTarget.WORKSPACE; } @@ -698,7 +685,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private toEditableConfigurationTarget(target: ConfigurationTarget, key: string): EditableConfigurationTarget | null { if (target === ConfigurationTarget.USER) { - if (this.inspect(key).userRemote !== undefined) { + if (this.inspect(key).userRemoteValue !== undefined) { return EditableConfigurationTarget.USER_REMOTE; } return EditableConfigurationTarget.USER_LOCAL; diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index d4dd50455c6..84059edd671 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -101,20 +101,7 @@ export class Configuration extends BaseConfiguration { return super.getValue(key, overrides, this._workspace); } - inspectValue(key: string): IConfigurationValue { - return super.inspectValue(key, this._workspace); - } - - inspect(key: string, overrides: IConfigurationOverrides = {}): { - default: C, - user: C, - userLocal?: C, - userRemote?: C, - workspace?: C, - workspaceFolder?: C - memory?: C - value: C, - } { + inspect(key: string, overrides: IConfigurationOverrides = {}): IConfigurationValue { return super.inspect(key, overrides, this._workspace); } diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index cb1792bd9f0..e0d180d5470 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -950,27 +950,27 @@ suite('WorkspaceConfigurationService - Folder', () => { test('inspect', () => { let actual = testObject.inspect('something.missing'); - assert.equal(actual.default, undefined); - assert.equal(actual.user, undefined); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, undefined); + assert.equal(actual.userValue, undefined); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, undefined); actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, undefined); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, undefined); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'isSet'); fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.testSetting": "userValue" }'); return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, 'userValue'); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, 'userValue'); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'userValue'); fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.testSetting": "workspaceValue" }'); @@ -978,10 +978,10 @@ suite('WorkspaceConfigurationService - Folder', () => { return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, 'userValue'); - assert.equal(actual.workspace, 'workspaceValue'); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, 'userValue'); + assert.equal(actual.workspaceValue, 'workspaceValue'); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'workspaceValue'); }); }); @@ -1308,37 +1308,37 @@ suite('WorkspaceConfigurationService-Multiroot', () => { test('inspect', () => { let actual = testObject.inspect('something.missing'); - assert.equal(actual.default, undefined); - assert.equal(actual.user, undefined); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, undefined); + assert.equal(actual.userValue, undefined); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, undefined); actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, undefined); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, undefined); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'isSet'); fs.writeFileSync(globalSettingsFile, '{ "configurationService.workspace.testResourceSetting": "userValue" }'); return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, 'userValue'); - assert.equal(actual.workspace, undefined); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, 'userValue'); + assert.equal(actual.workspaceValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'userValue'); return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'settings', value: { 'configurationService.workspace.testResourceSetting': 'workspaceValue' } }], true) .then(() => testObject.reloadConfiguration()) .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, 'userValue'); - assert.equal(actual.workspace, 'workspaceValue'); - assert.equal(actual.workspaceFolder, undefined); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, 'userValue'); + assert.equal(actual.workspaceValue, 'workspaceValue'); + assert.equal(actual.workspaceFolderValue, undefined); assert.equal(actual.value, 'workspaceValue'); fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testResourceSetting": "workspaceFolderValue" }'); @@ -1346,10 +1346,10 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting', { resource: workspaceContextService.getWorkspace().folders[0].uri }); - assert.equal(actual.default, 'isSet'); - assert.equal(actual.user, 'userValue'); - assert.equal(actual.workspace, 'workspaceValue'); - assert.equal(actual.workspaceFolder, 'workspaceFolderValue'); + assert.equal(actual.defaultValue, 'isSet'); + assert.equal(actual.userValue, 'userValue'); + assert.equal(actual.workspaceValue, 'workspaceValue'); + assert.equal(actual.workspaceFolderValue, 'workspaceFolderValue'); assert.equal(actual.value, 'workspaceFolderValue'); }); }); @@ -1401,7 +1401,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'launch', value: expectedLaunchConfiguration }], true) .then(() => testObject.reloadConfiguration()) .then(() => { - const actual = testObject.inspect('launch').workspace; + const actual = testObject.inspect('launch').workspaceValue; assert.deepEqual(actual, expectedLaunchConfiguration); }); }); @@ -1448,7 +1448,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'tasks', value: expectedTasksConfiguration }], true) .then(() => testObject.reloadConfiguration()) .then(() => { - const actual = testObject.inspect('tasks').workspace; + const actual = testObject.inspect('tasks').workspaceValue; assert.deepEqual(actual, expectedTasksConfiguration); }); }); diff --git a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts index 8d4238c59fa..63481a2e162 100644 --- a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts +++ b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts @@ -184,9 +184,9 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi async toggleAutoSave(): Promise { const setting = this.configurationService.inspect('files.autoSave'); - let userAutoSaveConfig = setting.user; + let userAutoSaveConfig = setting.userValue; if (isUndefinedOrNull(userAutoSaveConfig)) { - userAutoSaveConfig = setting.default; // use default if setting not defined + userAutoSaveConfig = setting.defaultValue; // use default if setting not defined } let newAutoSaveValue: string; diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index c0172a4cdd8..dbc0c136edb 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -580,9 +580,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { public writeConfiguration(key: string, value: any, settingsTarget: ConfigurationTarget | 'auto'): Promise { let settings = this.configurationService.inspect(key); if (settingsTarget === 'auto') { - if (!types.isUndefined(settings.workspaceFolder)) { + if (!types.isUndefined(settings.workspaceFolderValue)) { settingsTarget = ConfigurationTarget.WORKSPACE_FOLDER; - } else if (!types.isUndefined(settings.workspace)) { + } else if (!types.isUndefined(settings.workspaceValue)) { settingsTarget = ConfigurationTarget.WORKSPACE; } else { settingsTarget = ConfigurationTarget.USER; @@ -590,10 +590,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } if (settingsTarget === ConfigurationTarget.USER) { - if (value === settings.user) { + if (value === settings.userValue) { return Promise.resolve(undefined); // nothing to do - } else if (value === settings.default) { - if (types.isUndefined(settings.user)) { + } else if (value === settings.defaultValue) { + if (types.isUndefined(settings.userValue)) { return Promise.resolve(undefined); // nothing to do } value = undefined; // remove configuration from user settings diff --git a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts index fa7b43c3a9a..8db7376d378 100644 --- a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts @@ -309,7 +309,7 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi continue; } - targetWorkspaceConfiguration[key] = this.configurationService.inspect(key).workspace; + targetWorkspaceConfiguration[key] = this.configurationService.inspect(key).workspaceValue; } } From 5ba0926f9d35fc3206300ebaedee46d9ab5834e3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 12 Dec 2019 09:49:17 +0100 Subject: [PATCH 367/637] Add explicit null checks (fixes microsoft/monaco-editor#1376) --- src/vs/base/common/async.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/vs/base/common/async.ts b/src/vs/base/common/async.ts index 39055d0201e..cb0a39611e7 100644 --- a/src/vs/base/common/async.ts +++ b/src/vs/base/common/async.ts @@ -184,13 +184,14 @@ export class Delayer implements IDisposable { private timeout: any; private completionPromise: Promise | null; private doResolve: ((value?: any | Promise) => void) | null; - private doReject?: (err: any) => void; + private doReject: ((err: any) => void) | null; private task: ITask> | null; constructor(public defaultDelay: number) { this.timeout = null; this.completionPromise = null; this.doResolve = null; + this.doReject = null; this.task = null; } @@ -205,16 +206,20 @@ export class Delayer implements IDisposable { }).then(() => { this.completionPromise = null; this.doResolve = null; - const task = this.task!; - this.task = null; - - return task(); + if (this.task) { + const task = this.task; + this.task = null; + return task(); + } + return undefined; }); } this.timeout = setTimeout(() => { this.timeout = null; - this.doResolve!(null); + if (this.doResolve) { + this.doResolve(null); + } }, delay); return this.completionPromise; @@ -228,7 +233,9 @@ export class Delayer implements IDisposable { this.cancelTimeout(); if (this.completionPromise) { - this.doReject!(errors.canceled()); + if (this.doReject) { + this.doReject(errors.canceled()); + } this.completionPromise = null; } } From 0230c97caf2f02c9fa3e3f1f4fbccf82ac7870ad Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 12 Dec 2019 10:22:00 +0100 Subject: [PATCH 368/637] Fixes microsoft/monaco-editor#1349 --- src/vs/editor/browser/viewParts/viewCursors/viewCursors.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css index d77870c24a2..59b084e5922 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.css @@ -15,7 +15,7 @@ /* -- smooth-caret-animation -- */ .monaco-editor .cursors-layer.cursor-smooth-caret-animation > .cursor { - transition: 80ms; + transition: all 80ms; } /* -- block-outline-style -- */ @@ -85,4 +85,4 @@ .cursor-expand > .cursor { animation: monaco-cursor-expand 0.5s ease-in-out 0s 20 alternate; -} \ No newline at end of file +} From 0ecc745265d489e2a52abda5482c986e5737af48 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 12 Dec 2019 10:39:56 +0100 Subject: [PATCH 369/637] rename --- .../resourceConfigurationService.test.ts | 82 +++++++++---------- .../configuration/common/configuration.ts | 34 ++++---- .../common/configurationModels.ts | 28 +++---- .../test/common/testConfigurationService.ts | 4 +- .../api/common/extHostConfiguration.ts | 8 +- .../browser/parts/editor/editorStatus.ts | 4 +- .../browser/debugConfigurationManager.ts | 6 +- .../extensions/browser/extensionsActions.ts | 4 +- .../preferences/browser/settingsEditor2.ts | 2 +- .../preferences/browser/settingsTreeModels.ts | 10 +-- .../tasks/browser/abstractTaskService.ts | 6 +- .../terminal/browser/terminalConfigHelper.ts | 18 ++-- .../themes/browser/themes.contribution.ts | 4 +- .../welcome/page/browser/welcomePage.ts | 2 +- .../configurationService.test.ts | 76 ++++++++--------- .../common/filesConfigurationService.ts | 4 +- .../themes/browser/workbenchThemeService.ts | 10 +-- .../abstractWorkspaceEditingService.ts | 2 +- 18 files changed, 152 insertions(+), 152 deletions(-) diff --git a/src/vs/editor/test/common/services/resourceConfigurationService.test.ts b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts index 740970888f3..b2c1eabe91c 100644 --- a/src/vs/editor/test/common/services/resourceConfigurationService.test.ts +++ b/src/vs/editor/test/common/services/resourceConfigurationService.test.ts @@ -50,9 +50,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given memory target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceFolderValue: '2' + default: '1', + userLocal: '2', + workspaceFolder: '2' }; const resource = URI.file('someFile'); @@ -63,9 +63,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given workspace target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceFolderValue: '2' + default: '1', + userLocal: '2', + workspaceFolder: '2' }; const resource = URI.file('someFile'); @@ -76,9 +76,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given user target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceFolderValue: '2' + default: '1', + userLocal: '2', + workspaceFolder: '2' }; const resource = URI.file('someFile'); @@ -89,9 +89,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into given workspace folder target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceFolderValue: '2', + default: '1', + userLocal: '2', + workspaceFolder: '2', workspaceFolderOverridden: '1' }; const resource = URI.file('someFile'); @@ -103,9 +103,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace folder target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceFolderValue: '2', + default: '1', + userLocal: '2', + workspaceFolder: '2', }; const resource = URI.file('someFile'); @@ -116,10 +116,10 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace folder target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceValue: '2', - workspaceFolderValue: '2', + default: '1', + userLocal: '2', + workspace: '2', + workspaceFolder: '2', workspaceOverridden: '3', workspaceFolderOverridden: '1' }; @@ -132,9 +132,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceValue: '2', + default: '1', + userLocal: '2', + workspace: '2', }; const resource = URI.file('someFile'); @@ -145,9 +145,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived workspace target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - workspaceValue: '2', + default: '1', + userLocal: '2', + workspace: '2', workspaceOverridden: 3 }; const resource = URI.file('someFile'); @@ -159,9 +159,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - userRemoteValue: '3', + default: '1', + userLocal: '2', + userRemote: '3', }; const resource = URI.file('someFile'); @@ -172,9 +172,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - userRemoteValue: '3', + default: '1', + userLocal: '2', + userRemote: '3', userRemoteOverridden: '3', }; const resource = URI.file('someFile'); @@ -185,9 +185,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - userRemoteValue: '3', + default: '1', + userLocal: '2', + userRemote: '3', }; const resource = URI.file('someFile'); @@ -198,9 +198,9 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user remote target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', - userRemoteValue: '3', + default: '1', + userLocal: '2', + userRemote: '3', userRemoteOverridden: '3', }; const resource = URI.file('someFile'); @@ -212,8 +212,8 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user target without overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', + default: '1', + userLocal: '2', }; const resource = URI.file('someFile'); @@ -224,8 +224,8 @@ suite('TextResourceConfigurationService - Update', () => { test('updateValue writes into derived user target with overrides', async () => { language = 'a'; configurationValue = { - defaultValue: '1', - userLocalValue: '2', + default: '1', + userLocal: '2', userLocalOverridden: '3' }; const resource = URI.file('someFile'); diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 64ad58f18af..f51f707f6be 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -65,22 +65,22 @@ export interface IConfigurationChangeEvent { export interface IConfigurationValue { - readonly defaultValue?: T; - readonly userValue?: T; - readonly userLocalValue?: T; - readonly userRemoteValue?: T; - readonly workspaceValue?: T; - readonly workspaceFolderValue?: T; - readonly memoryValue?: T; + readonly default?: T; + readonly user?: T; + readonly userLocal?: T; + readonly userRemote?: T; + readonly workspace?: T; + readonly workspaceFolder?: T; + readonly memory?: T; readonly value?: T; - readonly default?: { value?: T, override?: T }; - readonly user?: { value?: T, override?: T }; - readonly userLocal?: { value?: T, override?: T }; - readonly userRemote?: { value?: T, override?: T }; - readonly workspace?: { value?: T, override?: T }; - readonly workspaceFolder?: { value?: T, override?: T }; - readonly memory?: { value?: T, override?: T }; + readonly defaultTarget?: { value?: T, override?: T }; + readonly userTarget?: { value?: T, override?: T }; + readonly userLocalTarget?: { value?: T, override?: T }; + readonly userRemoteTarget?: { value?: T, override?: T }; + readonly workspaceTarget?: { value?: T, override?: T }; + readonly workspaceFolderTarget?: { value?: T, override?: T }; + readonly memoryTarget?: { value?: T, override?: T }; } export interface IConfigurationService { @@ -357,11 +357,11 @@ export function getMigratedSettingValue(configurationService: IConfigurationS const setting = configurationService.inspect(currentSettingName); const legacySetting = configurationService.inspect(legacySettingName); - if (typeof setting.userValue !== 'undefined' || typeof setting.workspaceValue !== 'undefined' || typeof setting.workspaceFolderValue !== 'undefined') { + if (typeof setting.user !== 'undefined' || typeof setting.workspace !== 'undefined' || typeof setting.workspaceFolder !== 'undefined') { return setting.value!; - } else if (typeof legacySetting.userValue !== 'undefined' || typeof legacySetting.workspaceValue !== 'undefined' || typeof legacySetting.workspaceFolderValue !== 'undefined') { + } else if (typeof legacySetting.user !== 'undefined' || typeof legacySetting.workspace !== 'undefined' || typeof legacySetting.workspaceFolder !== 'undefined') { return legacySetting.value!; } else { - return setting.defaultValue!; + return setting.default!; } } diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index fd2a7e4f20b..a56bae5e286 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -384,22 +384,22 @@ export class Configuration { const value = consolidateConfigurationModel.getValue(key); return { - defaultValue, - userValue, - userLocalValue, - userRemoteValue, - workspaceValue, - workspaceFolderValue, - memoryValue, + default: defaultValue, + user: userValue, + userLocal: userLocalValue, + userRemote: userRemoteValue, + workspace: workspaceValue, + workspaceFolder: workspaceFolderValue, + memory: memoryValue, value, - default: defaultValue !== undefined ? { value: this._defaultConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - user: userValue !== undefined ? { value: this.userConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.userConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - userLocal: userLocalValue !== undefined ? { value: this.localUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - userRemote: userRemoteValue !== undefined ? { value: this.remoteUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - workspace: workspaceValue !== undefined ? { value: this._workspaceConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - workspaceFolder: workspaceFolderValue !== undefined ? { value: folderConfigurationModel?.freeze().getValue(key), override: overrides.overrideIdentifier ? folderConfigurationModel?.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, - memory: memoryValue !== undefined ? { value: memoryConfigurationModel.getValue(key), override: overrides.overrideIdentifier ? memoryConfigurationModel.getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + defaultTarget: defaultValue !== undefined ? { value: this._defaultConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + userTarget: userValue !== undefined ? { value: this.userConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.userConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + userLocalTarget: userLocalValue !== undefined ? { value: this.localUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + userRemoteTarget: userRemoteValue !== undefined ? { value: this.remoteUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + workspaceTarget: workspaceValue !== undefined ? { value: this._workspaceConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + workspaceFolderTarget: workspaceFolderValue !== undefined ? { value: folderConfigurationModel?.freeze().getValue(key), override: overrides.overrideIdentifier ? folderConfigurationModel?.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, + memoryTarget: memoryValue !== undefined ? { value: memoryConfigurationModel.getValue(key), override: overrides.overrideIdentifier ? memoryConfigurationModel.getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined, }; } diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index 01b942cf531..a8dab523c62 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -60,8 +60,8 @@ export class TestConfigurationService implements IConfigurationService { return { value: getConfigurationValue(config, key), - defaultValue: getConfigurationValue(config, key), - userValue: getConfigurationValue(config, key) + default: getConfigurationValue(config, key), + user: getConfigurationValue(config, key) }; } diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 9413b336c18..9acade4b04c 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -204,10 +204,10 @@ export class ExtHostConfigProvider { if (config) { return { key, - defaultValue: config.defaultValue, - globalValue: config.userValue, - workspaceValue: config.workspaceValue, - workspaceFolderValue: config.workspaceFolderValue + defaultValue: config.default, + globalValue: config.user, + workspaceValue: config.workspace, + workspaceFolderValue: config.workspaceFolder }; } return undefined; diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 3ee96eb6183..848ff70c8d7 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -1158,12 +1158,12 @@ export class ChangeModeAction extends Action { // If the association is already being made in the workspace, make sure to target workspace settings let target = ConfigurationTarget.USER; - if (fileAssociationsConfig.workspaceValue && !!(fileAssociationsConfig.workspaceValue as any)[associationKey]) { + if (fileAssociationsConfig.workspace && !!(fileAssociationsConfig.workspace as any)[associationKey]) { target = ConfigurationTarget.WORKSPACE; } // Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config - const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspaceValue : fileAssociationsConfig.userValue) || Object.create(null); + const currentAssociations = deepClone((target === ConfigurationTarget.WORKSPACE) ? fileAssociationsConfig.workspace : fileAssociationsConfig.user) || Object.create(null); currentAssociations[associationKey] = language.id; this.configurationService.updateValue(FILES_ASSOCIATIONS_CONFIG, currentAssociations, target); diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index c653b018cb3..ba79a6e94b6 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -551,7 +551,7 @@ class Launch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch', { resource: this.workspace.uri }).workspaceFolderValue; + return this.configurationService.inspect('launch', { resource: this.workspace.uri }).workspaceFolder; } async openConfigFile(sideBySide: boolean, preserveFocus: boolean, type?: string, token?: CancellationToken): Promise<{ editor: IEditor | null, created: boolean }> { @@ -631,7 +631,7 @@ class WorkspaceLaunch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch').workspaceValue; + return this.configurationService.inspect('launch').workspace; } async openConfigFile(sideBySide: boolean, preserveFocus: boolean): Promise<{ editor: IEditor | null, created: boolean }> { @@ -674,7 +674,7 @@ class UserLaunch extends AbstractLaunch implements ILaunch { } protected getConfig(): IGlobalConfig | undefined { - return this.configurationService.inspect('launch').userValue; + return this.configurationService.inspect('launch').user; } async openConfigFile(_: boolean, preserveFocus: boolean): Promise<{ editor: IEditor | null, created: boolean }> { diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index b999f540f0b..3e4d0427d96 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -1379,7 +1379,7 @@ export class SetColorThemeAction extends ExtensionAction { ignoreFocusLost }); let confValue = this.configurationService.inspect(COLOR_THEME_SETTING); - const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + const target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; return this.workbenchThemeService.setColorTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target); } } @@ -1445,7 +1445,7 @@ export class SetFileIconThemeAction extends ExtensionAction { ignoreFocusLost }); let confValue = this.configurationService.inspect(ICON_THEME_SETTING); - const target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + const target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; return this.workbenchThemeService.setFileIconTheme(pickedTheme ? pickedTheme.id : currentTheme.id, target); } } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index e8562ee5c05..571022f6a29 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -799,7 +799,7 @@ export class SettingsEditor2 extends BaseEditor { // If the user is changing the value back to the default, do a 'reset' instead const inspected = this.configurationService.inspect(key, overrides); - if (inspected.defaultValue === value) { + if (inspected.default === value) { value = undefined; } diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts index 35b2fdb558b..697249e7212 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts @@ -155,23 +155,23 @@ export class SettingsTreeSettingElement extends SettingsTreeElement { update(inspectResult: IInspectResult): void { const { isConfigured, inspected, targetSelector } = inspectResult; - const displayValue = isConfigured ? inspected[targetSelector] : inspected.defaultValue; + const displayValue = isConfigured ? inspected[targetSelector] : inspected.default; const overriddenScopeList: string[] = []; - if (targetSelector !== 'workspace' && typeof inspected.workspaceValue !== 'undefined') { + if (targetSelector !== 'workspace' && typeof inspected.workspace !== 'undefined') { overriddenScopeList.push(localize('workspace', "Workspace")); } - if (targetSelector !== 'userRemote' && typeof inspected.userRemoteValue !== 'undefined') { + if (targetSelector !== 'userRemote' && typeof inspected.userRemote !== 'undefined') { overriddenScopeList.push(localize('remote', "Remote")); } - if (targetSelector !== 'userLocal' && typeof inspected.userLocalValue !== 'undefined') { + if (targetSelector !== 'userLocal' && typeof inspected.userLocal !== 'undefined') { overriddenScopeList.push(localize('user', "User")); } this.value = displayValue; this.scopeValue = isConfigured && inspected[targetSelector]; - this.defaultValue = inspected.defaultValue; + this.defaultValue = inspected.default; this.isConfigured = isConfigured; if (isConfigured || this.setting.tags || this.tags) { diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 19760bb59a7..b77f7278b72 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -1667,7 +1667,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').workspaceValue, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); + const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').workspace, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -1686,7 +1686,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer if (this.executionEngine === ExecutionEngine.Process) { return this.emptyWorkspaceTaskResults(workspaceFolder); } - const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').userValue, nls.localize('TasksSystem.locationUserConfig', 'user settings')); + const configuration = this.testParseExternalConfig(this.configurationService.inspect('tasks').user, nls.localize('TasksSystem.locationUserConfig', 'user settings')); let customizedTasks: { byIdentifier: IStringDictionary; } = { byIdentifier: Object.create(null) }; @@ -1789,7 +1789,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer protected getConfiguration(workspaceFolder: IWorkspaceFolder): { config: TaskConfig.ExternalTaskRunnerConfiguration | undefined; hasParseErrors: boolean } { let result = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY - ? Objects.deepClone(this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }).workspaceFolderValue) + ? Objects.deepClone(this.configurationService.inspect('tasks', { resource: workspaceFolder.uri }).workspaceFolder) : undefined; if (!result) { return { config: undefined, hasParseErrors: false }; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index 660a8c8b501..8bb8bc11c40 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -196,13 +196,13 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { // Check if workspace setting exists and whether it's whitelisted let isWorkspaceShellAllowed: boolean | undefined = false; - if (shellConfigValue.workspaceValue !== undefined || shellArgsConfigValue.workspaceValue !== undefined || envConfigValue.workspaceValue !== undefined) { + if (shellConfigValue.workspace !== undefined || shellArgsConfigValue.workspace !== undefined || envConfigValue.workspace !== undefined) { isWorkspaceShellAllowed = this.isWorkspaceShellAllowed(undefined); } // Always allow [] args as it would lead to an odd error message and should not be dangerous - if (shellConfigValue.workspaceValue === undefined && envConfigValue.workspaceValue === undefined && - shellArgsConfigValue.workspaceValue && shellArgsConfigValue.workspaceValue.length === 0) { + if (shellConfigValue.workspace === undefined && envConfigValue.workspace === undefined && + shellArgsConfigValue.workspace && shellArgsConfigValue.workspace.length === 0) { isWorkspaceShellAllowed = true; } @@ -210,16 +210,16 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { // permission if (isWorkspaceShellAllowed === undefined) { let shellString: string | undefined; - if (shellConfigValue.workspaceValue) { - shellString = `shell: "${shellConfigValue.workspaceValue}"`; + if (shellConfigValue.workspace) { + shellString = `shell: "${shellConfigValue.workspace}"`; } let argsString: string | undefined; - if (shellArgsConfigValue.workspaceValue) { - argsString = `shellArgs: [${shellArgsConfigValue.workspaceValue.map(v => '"' + v + '"').join(', ')}]`; + if (shellArgsConfigValue.workspace) { + argsString = `shellArgs: [${shellArgsConfigValue.workspace.map(v => '"' + v + '"').join(', ')}]`; } let envString: string | undefined; - if (envConfigValue.workspaceValue) { - envString = `env: {${Object.keys(envConfigValue.workspaceValue).map(k => `${k}:${envConfigValue.workspaceValue![k]}`).join(', ')}}`; + if (envConfigValue.workspace) { + envString = `env: {${Object.keys(envConfigValue.workspace).map(k => `${k}:${envConfigValue.workspace![k]}`).join(', ')}}`; } // Should not be localized as it's json-like syntax referencing settings keys const workspaceConfigStrings: string[] = []; diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts index 0643cb30048..eaee0e3cd4e 100644 --- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts +++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts @@ -63,7 +63,7 @@ export class SelectColorThemeAction extends Action { let target: ConfigurationTarget | undefined = undefined; if (applyTheme) { const confValue = this.configurationService.inspect(COLOR_THEME_SETTING); - target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; } this.themeService.setColorTheme(themeId, target).then(undefined, @@ -148,7 +148,7 @@ class SelectIconThemeAction extends Action { let target: ConfigurationTarget | undefined = undefined; if (applyTheme) { const confValue = this.configurationService.inspect(ICON_THEME_SETTING); - target = typeof confValue.workspaceValue !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; + target = typeof confValue.workspace !== 'undefined' ? ConfigurationTarget.WORKSPACE : ConfigurationTarget.USER; } this.themeService.setFileIconTheme(themeId, target).then(undefined, err => { diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts index bf3dd942d3e..e3b413f69e7 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts @@ -108,7 +108,7 @@ export class WelcomePageContribution implements IWorkbenchContribution { function isWelcomePageEnabled(configurationService: IConfigurationService, contextService: IWorkspaceContextService) { const startupEditor = configurationService.inspect(configurationKey); - if (!startupEditor.userValue && !startupEditor.workspaceValue) { + if (!startupEditor.user && !startupEditor.workspace) { const welcomeEnabled = configurationService.inspect(oldConfigurationKey); if (welcomeEnabled.value !== undefined && welcomeEnabled.value !== null) { return welcomeEnabled.value; diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index e0d180d5470..cb1792bd9f0 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -950,27 +950,27 @@ suite('WorkspaceConfigurationService - Folder', () => { test('inspect', () => { let actual = testObject.inspect('something.missing'); - assert.equal(actual.defaultValue, undefined); - assert.equal(actual.userValue, undefined); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, undefined); + assert.equal(actual.user, undefined); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, undefined); actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, undefined); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, undefined); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'isSet'); fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.testSetting": "userValue" }'); return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, 'userValue'); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, 'userValue'); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'userValue'); fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.testSetting": "workspaceValue" }'); @@ -978,10 +978,10 @@ suite('WorkspaceConfigurationService - Folder', () => { return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.folder.testSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, 'userValue'); - assert.equal(actual.workspaceValue, 'workspaceValue'); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, 'userValue'); + assert.equal(actual.workspace, 'workspaceValue'); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'workspaceValue'); }); }); @@ -1308,37 +1308,37 @@ suite('WorkspaceConfigurationService-Multiroot', () => { test('inspect', () => { let actual = testObject.inspect('something.missing'); - assert.equal(actual.defaultValue, undefined); - assert.equal(actual.userValue, undefined); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, undefined); + assert.equal(actual.user, undefined); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, undefined); actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, undefined); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, undefined); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'isSet'); fs.writeFileSync(globalSettingsFile, '{ "configurationService.workspace.testResourceSetting": "userValue" }'); return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, 'userValue'); - assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, 'userValue'); + assert.equal(actual.workspace, undefined); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'userValue'); return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'settings', value: { 'configurationService.workspace.testResourceSetting': 'workspaceValue' } }], true) .then(() => testObject.reloadConfiguration()) .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting'); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, 'userValue'); - assert.equal(actual.workspaceValue, 'workspaceValue'); - assert.equal(actual.workspaceFolderValue, undefined); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, 'userValue'); + assert.equal(actual.workspace, 'workspaceValue'); + assert.equal(actual.workspaceFolder, undefined); assert.equal(actual.value, 'workspaceValue'); fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testResourceSetting": "workspaceFolderValue" }'); @@ -1346,10 +1346,10 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return testObject.reloadConfiguration() .then(() => { actual = testObject.inspect('configurationService.workspace.testResourceSetting', { resource: workspaceContextService.getWorkspace().folders[0].uri }); - assert.equal(actual.defaultValue, 'isSet'); - assert.equal(actual.userValue, 'userValue'); - assert.equal(actual.workspaceValue, 'workspaceValue'); - assert.equal(actual.workspaceFolderValue, 'workspaceFolderValue'); + assert.equal(actual.default, 'isSet'); + assert.equal(actual.user, 'userValue'); + assert.equal(actual.workspace, 'workspaceValue'); + assert.equal(actual.workspaceFolder, 'workspaceFolderValue'); assert.equal(actual.value, 'workspaceFolderValue'); }); }); @@ -1401,7 +1401,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'launch', value: expectedLaunchConfiguration }], true) .then(() => testObject.reloadConfiguration()) .then(() => { - const actual = testObject.inspect('launch').workspaceValue; + const actual = testObject.inspect('launch').workspace; assert.deepEqual(actual, expectedLaunchConfiguration); }); }); @@ -1448,7 +1448,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration!, [{ key: 'tasks', value: expectedTasksConfiguration }], true) .then(() => testObject.reloadConfiguration()) .then(() => { - const actual = testObject.inspect('tasks').workspaceValue; + const actual = testObject.inspect('tasks').workspace; assert.deepEqual(actual, expectedTasksConfiguration); }); }); diff --git a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts index 63481a2e162..8d4238c59fa 100644 --- a/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts +++ b/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.ts @@ -184,9 +184,9 @@ export class FilesConfigurationService extends Disposable implements IFilesConfi async toggleAutoSave(): Promise { const setting = this.configurationService.inspect('files.autoSave'); - let userAutoSaveConfig = setting.userValue; + let userAutoSaveConfig = setting.user; if (isUndefinedOrNull(userAutoSaveConfig)) { - userAutoSaveConfig = setting.defaultValue; // use default if setting not defined + userAutoSaveConfig = setting.default; // use default if setting not defined } let newAutoSaveValue: string; diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index dbc0c136edb..c0172a4cdd8 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -580,9 +580,9 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { public writeConfiguration(key: string, value: any, settingsTarget: ConfigurationTarget | 'auto'): Promise { let settings = this.configurationService.inspect(key); if (settingsTarget === 'auto') { - if (!types.isUndefined(settings.workspaceFolderValue)) { + if (!types.isUndefined(settings.workspaceFolder)) { settingsTarget = ConfigurationTarget.WORKSPACE_FOLDER; - } else if (!types.isUndefined(settings.workspaceValue)) { + } else if (!types.isUndefined(settings.workspace)) { settingsTarget = ConfigurationTarget.WORKSPACE; } else { settingsTarget = ConfigurationTarget.USER; @@ -590,10 +590,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } if (settingsTarget === ConfigurationTarget.USER) { - if (value === settings.userValue) { + if (value === settings.user) { return Promise.resolve(undefined); // nothing to do - } else if (value === settings.defaultValue) { - if (types.isUndefined(settings.userValue)) { + } else if (value === settings.default) { + if (types.isUndefined(settings.user)) { return Promise.resolve(undefined); // nothing to do } value = undefined; // remove configuration from user settings diff --git a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts index 8db7376d378..fa7b43c3a9a 100644 --- a/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.ts @@ -309,7 +309,7 @@ export abstract class AbstractWorkspaceEditingService implements IWorkspaceEditi continue; } - targetWorkspaceConfiguration[key] = this.configurationService.inspect(key).workspaceValue; + targetWorkspaceConfiguration[key] = this.configurationService.inspect(key).workspace; } } From 2bde45241a3c13a3571aced98a1fd91cfc4fa7a5 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 12 Dec 2019 12:10:24 +0100 Subject: [PATCH 370/637] add semantic token example folder --- .../vscode-colorize-tests/src/colorizerTestMain.ts | 11 +++++++++-- .../test/semantic-test/.vscode/settings.json | 13 +++++++++++++ .../test/semantic-test/semantic-test.json | 9 +++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json create mode 100644 extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json diff --git a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts index 7f30a330ffb..9586fc0bb97 100644 --- a/extensions/vscode-colorize-tests/src/colorizerTestMain.ts +++ b/extensions/vscode-colorize-tests/src/colorizerTestMain.ts @@ -8,11 +8,13 @@ import * as jsoncParser from 'jsonc-parser'; export function activate(context: vscode.ExtensionContext): any { - const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable']; - const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async']; + const tokenTypes = ['type', 'struct', 'class', 'interface', 'enum', 'parameterType', 'function', 'variable', 'testToken']; + const tokenModifiers = ['static', 'abstract', 'deprecated', 'declaration', 'documentation', 'member', 'async', 'testModifier']; const legend = new vscode.SemanticTokensLegend(tokenTypes, tokenModifiers); + const outputChannel = vscode.window.createOutputChannel('Semantic Tokens Test'); + const semanticHighlightProvider: vscode.SemanticTokensProvider = { provideSemanticTokens(document: vscode.TextDocument): vscode.ProviderResult { const builder = new vscode.SemanticTokensBuilder(); @@ -35,8 +37,13 @@ export function activate(context: vscode.ExtensionContext): any { builder.push(startLine, startCharacter, length, tokenType, tokenModifiers); + + const selectedModifiers = legend.tokenModifiers.filter((_val, bit) => tokenModifiers & (1 << bit)).join(' '); + outputChannel.appendLine(`line: ${startLine}, character: ${startCharacter}, length ${length}, ${legend.tokenTypes[tokenType]} (${tokenType}), ${selectedModifiers} ${tokenModifiers.toString(2)}`); } + outputChannel.appendLine('---'); + const visitor: jsoncParser.JSONVisitor = { onObjectProperty: (property: string, _offset: number, _length: number, startLine: number, startCharacter: number) => { addToken(property, startLine, startCharacter, property.length + 2); diff --git a/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json new file mode 100644 index 00000000000..c91ebc862e9 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "editor.tokenColorCustomizationsExperimental": { + "class": "#00b0b0", + "interface": "#845faf", + "function": "#ff00ff", + "*.declaration": { + "fontStyle": "underline" + }, + "*.declaration.member": { + "fontStyle": "italic bold", + } + } +} \ No newline at end of file diff --git a/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json new file mode 100644 index 00000000000..b250b5d2bc1 --- /dev/null +++ b/extensions/vscode-colorize-tests/test/semantic-test/semantic-test.json @@ -0,0 +1,9 @@ +[ + "class", "function.member.declaration", + "parameterType.declaration", "type", "parameterType.declaration", "type", + "variable.declaration", "parameterNames", + "function.member.declaration", + "interface.declaration", + "function.member.declaration", "testToken.testModifier" + +] From 5dcf359526c8458a80d3ab6608231d8fb899cb8b Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 12 Dec 2019 12:12:29 +0100 Subject: [PATCH 371/637] add tracing to SemanticColoringProviderStyling --- .../common/services/modelServiceImpl.ts | 23 ++++++++++++------- .../smartSelect/test/smartSelect.test.ts | 3 ++- .../standalone/browser/standaloneServices.ts | 6 ++--- .../test/common/services/modelService.test.ts | 3 ++- .../api/mainThreadDocumentsAndEditors.test.ts | 3 ++- .../api/mainThreadEditors.test.ts | 2 +- .../quickopen.perf.integrationTest.ts | 3 ++- .../textsearch.perf.integrationTest.ts | 5 ++-- 8 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 4ba21e84bf6..ec7b72d1dc5 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -14,7 +14,7 @@ import { Range } from 'vs/editor/common/core/range'; import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model'; import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel'; import { IModelLanguageChangedEvent, IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents'; -import { LanguageIdentifier, SemanticTokensProviderRegistry, SemanticTokensProvider, SemanticTokensLegend, SemanticTokens, SemanticTokensEdits } from 'vs/editor/common/modes'; +import { LanguageIdentifier, SemanticTokensProviderRegistry, SemanticTokensProvider, SemanticTokensLegend, SemanticTokens, SemanticTokensEdits, TokenMetadata } from 'vs/editor/common/modes'; import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegistry'; import { ILanguageSelection } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -24,6 +24,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { SparseEncodedTokens, MultilineTokens2 } from 'vs/editor/common/model/tokensStore'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { ILogService, LogLevel } from 'vs/platform/log/common/log'; function MODEL_ID(resource: URI): string { return resource.toString(); @@ -120,7 +121,8 @@ export class ModelServiceImpl extends Disposable implements IModelService { constructor( @IConfigurationService configurationService: IConfigurationService, @ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService, - @IThemeService themeService: IThemeService + @IThemeService themeService: IThemeService, + @ILogService logService: ILogService ) { super(); this._configurationService = configurationService; @@ -131,7 +133,7 @@ export class ModelServiceImpl extends Disposable implements IModelService { this._configurationServiceSubscription = this._configurationService.onDidChangeConfiguration(e => this._updateModelOptions()); this._updateModelOptions(); - this._register(new SemanticColoringFeature(this, themeService)); + this._register(new SemanticColoringFeature(this, themeService, logService)); } private static _readModelOptions(config: IRawConfig, isForSimpleWidget: boolean): ITextModelCreationOptions { @@ -443,10 +445,10 @@ class SemanticColoringFeature extends Disposable { private _watchers: Record; private _semanticStyling: SemanticStyling; - constructor(modelService: IModelService, themeService: IThemeService) { + constructor(modelService: IModelService, themeService: IThemeService, logService: ILogService) { super(); this._watchers = Object.create(null); - this._semanticStyling = this._register(new SemanticStyling(themeService)); + this._semanticStyling = this._register(new SemanticStyling(themeService, logService)); this._register(modelService.onModelAdded((model) => { this._watchers[model.uri.toString()] = new ModelSemanticColoring(model, themeService, this._semanticStyling); })); @@ -462,7 +464,8 @@ class SemanticStyling extends Disposable { private _caches: WeakMap; constructor( - private readonly _themeService: IThemeService + private readonly _themeService: IThemeService, + private readonly _logService: ILogService ) { super(); this._caches = new WeakMap(); @@ -476,7 +479,7 @@ class SemanticStyling extends Disposable { public get(provider: SemanticTokensProvider): SemanticColoringProviderStyling { if (!this._caches.has(provider)) { - this._caches.set(provider, new SemanticColoringProviderStyling(provider.getLegend(), this._themeService)); + this._caches.set(provider, new SemanticColoringProviderStyling(provider.getLegend(), this._themeService, this._logService)); } return this._caches.get(provider)!; } @@ -581,7 +584,8 @@ class SemanticColoringProviderStyling { constructor( private readonly _legend: SemanticTokensLegend, - private readonly _themeService: IThemeService + private readonly _themeService: IThemeService, + private readonly _logService: ILogService ) { this._hashTable = new HashTable(); } @@ -605,6 +609,9 @@ class SemanticColoringProviderStyling { if (typeof metadata === 'undefined') { metadata = Constants.NO_STYLING; } + if (this._logService.getLevel() === LogLevel.Trace) { + this._logService.trace(`getTokenStyleMetadata(${tokenType}${tokenModifiers.length ? ', ' + tokenModifiers.join(' ') : ''}): foreground: ${TokenMetadata.getForeground(metadata)}, fontStyle ${TokenMetadata.getFontStyle(metadata).toString(2)}`); + } this._hashTable.add(tokenTypeIndex, tokenModifierSet, metadata); return metadata; diff --git a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts index b161849905b..2b19d53b201 100644 --- a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts +++ b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts @@ -18,6 +18,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSelections'; import { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/modelService.test'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { NullLogService } from 'vs/platform/log/common/log'; class MockJSMode extends MockMode { @@ -46,7 +47,7 @@ suite('SmartSelect', () => { setup(() => { const configurationService = new TestConfigurationService(); - modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService()); + modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService), new TestThemeService(), new NullLogService()); mode = new MockJSMode(); }); diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts index 41fadf14389..401c423f0d4 100644 --- a/src/vs/editor/standalone/browser/standaloneServices.ts +++ b/src/vs/editor/standalone/browser/standaloneServices.ts @@ -146,7 +146,9 @@ export module StaticServices { export const standaloneThemeService = define(IStandaloneThemeService, () => new StandaloneThemeServiceImpl()); - export const modelService = define(IModelService, (o) => new ModelServiceImpl(configurationService.get(o), resourcePropertiesService.get(o), standaloneThemeService.get(o))); + export const logService = define(ILogService, () => new NullLogService()); + + export const modelService = define(IModelService, (o) => new ModelServiceImpl(configurationService.get(o), resourcePropertiesService.get(o), standaloneThemeService.get(o), logService.get(o))); export const markerDecorationsService = define(IMarkerDecorationsService, (o) => new MarkerDecorationsService(modelService.get(o), markerService.get(o))); @@ -156,8 +158,6 @@ export module StaticServices { export const storageService = define(IStorageService, () => new InMemoryStorageService()); - export const logService = define(ILogService, () => new NullLogService()); - export const editorWorkerService = define(IEditorWorkerService, (o) => new EditorWorkerServiceImpl(modelService.get(o), resourceConfigurationService.get(o), logService.get(o))); } diff --git a/src/vs/editor/test/common/services/modelService.test.ts b/src/vs/editor/test/common/services/modelService.test.ts index 8b72a3493c3..369f1211c43 100644 --- a/src/vs/editor/test/common/services/modelService.test.ts +++ b/src/vs/editor/test/common/services/modelService.test.ts @@ -17,6 +17,7 @@ import { ITextResourcePropertiesService } from 'vs/editor/common/services/resour import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { NullLogService } from 'vs/platform/log/common/log'; const GENERATE_TESTS = false; @@ -28,7 +29,7 @@ suite('ModelService', () => { configService.setUserConfiguration('files', { 'eol': '\n' }); configService.setUserConfiguration('files', { 'eol': '\r\n' }, URI.file(platform.isWindows ? 'c:\\myroot' : '/myroot')); - modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService()); + modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService()); }); teardown(() => { diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts index f8d30bbaf7f..0703fb2ac59 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts @@ -21,6 +21,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService import { IFileService } from 'vs/platform/files/common/files'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { NullLogService } from 'vs/platform/log/common/log'; suite('MainThreadDocumentsAndEditors', () => { @@ -43,7 +44,7 @@ suite('MainThreadDocumentsAndEditors', () => { deltas.length = 0; const configService = new TestConfigurationService(); configService.setUserConfiguration('editor', { 'detectIndentation': false }); - modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService()); + modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService()); codeEditorService = new TestCodeEditorService(); textFileService = new class extends mock() { isDirty() { return false; } diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts index 5707d1fa6bb..ddd525330e6 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -43,7 +43,7 @@ suite('MainThreadEditors', () => { setup(() => { const configService = new TestConfigurationService(); - modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService()); + modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService), new TestThemeService(), new NullLogService()); const codeEditorService = new TestCodeEditorService(); movedResources.clear(); diff --git a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts index bd24a27bebe..6858abe8852 100644 --- a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts +++ b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts @@ -31,6 +31,7 @@ import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbe import { TestContextService, TestEditorGroupsService, TestEditorService, TestEnvironmentService, TestTextResourcePropertiesService } from 'vs/workbench/test/workbenchTestServices'; import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/platform/telemetry/common/gdprTypings'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { NullLogService } from 'vs/platform/log/common/log'; namespace Timer { export interface ITimerEvent { @@ -74,7 +75,7 @@ suite.skip('QuickOpen performance (integration)', () => { [ITelemetryService, telemetryService], [IConfigurationService, configurationService], [ITextResourcePropertiesService, textResourcePropertiesService], - [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService, new TestThemeService())], + [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService, new TestThemeService(), new NullLogService())], [IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))], [IEditorService, new TestEditorService()], [IEditorGroupsService, new TestEditorGroupsService()], diff --git a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts index d4eb6ee2728..60c7269c714 100644 --- a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts +++ b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts @@ -60,18 +60,19 @@ suite.skip('TextSearch performance (integration)', () => { const telemetryService = new TestTelemetryService(); const configurationService = new TestConfigurationService(); const textResourcePropertiesService = new TestTextResourcePropertiesService(configurationService); + const logService = new NullLogService(); const instantiationService = new InstantiationService(new ServiceCollection( [ITelemetryService, telemetryService], [IConfigurationService, configurationService], [ITextResourcePropertiesService, textResourcePropertiesService], - [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService, new TestThemeService())], + [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService, new TestThemeService(), logService)], [IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))], [IEditorService, new TestEditorService()], [IEditorGroupsService, new TestEditorGroupsService()], [IEnvironmentService, TestEnvironmentService], [IUntitledTextEditorService, createSyncDescriptor(UntitledTextEditorService)], [ISearchService, createSyncDescriptor(LocalSearchService)], - [ILogService, new NullLogService()] + [ILogService, logService] )); const queryOptions: ITextQueryBuilderOptions = { From bc38acf1a4c9de83bbbb8fe950b5d21e4775fb22 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 12 Dec 2019 14:43:16 +0100 Subject: [PATCH 372/637] Use passive: false when it is intentional (fixes microsoft/monaco-editor#1122) --- src/vs/base/browser/dom.ts | 6 +++--- src/vs/base/browser/ui/scrollbar/scrollableElement.ts | 2 +- src/vs/editor/browser/controller/mouseHandler.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index a377409075c..b7a55a4ca64 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -232,9 +232,9 @@ class DomListener implements IDisposable { export function addDisposableListener(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable; export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable; -export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture: AddEventListenerOptions): IDisposable; -export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean | AddEventListenerOptions): IDisposable { - return new DomListener(node, type, handler, useCapture); +export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable; +export function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable { + return new DomListener(node, type, handler, useCaptureOrOptions); } export interface IAddStandardDisposableListenerSignature { diff --git a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts index c61cf6267c1..462cf44c0b7 100644 --- a/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +++ b/src/vs/base/browser/ui/scrollbar/scrollableElement.ts @@ -317,7 +317,7 @@ export abstract class AbstractScrollableElement extends Widget { this._onMouseWheel(new StandardWheelEvent(browserEvent)); }; - this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel)); + this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false })); } } diff --git a/src/vs/editor/browser/controller/mouseHandler.ts b/src/vs/editor/browser/controller/mouseHandler.ts index 6b5b7d372c7..973a5ca1d3d 100644 --- a/src/vs/editor/browser/controller/mouseHandler.ts +++ b/src/vs/editor/browser/controller/mouseHandler.ts @@ -122,7 +122,7 @@ export class MouseHandler extends ViewEventHandler { e.stopPropagation(); } }; - this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, true)); + this._register(dom.addDisposableListener(this.viewHelper.viewDomNode, browser.isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { capture: true, passive: false })); this._context.addEventHandler(this); } From 929c420d8a0fdeb77174463d30ac99aec813b0a2 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Thu, 12 Dec 2019 14:48:19 +0100 Subject: [PATCH 373/637] rename debug API's onSendMessage to onDidSendMessage --- extensions/vscode-api-tests/src/extension.ts | 2 +- src/vs/vscode.proposed.d.ts | 4 ++-- src/vs/workbench/api/common/extHostDebugService.ts | 4 ++-- src/vs/workbench/contrib/debug/common/debug.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/vscode-api-tests/src/extension.ts b/extensions/vscode-api-tests/src/extension.ts index 162528cecea..279833c2391 100644 --- a/extensions/vscode-api-tests/src/extension.ts +++ b/extensions/vscode-api-tests/src/extension.ts @@ -2819,7 +2819,7 @@ export class ProtocolServer implements vscode.DebugAdapter { onError: vscode.Event = this.error.event; private sendMessage = new vscode.EventEmitter(); - readonly onSendMessage: vscode.Event = this.sendMessage.event; + readonly onDidSendMessage: vscode.Event = this.sendMessage.event; private _sequence: number = 1; private _pendingRequests = new Map void>(); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 36683346748..8ef405a7e4d 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -797,10 +797,10 @@ declare module 'vscode' { export interface DebugAdapter extends Disposable { /** - * An event which fires when the debug adapter sends a Debug Adapter Protocol message to VS Code. + * An event which fires after the debug adapter has sent a Debug Adapter Protocol message to VS Code. * Messages can be requests, responses, or events. */ - readonly onSendMessage: Event; + readonly onDidSendMessage: Event; /** * Handle a Debug Adapter Protocol message. diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index 499d4c257f7..14d70184a23 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -1049,8 +1049,8 @@ class DirectDebugAdapter extends AbstractDebugAdapter { constructor(private implementation: vscode.DebugAdapter) { super(); - if (this.implementation.onSendMessage) { - implementation.onSendMessage((message: DebugProtocol.ProtocolMessage) => { + if (this.implementation.onDidSendMessage) { + implementation.onDidSendMessage((message: DebugProtocol.ProtocolMessage) => { this.acceptMessage(message); }); } diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 06639384c6c..10118761779 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -548,7 +548,7 @@ export interface IDebugAdapterServer { } export interface IDebugAdapterInlineImpl extends IDisposable { - readonly onSendMessage: Event; + readonly onDidSendMessage: Event; handleMessage(message: DebugProtocol.Message): void; } From 85112b01b0110cbd885d3624a50df9186faa182b Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Dec 2019 15:08:37 +0100 Subject: [PATCH 374/637] enable strictFunctionTypes in VS Code codebase --- src/vs/workbench/api/common/extHostDebugService.ts | 6 +++--- src/vs/workbench/contrib/debug/browser/rawDebugSession.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/api/common/extHostDebugService.ts b/src/vs/workbench/api/common/extHostDebugService.ts index 14d70184a23..c1352774e0d 100644 --- a/src/vs/workbench/api/common/extHostDebugService.ts +++ b/src/vs/workbench/api/common/extHostDebugService.ts @@ -825,7 +825,7 @@ export class ExtHostDebugServiceBase implements IExtHostDebugService, ExtHostDeb if (aex) { const folder = session.workspaceFolder; const rootFolder = folder ? folder.uri.toString() : undefined; - return this._commandService.executeCommand(aex, rootFolder).then((ae: { command: string, args: string[] }) => { + return this._commandService.executeCommand(aex, rootFolder).then((ae: any) => { return new DebugAdapterExecutable(ae.command, ae.args || []); }); } @@ -1050,8 +1050,8 @@ class DirectDebugAdapter extends AbstractDebugAdapter { super(); if (this.implementation.onDidSendMessage) { - implementation.onDidSendMessage((message: DebugProtocol.ProtocolMessage) => { - this.acceptMessage(message); + implementation.onDidSendMessage((message: vscode.DebugProtocolMessage) => { + this.acceptMessage(message as DebugProtocol.ProtocolMessage); }); } } diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index bddadea7078..e1f8c1e665c 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -598,13 +598,13 @@ export class RawDebugSession implements IDisposable { } private send(command: string, args: any, token?: CancellationToken, timeout?: number): Promise { - return new Promise((completeDispatch, errorDispatch) => { + return new Promise((completeDispatch, errorDispatch) => { if (!this.debugAdapter) { errorDispatch(new Error('no debug adapter found')); return; } let cancelationListener: IDisposable; - const requestId = this.debugAdapter.sendRequest(command, args, (response: R) => { + const requestId = this.debugAdapter.sendRequest(command, args, (response: DebugProtocol.Response) => { if (cancelationListener) { cancelationListener.dispose(); } From 85d031105b7e81f002d772293216145cae02bfe2 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Dec 2019 15:52:41 +0100 Subject: [PATCH 375/637] debug: introduce debugTaskRunner --- .../contrib/debug/browser/debugService.ts | 164 ++--------------- .../contrib/debug/browser/debugTaskRunner.ts | 169 ++++++++++++++++++ .../contrib/debug/browser/startView.ts | 1 - 3 files changed, 179 insertions(+), 155 deletions(-) create mode 100644 src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 023552bf0ff..b1892e1364e 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -11,7 +11,6 @@ import * as errors from 'vs/base/common/errors'; import severity from 'vs/base/common/severity'; import * as aria from 'vs/base/browser/ui/aria/aria'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { IMarkerService } from 'vs/platform/markers/common/markers'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -22,18 +21,15 @@ import { DebugModel, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expres import { ViewModel } from 'vs/workbench/contrib/debug/common/debugViewModel'; import * as debugactions from 'vs/workbench/contrib/debug/browser/debugActions'; import { ConfigurationManager } from 'vs/workbench/contrib/debug/browser/debugConfigurationManager'; -import Constants from 'vs/workbench/contrib/markers/browser/constants'; -import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService'; import { VIEWLET_ID as EXPLORER_VIEWLET_ID } from 'vs/workbench/contrib/files/common/files'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { parse, getFirstFrame } from 'vs/base/common/console'; -import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IAction } from 'vs/base/common/actions'; @@ -42,12 +38,12 @@ import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession'; import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, REPL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IEnablement, IBreakpoint, IBreakpointData, ICompound, IGlobalConfig, IStackFrame, AdapterEndEvent, getStateLabel, IDebugSessionOptions, CONTEXT_DEBUG_UX } from 'vs/workbench/contrib/debug/common/debug'; import { getExtensionHostDebugSession } from 'vs/workbench/contrib/debug/common/debugUtils'; -import { isErrorWithActions, createErrorWithActions } from 'vs/base/common/errorsWithActions'; +import { isErrorWithActions } from 'vs/base/common/errorsWithActions'; import { RunOnceScheduler } from 'vs/base/common/async'; import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; -import { withUndefinedAsNull } from 'vs/base/common/types'; +import { TaskRunResult, DebugTaskRunner } from 'vs/workbench/contrib/debug/browser/debugTaskRunner'; const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint'; const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint'; @@ -55,23 +51,6 @@ const DEBUG_DATA_BREAKPOINTS_KEY = 'debug.databreakpoint'; const DEBUG_EXCEPTION_BREAKPOINTS_KEY = 'debug.exceptionbreakpoint'; const DEBUG_WATCH_EXPRESSIONS_KEY = 'debug.watchexpressions'; -function once(match: (e: TaskEvent) => boolean, event: Event): Event { - return (listener, thisArgs = null, disposables?) => { - const result = event(e => { - if (match(e)) { - result.dispose(); - return listener.call(thisArgs, e); - } - }, null, disposables); - return result; - }; -} - -const enum TaskRunResult { - Failure, - Success -} - export class DebugService implements IDebugService { _serviceBrand: undefined; @@ -81,6 +60,7 @@ export class DebugService implements IDebugService { private readonly _onDidEndSession: Emitter; private model: DebugModel; private viewModel: ViewModel; + private taskRunner: DebugTaskRunner; private configurationManager: ConfigurationManager; private toDispose: IDisposable[]; private debugType: IContextKey; @@ -107,8 +87,6 @@ export class DebugService implements IDebugService { @ILifecycleService private readonly lifecycleService: ILifecycleService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IExtensionService private readonly extensionService: IExtensionService, - @IMarkerService private readonly markerService: IMarkerService, - @ITaskService private readonly taskService: ITaskService, @IFileService private readonly fileService: IFileService, @IConfigurationService private readonly configurationService: IConfigurationService, @IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService @@ -136,6 +114,7 @@ export class DebugService implements IDebugService { this.toDispose.push(this.model); this.viewModel = new ViewModel(contextKeyService); + this.taskRunner = this.instantiationService.createInstance(DebugTaskRunner); this.toDispose.push(this.fileService.onFileChanges(e => this.onFileChanges(e))); this.lifecycleService.onShutdown(this.dispose, this); @@ -299,7 +278,7 @@ export class DebugService implements IDebugService { "Compound must have \"configurations\" attribute set in order to start multiple configurations.")); } if (compound.preLaunchTask) { - const taskResult = await this.runTaskAndCheckErrors(launch?.workspace || this.contextService.getWorkspace(), compound.preLaunchTask); + const taskResult = await this.taskRunner.runTaskAndCheckErrors(launch?.workspace || this.contextService.getWorkspace(), compound.preLaunchTask, this.showError); if (taskResult === TaskRunResult.Failure) { this.endInitializingState(); return false; @@ -411,7 +390,7 @@ export class DebugService implements IDebugService { } const workspace = launch ? launch.workspace : this.contextService.getWorkspace(); - const taskResult = await this.runTaskAndCheckErrors(workspace, resolvedConfig.preLaunchTask); + const taskResult = await this.taskRunner.runTaskAndCheckErrors(workspace, resolvedConfig.preLaunchTask, this.showError); if (taskResult === TaskRunResult.Success) { return this.doCreateSession(launch?.workspace, { resolved: resolvedConfig, unresolved: unresolvedConfig }, options); } @@ -548,7 +527,7 @@ export class DebugService implements IDebugService { if (session.configuration.postDebugTask) { try { - await this.runTask(session.root, session.configuration.postDebugTask); + await this.taskRunner.runTask(session.root, session.configuration.postDebugTask); } catch (err) { this.notificationService.error(err); } @@ -587,8 +566,8 @@ export class DebugService implements IDebugService { return Promise.resolve(TaskRunResult.Success); } - await this.runTask(session.root, session.configuration.postDebugTask); - return this.runTaskAndCheckErrors(session.root, session.configuration.preLaunchTask); + await this.taskRunner.runTask(session.root, session.configuration.postDebugTask); + return this.taskRunner.runTaskAndCheckErrors(session.root, session.configuration.preLaunchTask, this.showError); }; const extensionDebugSession = getExtensionHostDebugSession(session); @@ -715,129 +694,6 @@ export class DebugService implements IDebugService { return undefined; } - //---- task management - - private async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined): Promise { - try { - const taskSummary = await this.runTask(root, taskId); - - const errorCount = taskId ? this.markerService.getStatistics().errors : 0; - const successExitCode = taskSummary && taskSummary.exitCode === 0; - const failureExitCode = taskSummary && taskSummary.exitCode !== 0; - const onTaskErrors = this.configurationService.getValue('debug').onTaskErrors; - if (successExitCode || onTaskErrors === 'debugAnyway' || (errorCount === 0 && !failureExitCode)) { - return TaskRunResult.Success; - } - if (onTaskErrors === 'showErrors') { - this.panelService.openPanel(Constants.MARKERS_PANEL_ID); - return Promise.resolve(TaskRunResult.Failure); - } - - const taskLabel = typeof taskId === 'string' ? taskId : taskId ? taskId.name : ''; - const message = errorCount > 1 - ? nls.localize('preLaunchTaskErrors', "Errors exist after running preLaunchTask '{0}'.", taskLabel) - : errorCount === 1 - ? nls.localize('preLaunchTaskError', "Error exists after running preLaunchTask '{0}'.", taskLabel) - : nls.localize('preLaunchTaskExitCode', "The preLaunchTask '{0}' terminated with exit code {1}.", taskLabel, taskSummary ? taskSummary.exitCode : 0); - - const result = await this.dialogService.show(severity.Warning, message, [nls.localize('debugAnyway', "Debug Anyway"), nls.localize('showErrors', "Show Errors"), nls.localize('cancel', "Cancel")], { - checkbox: { - label: nls.localize('remember', "Remember my choice in user settings"), - }, - cancelId: 2 - }); - - if (result.choice === 2) { - return Promise.resolve(TaskRunResult.Failure); - } - const debugAnyway = result.choice === 0; - if (result.checkboxChecked) { - this.configurationService.updateValue('debug.onTaskErrors', debugAnyway ? 'debugAnyway' : 'showErrors'); - } - if (debugAnyway) { - return TaskRunResult.Success; - } - - this.panelService.openPanel(Constants.MARKERS_PANEL_ID); - return Promise.resolve(TaskRunResult.Failure); - } catch (err) { - await this.showError(err.message, [this.taskService.configureAction()]); - return TaskRunResult.Failure; - } - } - - private async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | TaskIdentifier | undefined): Promise { - if (!taskId) { - return Promise.resolve(null); - } - if (!root) { - return Promise.reject(new Error(nls.localize('invalidTaskReference', "Task '{0}' can not be referenced from a launch configuration that is in a different workspace folder.", typeof taskId === 'string' ? taskId : taskId.type))); - } - // run a task before starting a debug session - const task = await this.taskService.getTask(root, taskId); - if (!task) { - const errorMessage = typeof taskId === 'string' - ? nls.localize('DebugTaskNotFoundWithTaskId', "Could not find the task '{0}'.", taskId) - : nls.localize('DebugTaskNotFound', "Could not find the specified task."); - return Promise.reject(createErrorWithActions(errorMessage)); - } - - // If a task is missing the problem matcher the promise will never complete, so we need to have a workaround #35340 - let taskStarted = false; - const inactivePromise: Promise = new Promise((c, e) => once(e => { - // When a task isBackground it will go inactive when it is safe to launch. - // But when a background task is terminated by the user, it will also fire an inactive event. - // This means that we will not get to see the real exit code from running the task (undefined when terminated by the user). - // Catch the ProcessEnded event here, which occurs before inactive, and capture the exit code to prevent this. - return (e.kind === TaskEventKind.Inactive - || (e.kind === TaskEventKind.ProcessEnded && e.exitCode === undefined)) - && e.taskId === task._id; - }, this.taskService.onDidStateChange)(e => { - taskStarted = true; - c(e.kind === TaskEventKind.ProcessEnded ? { exitCode: e.exitCode } : null); - })); - - const promise: Promise = this.taskService.getActiveTasks().then(async (tasks): Promise => { - if (tasks.filter(t => t._id === task._id).length) { - // Check that the task isn't busy and if it is, wait for it - const busyTasks = await this.taskService.getBusyTasks(); - if (busyTasks.filter(t => t._id === task._id).length) { - taskStarted = true; - return inactivePromise; - } - // task is already running and isn't busy - nothing to do. - return Promise.resolve(null); - } - once(e => ((e.kind === TaskEventKind.Active) || (e.kind === TaskEventKind.DependsOnStarted)) && e.taskId === task._id, this.taskService.onDidStateChange)(() => { - // Task is active, so everything seems to be fine, no need to prompt after 10 seconds - // Use case being a slow running task should not be prompted even though it takes more than 10 seconds - taskStarted = true; - }); - const taskPromise = this.taskService.run(task); - if (task.configurationProperties.isBackground) { - return inactivePromise; - } - - return taskPromise.then(withUndefinedAsNull); - }); - - return new Promise((c, e) => { - promise.then(result => { - taskStarted = true; - c(result); - }, error => e(error)); - - setTimeout(() => { - if (!taskStarted) { - const errorMessage = typeof taskId === 'string' - ? nls.localize('taskNotTrackedWithTaskId', "The specified task cannot be tracked.") - : nls.localize('taskNotTracked', "The task '{0}' cannot be tracked.", JSON.stringify(taskId)); - e({ severity: severity.Error, message: errorMessage }); - } - }, 10000); - }); - } - //---- focus management async focusStackFrame(stackFrame: IStackFrame | undefined, thread?: IThread, session?: IDebugSession, explicit?: boolean): Promise { diff --git a/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts b/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts new file mode 100644 index 00000000000..19e63db2dac --- /dev/null +++ b/src/vs/workbench/contrib/debug/browser/debugTaskRunner.ts @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as nls from 'vs/nls'; +import severity from 'vs/base/common/severity'; +import { Event } from 'vs/base/common/event'; +import Constants from 'vs/workbench/contrib/markers/browser/constants'; +import { ITaskService, ITaskSummary } from 'vs/workbench/contrib/tasks/common/taskService'; +import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace'; +import { TaskEvent, TaskEventKind, TaskIdentifier } from 'vs/workbench/contrib/tasks/common/tasks'; +import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; +import { IAction } from 'vs/base/common/actions'; +import { withUndefinedAsNull } from 'vs/base/common/types'; +import { IMarkerService } from 'vs/platform/markers/common/markers'; +import { IDebugConfiguration } from 'vs/workbench/contrib/debug/common/debug'; +import { createErrorWithActions } from 'vs/base/common/errorsWithActions'; + +function once(match: (e: TaskEvent) => boolean, event: Event): Event { + return (listener, thisArgs = null, disposables?) => { + const result = event(e => { + if (match(e)) { + result.dispose(); + return listener.call(thisArgs, e); + } + }, null, disposables); + return result; + }; +} + +export const enum TaskRunResult { + Failure, + Success +} + +export class DebugTaskRunner { + + constructor( + @ITaskService private readonly taskService: ITaskService, + @IMarkerService private readonly markerService: IMarkerService, + @IConfigurationService private readonly configurationService: IConfigurationService, + @IPanelService private readonly panelService: IPanelService, + @IDialogService private readonly dialogService: IDialogService, + ) { } + + async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined, onError: (msg: string, actions: IAction[]) => Promise): Promise { + try { + const taskSummary = await this.runTask(root, taskId); + + const errorCount = taskId ? this.markerService.getStatistics().errors : 0; + const successExitCode = taskSummary && taskSummary.exitCode === 0; + const failureExitCode = taskSummary && taskSummary.exitCode !== 0; + const onTaskErrors = this.configurationService.getValue('debug').onTaskErrors; + if (successExitCode || onTaskErrors === 'debugAnyway' || (errorCount === 0 && !failureExitCode)) { + return TaskRunResult.Success; + } + if (onTaskErrors === 'showErrors') { + this.panelService.openPanel(Constants.MARKERS_PANEL_ID); + return Promise.resolve(TaskRunResult.Failure); + } + + const taskLabel = typeof taskId === 'string' ? taskId : taskId ? taskId.name : ''; + const message = errorCount > 1 + ? nls.localize('preLaunchTaskErrors', "Errors exist after running preLaunchTask '{0}'.", taskLabel) + : errorCount === 1 + ? nls.localize('preLaunchTaskError', "Error exists after running preLaunchTask '{0}'.", taskLabel) + : nls.localize('preLaunchTaskExitCode', "The preLaunchTask '{0}' terminated with exit code {1}.", taskLabel, taskSummary ? taskSummary.exitCode : 0); + + const result = await this.dialogService.show(severity.Warning, message, [nls.localize('debugAnyway', "Debug Anyway"), nls.localize('showErrors', "Show Errors"), nls.localize('cancel', "Cancel")], { + checkbox: { + label: nls.localize('remember', "Remember my choice in user settings"), + }, + cancelId: 2 + }); + + if (result.choice === 2) { + return Promise.resolve(TaskRunResult.Failure); + } + const debugAnyway = result.choice === 0; + if (result.checkboxChecked) { + this.configurationService.updateValue('debug.onTaskErrors', debugAnyway ? 'debugAnyway' : 'showErrors'); + } + if (debugAnyway) { + return TaskRunResult.Success; + } + + this.panelService.openPanel(Constants.MARKERS_PANEL_ID); + return Promise.resolve(TaskRunResult.Failure); + } catch (err) { + await onError(err.message, [this.taskService.configureAction()]); + return TaskRunResult.Failure; + } + } + + async runTask(root: IWorkspace | IWorkspaceFolder | undefined, taskId: string | TaskIdentifier | undefined): Promise { + if (!taskId) { + return Promise.resolve(null); + } + if (!root) { + return Promise.reject(new Error(nls.localize('invalidTaskReference', "Task '{0}' can not be referenced from a launch configuration that is in a different workspace folder.", typeof taskId === 'string' ? taskId : taskId.type))); + } + // run a task before starting a debug session + const task = await this.taskService.getTask(root, taskId); + if (!task) { + const errorMessage = typeof taskId === 'string' + ? nls.localize('DebugTaskNotFoundWithTaskId', "Could not find the task '{0}'.", taskId) + : nls.localize('DebugTaskNotFound', "Could not find the specified task."); + return Promise.reject(createErrorWithActions(errorMessage)); + } + + // If a task is missing the problem matcher the promise will never complete, so we need to have a workaround #35340 + let taskStarted = false; + const inactivePromise: Promise = new Promise((c, e) => once(e => { + // When a task isBackground it will go inactive when it is safe to launch. + // But when a background task is terminated by the user, it will also fire an inactive event. + // This means that we will not get to see the real exit code from running the task (undefined when terminated by the user). + // Catch the ProcessEnded event here, which occurs before inactive, and capture the exit code to prevent this. + return (e.kind === TaskEventKind.Inactive + || (e.kind === TaskEventKind.ProcessEnded && e.exitCode === undefined)) + && e.taskId === task._id; + }, this.taskService.onDidStateChange)(e => { + taskStarted = true; + c(e.kind === TaskEventKind.ProcessEnded ? { exitCode: e.exitCode } : null); + })); + + const promise: Promise = this.taskService.getActiveTasks().then(async (tasks): Promise => { + if (tasks.filter(t => t._id === task._id).length) { + // Check that the task isn't busy and if it is, wait for it + const busyTasks = await this.taskService.getBusyTasks(); + if (busyTasks.filter(t => t._id === task._id).length) { + taskStarted = true; + return inactivePromise; + } + // task is already running and isn't busy - nothing to do. + return Promise.resolve(null); + } + once(e => ((e.kind === TaskEventKind.Active) || (e.kind === TaskEventKind.DependsOnStarted)) && e.taskId === task._id, this.taskService.onDidStateChange)(() => { + // Task is active, so everything seems to be fine, no need to prompt after 10 seconds + // Use case being a slow running task should not be prompted even though it takes more than 10 seconds + taskStarted = true; + }); + const taskPromise = this.taskService.run(task); + if (task.configurationProperties.isBackground) { + return inactivePromise; + } + + return taskPromise.then(withUndefinedAsNull); + }); + + return new Promise((c, e) => { + promise.then(result => { + taskStarted = true; + c(result); + }, error => e(error)); + + setTimeout(() => { + if (!taskStarted) { + const errorMessage = typeof taskId === 'string' + ? nls.localize('taskNotTrackedWithTaskId', "The specified task cannot be tracked.") + : nls.localize('taskNotTracked', "The task '{0}' cannot be tracked.", JSON.stringify(taskId)); + e({ severity: severity.Error, message: errorMessage }); + } + }, 10000); + }); + } +} diff --git a/src/vs/workbench/contrib/debug/browser/startView.ts b/src/vs/workbench/contrib/debug/browser/startView.ts index 04a73b0eca6..a8dcf0f3cef 100644 --- a/src/vs/workbench/contrib/debug/browser/startView.ts +++ b/src/vs/workbench/contrib/debug/browser/startView.ts @@ -25,7 +25,6 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; const $ = dom.$; - export class StartView extends ViewPane { static ID = 'workbench.debug.startView'; From 2ccb11e61c5d3c89a0ba9d76340b3e986509ccf5 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 12 Dec 2019 16:16:38 +0100 Subject: [PATCH 376/637] Enhance change event to be override identifier aware --- .../services/resourceConfigurationImpl.ts | 10 +- .../configuration/common/configuration.ts | 20 +- .../common/configurationModels.ts | 258 +++++++++--------- .../node/configurationService.ts | 25 +- .../test/common/configurationModels.test.ts | 68 ++--- .../test/node/configurationService.test.ts | 20 +- .../api/browser/mainThreadConfiguration.ts | 24 +- .../workbench/api/common/extHost.protocol.ts | 9 +- .../api/common/extHostConfiguration.ts | 49 +--- .../browser/configurationService.ts | 83 +++--- .../common/configurationModels.ts | 125 ++------- .../api/extHostConfiguration.test.ts | 17 +- 12 files changed, 303 insertions(+), 405 deletions(-) diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts index c2d013b7ccd..d157eb7507a 100644 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ b/src/vs/editor/common/services/resourceConfigurationImpl.ts @@ -45,15 +45,15 @@ export class TextResourceConfigurationService extends Disposable implements ITex } switch (configurationTarget) { case ConfigurationTarget.MEMORY: - return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language); + return this._updateValue(key, value, configurationTarget, configurationValue.memoryTarget?.override, resource, language); case ConfigurationTarget.WORKSPACE_FOLDER: - return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language); + return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolderTarget?.override, resource, language); case ConfigurationTarget.WORKSPACE: - return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language); + return this._updateValue(key, value, configurationTarget, configurationValue.workspaceTarget?.override, resource, language); case ConfigurationTarget.USER_REMOTE: - return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language); + return this._updateValue(key, value, configurationTarget, configurationValue.userRemoteTarget?.override, resource, language); default: - return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language); + return this._updateValue(key, value, configurationTarget, configurationValue.userLocalTarget?.override, resource, language); } } diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index f51f707f6be..ffe876e4859 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -11,7 +11,6 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationRegistry, Extensions, OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/configuration/common/configurationRegistry'; -import { ResourceMap } from 'vs/base/common/map'; import { IStringDictionary } from 'vs/base/common/collections'; export const IConfigurationService = createDecorator('configurationService'); @@ -49,18 +48,21 @@ export function ConfigurationTargetToString(configurationTarget: ConfigurationTa } } +export interface IConfigurationChange { + keys: string[]; + overrides: [string, string[]][]; +} + export interface IConfigurationChangeEvent { - source: ConfigurationTarget; - affectedKeys: string[]; - affectsConfiguration(configuration: string, resource?: URI): boolean; + readonly source: ConfigurationTarget; + readonly affectedKeys: string[]; + readonly change: IConfigurationChange; + + affectsConfiguration(configuration: string, overrides?: IConfigurationOverrides): boolean; // Following data is used for telemetry - sourceConfig: any; - - // Following data is used for Extension host configuration event - changedConfiguration: IConfigurationModel; - changedConfigurationByResource: ResourceMap; + readonly sourceConfig: any; } export interface IConfigurationValue { diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index a56bae5e286..ecc33ce7e4d 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -4,13 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as json from 'vs/base/common/json'; -import { ResourceMap } from 'vs/base/common/map'; +import { ResourceMap, values, getOrSet } from 'vs/base/common/map'; import * as arrays from 'vs/base/common/arrays'; import * as types from 'vs/base/common/types'; import * as objects from 'vs/base/common/objects'; import { URI, UriComponents } from 'vs/base/common/uri'; import { OVERRIDE_PROPERTY_PATTERN, ConfigurationScope, IConfigurationRegistry, Extensions, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; -import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, IConfigurationChangeEvent, ConfigurationTarget, removeFromValueTree, toOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; +import { IOverrides, overrideIdentifierFromKey, addToValueTree, toValuesTree, IConfigurationModel, getConfigurationValue, IConfigurationOverrides, IConfigurationData, getDefaultValues, getConfigurationKeys, removeFromValueTree, toOverrides, IConfigurationValue, ConfigurationTarget, compare, IConfigurationChangeEvent, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; import { Workspace } from 'vs/platform/workspace/common/workspace'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -52,6 +52,15 @@ export class ConfigurationModel implements IConfigurationModel { : undefined; } + getKeysForOverrideIdentifier(identifier: string): string[] { + for (const override of this.overrides) { + if (override.identifiers.indexOf(identifier) !== -1) { + return override.keys; + } + } + return []; + } + override(identifier: string): ConfigurationModel { const overrideContents = this.getContentsForOverrideIdentifer(identifier); @@ -454,6 +463,32 @@ export class Configuration { this._foldersConsolidatedConfigurations.delete(resource); } + compareAndUpdateDefaultConfiguration(defaults: ConfigurationModel, keys: string[]): IConfigurationChange { + const overrides: [string, string[]][] = keys + .filter(key => OVERRIDE_PROPERTY_PATTERN.test(key)) + .map(overrideIdentifier => { + const fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier); + const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier); + const keys = [ + ...toKeys.filter(key => fromKeys.indexOf(key) === -1), + ...fromKeys.filter(key => toKeys.indexOf(key) === -1), + ...fromKeys.filter(key => !objects.equals(this._defaultConfiguration.override(overrideIdentifier).getValue(key), defaults.override(overrideIdentifier).getValue(key))) + ]; + return [overrideIdentifier, keys]; + }); + this.updateDefaultConfiguration(defaults); + return { keys, overrides }; + } + + compareAndUpdateLocalUserConfiguration(user: ConfigurationModel): IConfigurationChange { + const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user); + const keys = [...added, ...updated, ...removed]; + if (keys.length) { + this.updateLocalUserConfiguration(user); + } + return { keys, overrides }; + } + get defaults(): ConfigurationModel { return this._defaultConfiguration; } @@ -570,139 +605,118 @@ export class Configuration { }; } - allKeys(workspace: Workspace | undefined): string[] { - let keys = this.keys(workspace); - let all = [...keys.default]; - const addKeys = (keys: string[]) => { - for (const key of keys) { - if (all.indexOf(key) === -1) { - all.push(key); - } - } - }; - addKeys(keys.user); - addKeys(keys.workspace); - for (const resource of this.folderConfigurations.keys()) { - addKeys(this.folderConfigurations.get(resource)!.keys); - } - return all; + allKeys(): string[] { + const keys: Set = new Set(); + this._defaultConfiguration.freeze().keys.forEach(key => keys.add(key)); + this.userConfiguration.freeze().keys.forEach(key => keys.add(key)); + this._workspaceConfiguration.freeze().keys.forEach(key => keys.add(key)); + this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.freeze().keys.forEach(key => keys.add(key))); + return values(keys); } + + protected getAllKeysForOverrideIdentifier(overrideIdentifier: string): string[] { + const keys: Set = new Set(); + this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)); + this.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)); + this._workspaceConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key)); + this._folderConfigurations.forEach(folderConfiguraiton => folderConfiguraiton.getKeysForOverrideIdentifier(overrideIdentifier).forEach(key => keys.add(key))); + return values(keys); + } + + static parse(data: IConfigurationData): Configuration { + const defaultConfiguration = this.parseConfigurationModel(data.defaults); + const userConfiguration = this.parseConfigurationModel(data.user); + const workspaceConfiguration = this.parseConfigurationModel(data.workspace); + const folders: ResourceMap = data.folders.reduce((result, value) => { + result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1])); + return result; + }, new ResourceMap()); + return new Configuration(defaultConfiguration, userConfiguration, new ConfigurationModel(), workspaceConfiguration, folders, new ConfigurationModel(), new ResourceMap(), false); + } + + private static parseConfigurationModel(model: IConfigurationModel): ConfigurationModel { + return new ConfigurationModel(model.contents, model.keys, model.overrides).freeze(); + } + } -export class AbstractConfigurationChangeEvent { +export function mergeChanges(...changes: IConfigurationChange[]): IConfigurationChange { + if (changes.length === 0) { + return { keys: [], overrides: [] }; + } + if (changes.length === 1) { + return changes[0]; + } + const keysSet = new Set(); + const overridesMap = new Map>(); + for (const change of changes) { + change.keys.forEach(key => keysSet.add(key)); + change.overrides.forEach(([identifier, keys]) => { + const result = getOrSet(overridesMap, identifier, new Set()); + keys.forEach(key => result.add(key)); + }); + } + const overrides: [string, string[]][] = []; + overridesMap.forEach((keys, identifier) => overrides.push([identifier, values(keys)])); + return { keys: values(keysSet), overrides }; +} - protected doesConfigurationContains(configuration: ConfigurationModel, config: string): boolean { - let changedKeysTree = configuration.contents; - let requestedTree = toValuesTree({ [config]: true }, () => { }); +export class ConfigurationChangeEvent implements IConfigurationChangeEvent { + + private readonly affectedKeysTree: any; + readonly affectedKeys: string[]; + source!: ConfigurationTarget; + sourceConfig: any; + + constructor(readonly change: IConfigurationChange, private readonly previous: { workspace?: Workspace, data: IConfigurationData } | undefined, private readonly currentConfiguraiton: Configuration, private readonly currentWorkspace?: Workspace) { + const keysSet = new Set(); + change.keys.forEach(key => keysSet.add(key)); + change.overrides.forEach(([, keys]) => keys.forEach(key => keysSet.add(key))); + this.affectedKeys = values(keysSet); + + const configurationModel = new ConfigurationModel(); + this.affectedKeys.forEach(key => this.affectedKeysTree.setValue(key, {})); + this.affectedKeysTree = configurationModel.contents; + } + + private _previousConfiguration: Configuration | undefined = undefined; + get previousConfiguration(): Configuration | undefined { + if (!this._previousConfiguration && this.previous) { + this._previousConfiguration = Configuration.parse(this.previous.data); + } + return this._previousConfiguration; + } + + affectsConfiguration(section: string, overrides?: IConfigurationOverrides): boolean { + if (this.doesAffectedKeysTreeContains(this.affectedKeysTree, section)) { + if (overrides) { + const value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, this.previous?.workspace) : undefined; + const value2 = this.currentConfiguraiton.getValue(section, overrides, this.currentWorkspace); + return !objects.equals(value1, value2); + } + return true; + } + return false; + } + + private doesAffectedKeysTreeContains(affectedKeysTree: any, section: string): boolean { + let requestedTree = toValuesTree({ [section]: true }, () => { }); let key; while (typeof requestedTree === 'object' && (key = Object.keys(requestedTree)[0])) { // Only one key should present, since we added only one property - changedKeysTree = changedKeysTree[key]; - if (!changedKeysTree) { + affectedKeysTree = affectedKeysTree[key]; + if (!affectedKeysTree) { return false; // Requested tree is not found } requestedTree = requestedTree[key]; } return true; } - - protected updateKeys(configuration: ConfigurationModel, { keys, overrides }: IConfigurationChange, resource?: URI): void { - for (const key of keys) { - configuration.setValue(key, {}); - } - for (const [overrideIdentifier, keys] of overrides) { - configuration.setValue(overrideIdentifier, keys.reduce((value: any, key) => { value[key] = {}; return value; }, {})); - } - } } -export interface IConfigurationChange { - keys: string[]; - overrides: [string, string[]][]; -} - -export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent implements IConfigurationChangeEvent { - - private _source: ConfigurationTarget; - private _sourceConfig: any; - - constructor( - private _changedConfiguration: ConfigurationModel = new ConfigurationModel(), - private _changedConfigurationByResource: ResourceMap = new ResourceMap()) { - super(); - this._source = ConfigurationTarget.DEFAULT; - } - - get changedConfiguration(): IConfigurationModel { - return this._changedConfiguration; - } - - get changedConfigurationByResource(): ResourceMap { - return this._changedConfigurationByResource; - } - - change(changeEvent: ConfigurationChangeEvent): ConfigurationChangeEvent; - change(change: IConfigurationChange, resource?: URI): ConfigurationChangeEvent; - change(arg1: any, arg2?: any): ConfigurationChangeEvent { - if (arg1 instanceof ConfigurationChangeEvent) { - this._changedConfiguration = this._changedConfiguration.merge(arg1._changedConfiguration); - for (const resource of arg1._changedConfigurationByResource.keys()) { - let changedConfigurationByResource = this.getOrSetChangedConfigurationForResource(resource); - changedConfigurationByResource = changedConfigurationByResource.merge(arg1._changedConfigurationByResource.get(resource)!); - this._changedConfigurationByResource.set(resource, changedConfigurationByResource); - } - } else { - this.changeWithKeys(arg1, arg2); - } - return this; - } - - telemetryData(source: ConfigurationTarget, sourceConfig: any): ConfigurationChangeEvent { - this._source = source; - this._sourceConfig = sourceConfig; - return this; - } - - get affectedKeys(): string[] { - const keys = [...this._changedConfiguration.keys]; - this._changedConfigurationByResource.forEach(model => keys.push(...model.keys)); - return arrays.distinct(keys); - } - - get source(): ConfigurationTarget { - return this._source; - } - - get sourceConfig(): any { - return this._sourceConfig; - } - - affectsConfiguration(config: string, resource?: URI): boolean { - let configurationModelsToSearch: ConfigurationModel[] = [this._changedConfiguration]; - - if (resource) { - let model = this._changedConfigurationByResource.get(resource); - if (model) { - configurationModelsToSearch.push(model); - } - } else { - configurationModelsToSearch.push(...this._changedConfigurationByResource.values()); - } - - return configurationModelsToSearch.some(configuration => this.doesConfigurationContains(configuration, config)); - } - - private changeWithKeys(change: IConfigurationChange, resource?: URI): void { - let changedConfiguration = resource ? this.getOrSetChangedConfigurationForResource(resource) : this._changedConfiguration; - this.updateKeys(changedConfiguration, change); - } - - private getOrSetChangedConfigurationForResource(resource: URI): ConfigurationModel { - let changedConfigurationByResource = this._changedConfigurationByResource.get(resource); - if (!changedConfigurationByResource) { - changedConfigurationByResource = new ConfigurationModel(); - this._changedConfigurationByResource.set(resource, changedConfigurationByResource); - } - return changedConfigurationByResource; - } +export class AllKeysConfigurationChangeEvent extends ConfigurationChangeEvent { + constructor(configuration: Configuration, workspace: Workspace, public source: ConfigurationTarget, public sourceConfig: any) { + super({ keys: configuration.allKeys(), overrides: [] }, undefined, configuration, workspace); + } + } diff --git a/src/vs/platform/configuration/node/configurationService.ts b/src/vs/platform/configuration/node/configurationService.ts index ed6d2e88c3c..060236d5fad 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -6,8 +6,8 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; -import { IConfigurationService, IConfigurationChangeEvent, IConfigurationOverrides, ConfigurationTarget, compare, isConfigurationOverrides, IConfigurationData, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; -import { DefaultConfigurationModel, Configuration, ConfigurationChangeEvent, ConfigurationModel, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels'; +import { IConfigurationService, IConfigurationChangeEvent, IConfigurationOverrides, ConfigurationTarget, isConfigurationOverrides, IConfigurationData, IConfigurationValue, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; +import { DefaultConfigurationModel, Configuration, ConfigurationModel, ConfigurationModelParser, ConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; import { Event, Emitter } from 'vs/base/common/event'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import { ConfigWatcher } from 'vs/base/node/config'; @@ -103,21 +103,22 @@ export class ConfigurationService extends Disposable implements IConfigurationSe } private onDidChangeUserConfiguration(userConfigurationModel: ConfigurationModel): void { - const { added, updated, removed } = compare(this.configuration.localUserConfiguration, userConfigurationModel); - const changedKeys = [...added, ...updated, ...removed]; - if (changedKeys.length) { - this.configuration.updateLocalUserConfiguration(userConfigurationModel); - this.trigger(changedKeys, ConfigurationTarget.USER); - } + const previous = this.configuration.toData(); + const change = this.configuration.compareAndUpdateLocalUserConfiguration(userConfigurationModel); + this.trigger(change, previous, ConfigurationTarget.USER); } private onDidDefaultConfigurationChange(keys: string[]): void { - this.configuration.updateDefaultConfiguration(new DefaultConfigurationModel()); - this.trigger(keys, ConfigurationTarget.DEFAULT); + const previous = this.configuration.toData(); + const change = this.configuration.compareAndUpdateDefaultConfiguration(new DefaultConfigurationModel(), keys); + this.trigger(change, previous, ConfigurationTarget.DEFAULT); } - private trigger(keys: string[], source: ConfigurationTarget): void { - this._onDidChangeConfiguration.fire(new ConfigurationChangeEvent().change(keys).telemetryData(source, this.getTargetConfiguration(source))); + private trigger(configurationChange: IConfigurationChange, previous: IConfigurationData, source: ConfigurationTarget): void { + const event = new ConfigurationChangeEvent(configurationChange, { data: previous }, this.configuration); + event.source = source; + event.sourceConfig = this.getTargetConfiguration(source); + this._onDidChangeConfiguration.fire(event); } private getTargetConfiguration(target: ConfigurationTarget): any { diff --git a/src/vs/platform/configuration/test/common/configurationModels.test.ts b/src/vs/platform/configuration/test/common/configurationModels.test.ts index bf54767e4fd..91e4cf5c864 100644 --- a/src/vs/platform/configuration/test/common/configurationModels.test.ts +++ b/src/vs/platform/configuration/test/common/configurationModels.test.ts @@ -362,10 +362,8 @@ suite('CustomConfigurationModel', () => { suite('ConfigurationChangeEvent', () => { - test('changeEvent affecting keys for all resources', () => { - let testObject = new ConfigurationChangeEvent(); - - testObject.change(['window.zoomLevel', 'workbench.editor.enablePreview', 'files', '[markdown]']); + test('changeEvent affecting keys', () => { + let testObject = new ConfigurationChangeEvent({ keys: ['window.zoomLevel', 'workbench.editor.enablePreview', 'files', '[markdown]'], overrides: [] }, undefined, anEmptyConfiguration()); assert.deepEqual(testObject.affectedKeys, ['window.zoomLevel', 'workbench.editor.enablePreview', 'files', '[markdown]']); assert.ok(testObject.affectsConfiguration('window.zoomLevel')); @@ -379,9 +377,7 @@ suite('ConfigurationChangeEvent', () => { }); test('changeEvent affecting a root key and its children', () => { - let testObject = new ConfigurationChangeEvent(); - - testObject.change(['launch', 'launch.version', 'tasks']); + let testObject = new ConfigurationChangeEvent({ keys: ['launch', 'launch.version', 'tasks'], overrides: [] }, undefined, anEmptyConfiguration()); assert.deepEqual(testObject.affectedKeys, ['launch.version', 'tasks']); assert.ok(testObject.affectsConfiguration('launch')); @@ -390,51 +386,49 @@ suite('ConfigurationChangeEvent', () => { }); test('changeEvent affecting keys for resources', () => { - let testObject = new ConfigurationChangeEvent(); - - testObject.change(['window.title']); - testObject.change(['window.zoomLevel'], URI.file('file1')); - testObject.change(['workbench.editor.enablePreview'], URI.file('file2')); - testObject.change(['window.restoreFullscreen'], URI.file('file1')); - testObject.change(['window.restoreWindows'], URI.file('file2')); + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateLocalUserConfiguration(toConfigurationModel({ 'window.title': false })); + configuration.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ 'window.zoomLevel': false, 'window.restoreFullscreen': false })); + configuration.updateFolderConfiguration(URI.file('file2'), toConfigurationModel({ 'workbench.editor.enablePreview': false, 'window.restoreWindows': false })); + const testObject = new ConfigurationChangeEvent({ keys: ['window.title', 'window.zoomLevel', 'workbench.editor.enablePreview', 'window.restoreFullscreen', 'window.restoreWindows'], overrides: [] }, undefined, configuration); assert.deepEqual(testObject.affectedKeys, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', URI.file('file1'))); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', URI.file('file2'))); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file1'))); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file2'))); + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); assert.ok(testObject.affectsConfiguration('window.restoreWindows')); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', URI.file('file1'))); + assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file1') })); assert.ok(testObject.affectsConfiguration('window.title')); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file2'))); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('window', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window', URI.file('file2'))); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('file1'))); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file1') })); assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench.editor', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('workbench.editor', URI.file('file1'))); + assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file1') })); assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('workbench', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('workbench', URI.file('file1'))); + assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('file1') })); assert.ok(!testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files', URI.file('file1'))); - assert.ok(!testObject.affectsConfiguration('files', URI.file('file2'))); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file2') })); }); test('merging change events', () => { @@ -493,3 +487,13 @@ suite('Configuration', () => { }); + +function anEmptyConfiguration(): Configuration { + return new Configuration(new ConfigurationModel(), new ConfigurationModel()); +} + +function toConfigurationModel(obj: any): ConfigurationModel { + const parser = new ConfigurationModelParser('test'); + parser.parseContent(JSON.stringify(obj)); + return parser.configurationModel; +} diff --git a/src/vs/platform/configuration/test/node/configurationService.test.ts b/src/vs/platform/configuration/test/node/configurationService.test.ts index 40ca4dce883..83507dd2f96 100644 --- a/src/vs/platform/configuration/test/node/configurationService.test.ts +++ b/src/vs/platform/configuration/test/node/configurationService.test.ts @@ -210,20 +210,20 @@ suite('ConfigurationService - Node', () => { let res = service.inspect('something.missing'); assert.strictEqual(res.value, undefined); - assert.strictEqual(res.defaultValue, undefined); - assert.strictEqual(res.userValue, undefined); + assert.strictEqual(res.default, undefined); + assert.strictEqual(res.user, undefined); res = service.inspect('lookup.service.testSetting'); - assert.strictEqual(res.defaultValue, 'isSet'); + assert.strictEqual(res.default, 'isSet'); assert.strictEqual(res.value, 'isSet'); - assert.strictEqual(res.userValue, undefined); + assert.strictEqual(res.user, undefined); fs.writeFileSync(r.testFile, '{ "lookup.service.testSetting": "bar" }'); await service.reloadConfiguration(); res = service.inspect('lookup.service.testSetting'); - assert.strictEqual(res.defaultValue, 'isSet'); - assert.strictEqual(res.userValue, 'bar'); + assert.strictEqual(res.default, 'isSet'); + assert.strictEqual(res.user, 'bar'); assert.strictEqual(res.value, 'bar'); service.dispose(); @@ -247,18 +247,18 @@ suite('ConfigurationService - Node', () => { service.initialize(); let res = service.inspect('lookup.service.testNullSetting'); - assert.strictEqual(res.defaultValue, null); + assert.strictEqual(res.default, null); assert.strictEqual(res.value, null); - assert.strictEqual(res.userValue, undefined); + assert.strictEqual(res.user, undefined); fs.writeFileSync(r.testFile, '{ "lookup.service.testNullSetting": null }'); await service.reloadConfiguration(); res = service.inspect('lookup.service.testNullSetting'); - assert.strictEqual(res.defaultValue, null); + assert.strictEqual(res.default, null); assert.strictEqual(res.value, null); - assert.strictEqual(res.userValue, null); + assert.strictEqual(res.user, null); service.dispose(); return r.cleanUp(); diff --git a/src/vs/workbench/api/browser/mainThreadConfiguration.ts b/src/vs/workbench/api/browser/mainThreadConfiguration.ts index 526c57f2464..29e768e8347 100644 --- a/src/vs/workbench/api/browser/mainThreadConfiguration.ts +++ b/src/vs/workbench/api/browser/mainThreadConfiguration.ts @@ -8,9 +8,9 @@ import { IDisposable } from 'vs/base/common/lifecycle'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope, getScopes } from 'vs/platform/configuration/common/configurationRegistry'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; -import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostContext, IWorkspaceConfigurationChangeEventData, IConfigurationInitData } from '../common/extHost.protocol'; +import { MainThreadConfigurationShape, MainContext, ExtHostContext, IExtHostContext, IConfigurationInitData } from '../common/extHost.protocol'; import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; -import { ConfigurationTarget, IConfigurationChangeEvent, IConfigurationModel, IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; @extHostNamedCustomer(MainContext.MainThreadConfiguration) @@ -28,7 +28,7 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape { proxy.$initializeConfiguration(this._getConfigurationData()); this._configurationListener = configurationService.onDidChangeConfiguration(e => { - proxy.$acceptConfigurationChanged(this._getConfigurationData(), this.toConfigurationChangeEventData(e)); + proxy.$acceptConfigurationChanged(this._getConfigurationData(), e.change); }); } @@ -69,22 +69,4 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape { } return ConfigurationTarget.WORKSPACE; } - - private toConfigurationChangeEventData(event: IConfigurationChangeEvent): IWorkspaceConfigurationChangeEventData { - return { - changedConfiguration: this.toJSONConfiguration(event.changedConfiguration), - changedConfigurationByResource: event.changedConfigurationByResource.keys().reduce((result, resource) => { - result[resource.toString()] = this.toJSONConfiguration(event.changedConfigurationByResource.get(resource)); - return result; - }, Object.create({})) - }; - } - - private toJSONConfiguration({ contents, keys, overrides }: IConfigurationModel = { contents: {}, keys: [], overrides: [] }): IConfigurationModel { - return { - contents, - keys, - overrides - }; - } } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index dc89753a162..19b012931d8 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -22,7 +22,7 @@ import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel'; import * as modes from 'vs/editor/common/modes'; import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/modes/languageConfiguration'; import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands'; -import { ConfigurationTarget, IConfigurationData, IConfigurationModel } from 'vs/platform/configuration/common/configuration'; +import { ConfigurationTarget, IConfigurationData, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import * as files from 'vs/platform/files/common/files'; @@ -95,11 +95,6 @@ export interface IConfigurationInitData extends IConfigurationData { configurationScopes: [string, ConfigurationScope | undefined][]; } -export interface IWorkspaceConfigurationChangeEventData { - changedConfiguration: IConfigurationModel; - changedConfigurationByResource: { [folder: string]: IConfigurationModel; }; -} - export interface IExtHostContext extends IRPCProtocol { remoteAuthority: string; } @@ -785,7 +780,7 @@ export interface ExtHostCommandsShape { export interface ExtHostConfigurationShape { $initializeConfiguration(data: IConfigurationInitData): void; - $acceptConfigurationChanged(data: IConfigurationInitData, eventData: IWorkspaceConfigurationChangeEventData): void; + $acceptConfigurationChanged(data: IConfigurationInitData, change: IConfigurationChange): void; } export interface ExtHostDiagnosticsShape { diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 9acade4b04c..e754474f4e3 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -8,12 +8,10 @@ import { URI } from 'vs/base/common/uri'; import { Event, Emitter } from 'vs/base/common/event'; import * as vscode from 'vscode'; import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; -import { ExtHostConfigurationShape, MainThreadConfigurationShape, IWorkspaceConfigurationChangeEventData, IConfigurationInitData, MainContext } from './extHost.protocol'; +import { ExtHostConfigurationShape, MainThreadConfigurationShape, IConfigurationInitData, MainContext } from './extHost.protocol'; import { ConfigurationTarget as ExtHostConfigurationTarget } from './extHostTypes'; -import { IConfigurationData, ConfigurationTarget, IConfigurationModel } from 'vs/platform/configuration/common/configuration'; -import { Configuration, ConfigurationChangeEvent, ConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; -import { WorkspaceConfigurationChangeEvent } from 'vs/workbench/services/configuration/common/configurationModels'; -import { ResourceMap } from 'vs/base/common/map'; +import { ConfigurationTarget, IConfigurationChange, IConfigurationData } from 'vs/platform/configuration/common/configuration'; +import { Configuration, ConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; import { ConfigurationScope, OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/configuration/common/configurationRegistry'; import { isObject } from 'vs/base/common/types'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; @@ -21,6 +19,7 @@ import { Barrier } from 'vs/base/common/async'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { ILogService } from 'vs/platform/log/common/log'; +import { Workspace } from 'vs/platform/workspace/common/workspace'; function lookUp(tree: any, key: string) { if (key) { @@ -72,8 +71,8 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape { this._barrier.open(); } - $acceptConfigurationChanged(data: IConfigurationInitData, eventData: IWorkspaceConfigurationChangeEventData): void { - this.getConfigProvider().then(provider => provider.$acceptConfigurationChanged(data, eventData)); + $acceptConfigurationChanged(data: IConfigurationInitData, change: IConfigurationChange): void { + this.getConfigProvider().then(provider => provider.$acceptConfigurationChanged(data, change)); } } @@ -90,7 +89,7 @@ export class ExtHostConfigProvider { this._proxy = proxy; this._logService = logService; this._extHostWorkspace = extHostWorkspace; - this._configuration = ExtHostConfigProvider.parse(data); + this._configuration = Configuration.parse(data); this._configurationScopes = this._toMap(data.configurationScopes); } @@ -98,10 +97,11 @@ export class ExtHostConfigProvider { return this._onDidChangeConfiguration && this._onDidChangeConfiguration.event; } - $acceptConfigurationChanged(data: IConfigurationInitData, eventData: IWorkspaceConfigurationChangeEventData) { - this._configuration = ExtHostConfigProvider.parse(data); + $acceptConfigurationChanged(data: IConfigurationInitData, change: IConfigurationChange) { + const previous = { data: this._configuration.toData(), workspace: this._extHostWorkspace.workspace }; + this._configuration = Configuration.parse(data); this._configurationScopes = this._toMap(data.configurationScopes); - this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(eventData)); + this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(change, previous)); } getConfiguration(section?: string, resource?: URI, extensionId?: ExtensionIdentifier): vscode.WorkspaceConfiguration { @@ -254,17 +254,10 @@ export class ExtHostConfigProvider { } } - private _toConfigurationChangeEvent(data: IWorkspaceConfigurationChangeEventData): vscode.ConfigurationChangeEvent { - const changedConfiguration = new ConfigurationModel(data.changedConfiguration.contents, data.changedConfiguration.keys, data.changedConfiguration.overrides); - const changedConfigurationByResource: ResourceMap = new ResourceMap(); - for (const key of Object.keys(data.changedConfigurationByResource)) { - const resource = URI.parse(key); - const model = data.changedConfigurationByResource[key]; - changedConfigurationByResource.set(resource, new ConfigurationModel(model.contents, model.keys, model.overrides)); - } - const event = new WorkspaceConfigurationChangeEvent(new ConfigurationChangeEvent(changedConfiguration, changedConfigurationByResource), this._extHostWorkspace.workspace); + private _toConfigurationChangeEvent(change: IConfigurationChange, previous: { data: IConfigurationData, workspace: Workspace | undefined }): vscode.ConfigurationChangeEvent { + const event = new ConfigurationChangeEvent(change, previous, this._configuration, this._extHostWorkspace.workspace); return Object.freeze({ - affectsConfiguration: (section: string, resource?: URI) => event.affectsConfiguration(section, resource) + affectsConfiguration: (section: string, resource?: URI) => event.affectsConfiguration(section, { resource }) }); } @@ -272,20 +265,6 @@ export class ExtHostConfigProvider { return scopes.reduce((result, scope) => { result.set(scope[0], scope[1]); return result; }, new Map()); } - private static parse(data: IConfigurationData): Configuration { - const defaultConfiguration = ExtHostConfigProvider.parseConfigurationModel(data.defaults); - const userConfiguration = ExtHostConfigProvider.parseConfigurationModel(data.user); - const workspaceConfiguration = ExtHostConfigProvider.parseConfigurationModel(data.workspace); - const folders: ResourceMap = data.folders.reduce((result, value) => { - result.set(URI.revive(value[0]), ExtHostConfigProvider.parseConfigurationModel(value[1])); - return result; - }, new ResourceMap()); - return new Configuration(defaultConfiguration, userConfiguration, new ConfigurationModel(), workspaceConfiguration, folders, new ConfigurationModel(), new ResourceMap(), false); - } - - private static parseConfigurationModel(model: IConfigurationModel): ConfigurationModel { - return new ConfigurationModel(model.contents, model.keys, model.overrides).freeze(); - } } export const IExtHostConfiguration = createDecorator('IExtHostConfiguration'); diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 7081ef157ca..8bc575b1f43 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -11,9 +11,9 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { Queue, Barrier } from 'vs/base/common/async'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import { IWorkspaceContextService, Workspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder, toWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { ConfigurationChangeEvent, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; -import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData, IConfigurationService, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; -import { Configuration, WorkspaceConfigurationChangeEvent, AllKeysConfigurationChangeEvent } from 'vs/workbench/services/configuration/common/configurationModels'; +import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, AllKeysConfigurationChangeEvent, mergeChanges } from 'vs/platform/configuration/common/configurationModels'; +import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData, IConfigurationService, IConfigurationValue, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; +import { Configuration } from 'vs/workbench/services/configuration/common/configurationModels'; import { FOLDER_CONFIG_FOLDER_NAME, defaultSettingsSchemaId, userSettingsSchemaId, workspaceSettingsSchemaId, folderSettingsSchemaId, IConfigurationCache, machineSettingsSchemaId, LOCAL_MACHINE_SCOPES } from 'vs/workbench/services/configuration/common/configuration'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, Extensions, allSettings, windowSettings, resourceSettings, applicationSettings, machineSettings, machineOverridableSettings } from 'vs/platform/configuration/common/configurationRegistry'; @@ -456,10 +456,10 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this._configuration = new Configuration(this.defaultConfiguration, userConfigurationModel, remoteUserConfigurationModel, workspaceConfiguration, folderConfigurationModels, new ConfigurationModel(), new ResourceMap(), this.workspace); if (this.initialized) { - const changedKeys = this._configuration.compare(currentConfiguration); - this.triggerConfigurationChange(new ConfigurationChangeEvent().change(changedKeys), ConfigurationTarget.WORKSPACE); + const change = this._configuration.compare(currentConfiguration); + this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE); } else { - this._onDidChangeConfiguration.fire(new AllKeysConfigurationChangeEvent(this._configuration, ConfigurationTarget.WORKSPACE, this.getTargetConfiguration(ConfigurationTarget.WORKSPACE))); + this._onDidChangeConfiguration.fire(new AllKeysConfigurationChangeEvent(this._configuration, this.workspace, ConfigurationTarget.WORKSPACE, this.getTargetConfiguration(ConfigurationTarget.WORKSPACE))); this.initialized = true; } }); @@ -480,7 +480,8 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this.defaultConfiguration = new DefaultConfigurationModel(); this.registerConfigurationSchemas(); if (this.workspace) { - this._configuration.updateDefaultConfiguration(this.defaultConfiguration); + const previousData = this._configuration.toData(); + const change = this._configuration.compareAndUpdateDefaultConfiguration(this.defaultConfiguration, keys); if (this.remoteUserConfiguration) { this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reprocess()); this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reprocess()); @@ -491,7 +492,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.reprocessWorkspaceSettings()); this.workspace.folders.forEach(folder => this._configuration.updateFolderConfiguration(folder.uri, this.cachedFolderConfigs.get(folder.uri)!.reprocess())); } - this.triggerConfigurationChange(new ConfigurationChangeEvent().change(keys), ConfigurationTarget.DEFAULT); + this.triggerConfigurationChange(change, { data: previousData, workspace: this.workspace }, ConfigurationTarget.DEFAULT); } } @@ -519,29 +520,32 @@ export class WorkspaceService extends Disposable implements IConfigurationServic } private onLocalUserConfigurationChanged(userConfiguration: ConfigurationModel): void { - const keys = this._configuration.compareAndUpdateLocalUserConfiguration(userConfiguration); - this.triggerConfigurationChange(keys, ConfigurationTarget.USER); + const previous = { data: this._configuration.toData(), workspace: this.workspace }; + const change = this._configuration.compareAndUpdateLocalUserConfiguration(userConfiguration); + this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER); } private onRemoteUserConfigurationChanged(userConfiguration: ConfigurationModel): void { - const keys = this._configuration.compareAndUpdateRemoteUserConfiguration(userConfiguration); - this.triggerConfigurationChange(keys, ConfigurationTarget.USER); + const previous = { data: this._configuration.toData(), workspace: this.workspace }; + const change = this._configuration.compareAndUpdateRemoteUserConfiguration(userConfiguration); + this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER); } private onWorkspaceConfigurationChanged(): Promise { if (this.workspace && this.workspace.configuration) { - const workspaceConfigurationChangeEvent = this._configuration.compareAndUpdateWorkspaceConfiguration(this.workspaceConfiguration.getConfiguration()); + const previous = { data: this._configuration.toData(), workspace: this.workspace }; + const change = this._configuration.compareAndUpdateWorkspaceConfiguration(this.workspaceConfiguration.getConfiguration()); let configuredFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), this.workspace.configuration); const changes = this.compareFolders(this.workspace.folders, configuredFolders); if (changes.added.length || changes.removed.length || changes.changed.length) { this.workspace.folders = configuredFolders; return this.onFoldersChanged() - .then(foldersConfigurationChangeEvent => { - this.triggerConfigurationChange(foldersConfigurationChangeEvent.change(workspaceConfigurationChangeEvent), ConfigurationTarget.WORKSPACE_FOLDER); + .then(change => { + this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE_FOLDER); this._onDidChangeWorkspaceFolders.fire(changes); }); } else { - this.triggerConfigurationChange(workspaceConfigurationChangeEvent, ConfigurationTarget.WORKSPACE); + this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE); } } return Promise.resolve(undefined); @@ -550,18 +554,19 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private onWorkspaceFolderConfigurationChanged(folder: IWorkspaceFolder, key?: string): Promise { return this.loadFolderConfigurations([folder]) .then(([folderConfiguration]) => { - const folderChangedKeys = this._configuration.compareAndUpdateFolderConfiguration(folder.uri, folderConfiguration); + const previous = { data: this._configuration.toData(), workspace: this.workspace }; + const folderConfiguraitonChange = this._configuration.compareAndUpdateFolderConfiguration(folder.uri, folderConfiguration); if (this.getWorkbenchState() === WorkbenchState.FOLDER) { - const workspaceChangedKeys = this._configuration.compareAndUpdateWorkspaceConfiguration(folderConfiguration); - this.triggerConfigurationChange(workspaceChangedKeys, ConfigurationTarget.WORKSPACE); + const workspaceConfigurationChange = this._configuration.compareAndUpdateWorkspaceConfiguration(folderConfiguration); + this.triggerConfigurationChange(mergeChanges(folderConfiguraitonChange, workspaceConfigurationChange), previous, ConfigurationTarget.WORKSPACE); } else { - this.triggerConfigurationChange(folderChangedKeys, ConfigurationTarget.WORKSPACE_FOLDER); + this.triggerConfigurationChange(folderConfiguraitonChange, previous, ConfigurationTarget.WORKSPACE_FOLDER); } }); } - private onFoldersChanged(): Promise { - let changeEvent = new ConfigurationChangeEvent(); + private async onFoldersChanged(): Promise { + const changes: IConfigurationChange[] = []; // Remove the configurations of deleted folders for (const key of this.cachedFolderConfigs.keys()) { @@ -569,21 +574,18 @@ export class WorkspaceService extends Disposable implements IConfigurationServic const folderConfiguration = this.cachedFolderConfigs.get(key); folderConfiguration!.dispose(); this.cachedFolderConfigs.delete(key); - changeEvent = changeEvent.change(this._configuration.compareAndDeleteFolderConfiguration(key)); + changes.push(this._configuration.compareAndDeleteFolderConfiguration(key)); } } const toInitialize = this.workspace.folders.filter(folder => !this.cachedFolderConfigs.has(folder.uri)); if (toInitialize.length) { - return this.loadFolderConfigurations(toInitialize) - .then(folderConfigurations => { - folderConfigurations.forEach((folderConfiguration, index) => { - changeEvent = changeEvent.change(this._configuration.compareAndUpdateFolderConfiguration(toInitialize[index].uri, folderConfiguration)); - }); - return changeEvent; - }); + const folderConfigurations = await this.loadFolderConfigurations(toInitialize); + folderConfigurations.forEach((folderConfiguration, index) => { + changes.push(this._configuration.compareAndUpdateFolderConfiguration(toInitialize[index].uri, folderConfiguration)); + }); } - return Promise.resolve(changeEvent); + return mergeChanges(...changes); } private loadFolderConfigurations(folders: IWorkspaceFolder[]): Promise { @@ -604,8 +606,9 @@ export class WorkspaceService extends Disposable implements IConfigurationServic } if (target === ConfigurationTarget.MEMORY) { + const previous = { data: this._configuration.toData(), workspace: this.workspace }; this._configuration.updateValue(key, value, overrides); - this.triggerConfigurationChange(new ConfigurationChangeEvent().change(overrides && overrides.overrideIdentifier ? [keyFromOverrideIdentifier(overrides.overrideIdentifier)] : [key], overrides && overrides.resource || undefined), target); + this.triggerConfigurationChange({ keys: overrides?.overrideIdentifier ? [keyFromOverrideIdentifier(overrides.overrideIdentifier), key] : [key], overrides: overrides?.overrideIdentifier ? [[overrides?.overrideIdentifier, [key]]] : [] }, previous, target); return Promise.resolve(undefined); } @@ -653,21 +656,23 @@ export class WorkspaceService extends Disposable implements IConfigurationServic return undefined; } - if (inspect.workspaceFolderValue !== undefined) { + if (inspect.workspaceFolder !== undefined) { return ConfigurationTarget.WORKSPACE_FOLDER; } - if (inspect.workspaceValue !== undefined) { + if (inspect.workspace !== undefined) { return ConfigurationTarget.WORKSPACE; } return ConfigurationTarget.USER; } - private triggerConfigurationChange(configurationEvent: ConfigurationChangeEvent, target: ConfigurationTarget): void { - if (configurationEvent.affectedKeys.length) { - configurationEvent.telemetryData(target, this.getTargetConfiguration(target)); - this._onDidChangeConfiguration.fire(new WorkspaceConfigurationChangeEvent(configurationEvent, this.workspace)); + private triggerConfigurationChange(change: IConfigurationChange, previous: { data: IConfigurationData, workspace?: Workspace } | undefined, target: ConfigurationTarget): void { + if (change.keys.length) { + const configurationChangeEvent = new ConfigurationChangeEvent(change, previous, this._configuration, this.workspace); + configurationChangeEvent.source = target; + configurationChangeEvent.sourceConfig = this.getTargetConfiguration(target); + this._onDidChangeConfiguration.fire(configurationChangeEvent); } } @@ -685,7 +690,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic private toEditableConfigurationTarget(target: ConfigurationTarget, key: string): EditableConfigurationTarget | null { if (target === ConfigurationTarget.USER) { - if (this.inspect(key).userRemoteValue !== undefined) { + if (this.inspect(key).userRemote !== undefined) { return EditableConfigurationTarget.USER_REMOTE; } return EditableConfigurationTarget.USER_LOCAL; diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index 84059edd671..cdebd413e5a 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -4,13 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { equals } from 'vs/base/common/objects'; -import { compare, toValuesTree, IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel, IConfigurationOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration'; -import { Configuration as BaseConfiguration, ConfigurationModelParser, ConfigurationChangeEvent, ConfigurationModel, AbstractConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; +import { compare, toValuesTree, IConfigurationModel, IConfigurationOverrides, IConfigurationValue, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; +import { Configuration as BaseConfiguration, ConfigurationModelParser, ConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces'; import { Workspace } from 'vs/platform/workspace/common/workspace'; import { ResourceMap } from 'vs/base/common/map'; import { URI } from 'vs/base/common/uri'; import { WORKSPACE_SCOPES } from 'vs/workbench/services/configuration/common/configuration'; +import { OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/configuration/common/configurationRegistry'; export class WorkspaceConfigurationModelParser extends ConfigurationModelParser { @@ -114,47 +115,38 @@ export class Configuration extends BaseConfiguration { return super.keys(this._workspace); } - compareAndUpdateLocalUserConfiguration(user: ConfigurationModel): ConfigurationChangeEvent { - const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user); - const keys = [...added, ...updated, ...removed]; - if (keys.length) { - super.updateLocalUserConfiguration(user); - } - return new ConfigurationChangeEvent().change({ keys, overrides }); - } - - compareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): ConfigurationChangeEvent { + compareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): IConfigurationChange { const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user); let keys = [...added, ...updated, ...removed]; if (keys.length) { super.updateRemoteUserConfiguration(user); } - return new ConfigurationChangeEvent().change({ keys, overrides }); + return { keys, overrides }; } - compareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): ConfigurationChangeEvent { + compareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): IConfigurationChange { const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration); let keys = [...added, ...updated, ...removed]; if (keys.length) { super.updateWorkspaceConfiguration(workspaceConfiguration); } - return new ConfigurationChangeEvent().change({ keys, overrides }); + return { keys, overrides }; } - compareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): ConfigurationChangeEvent { + compareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): IConfigurationChange { const currentFolderConfiguration = this.folderConfigurations.get(resource); const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration); let keys = [...added, ...updated, ...removed]; if (keys.length) { super.updateFolderConfiguration(resource, folderConfiguration); } - return new ConfigurationChangeEvent().change({ keys, overrides }, resource); + return { keys, overrides }; } - compareAndDeleteFolderConfiguration(folder: URI): ConfigurationChangeEvent { + compareAndDeleteFolderConfiguration(folder: URI): IConfigurationChange { if (this._workspace && this._workspace.folders.length > 0 && this._workspace.folders[0].uri.toString() === folder.toString()) { // Do not remove workspace configuration - return new ConfigurationChangeEvent(); + return { keys: [], overrides: [] }; } const folderConfig = this.folderConfigurations.get(folder); if (!folderConfig) { @@ -162,89 +154,26 @@ export class Configuration extends BaseConfiguration { } super.deleteFolderConfiguration(folder); const { added, updated, removed, overrides } = compare(folderConfig, undefined); - return new ConfigurationChangeEvent().change({ keys: [...added, ...updated, ...removed], overrides }, folder); + return { keys: [...added, ...updated, ...removed], overrides }; } - compare(other: Configuration): string[] { - const result: string[] = []; - for (const key of this.allKeys()) { - if (!equals(this.getValue(key), other.getValue(key)) - || (this._workspace && this._workspace.folders.some(folder => !equals(this.getValue(key, { resource: folder.uri }), other.getValue(key, { resource: folder.uri }))))) { - result.push(key); + compare(other: Configuration): IConfigurationChange { + const compare = (fromKeys: string[], toKeys: string[], overrideIdentifier?: string): string[] => { + return [ + ...toKeys.filter(key => fromKeys.indexOf(key) === -1), + ...fromKeys.filter(key => toKeys.indexOf(key) === -1), + ...fromKeys.filter(key => !equals(this.getValue(key, { overrideIdentifier }), other.getValue(key, { overrideIdentifier })) + || (this._workspace && this._workspace.folders.some(folder => !equals(this.getValue(key, { resource: folder.uri, overrideIdentifier }), other.getValue(key, { resource: folder.uri, overrideIdentifier }))))) + ]; + }; + const keys = compare(this.allKeys(), other.allKeys()); + const overrides: [string, string[]][] = []; + for (const key of keys) { + if (OVERRIDE_PROPERTY_PATTERN.test(key)) { + overrides.push([key, compare(this.getAllKeysForOverrideIdentifier(key), other.getAllKeysForOverrideIdentifier(key), key)]); } } - return result; + return { keys, overrides }; } - allKeys(): string[] { - return super.allKeys(this._workspace); - } -} - -export class AllKeysConfigurationChangeEvent extends AbstractConfigurationChangeEvent implements IConfigurationChangeEvent { - - private _changedConfiguration: ConfigurationModel | null = null; - - constructor(private _configuration: Configuration, readonly source: ConfigurationTarget, readonly sourceConfig: any) { super(); } - - get changedConfiguration(): ConfigurationModel { - if (!this._changedConfiguration) { - this._changedConfiguration = new ConfigurationModel(); - const { added, updated, removed, overrides } = compare(undefined, this._changedConfiguration); - this.updateKeys(this._changedConfiguration, { keys: [...added, ...updated, ...removed], overrides }); - } - return this._changedConfiguration; - } - - get changedConfigurationByResource(): ResourceMap { - return new ResourceMap(); - } - - get affectedKeys(): string[] { - return this._configuration.allKeys(); - } - - affectsConfiguration(config: string, resource?: URI): boolean { - return this.doesConfigurationContains(this.changedConfiguration, config); - } -} - -export class WorkspaceConfigurationChangeEvent implements IConfigurationChangeEvent { - - constructor(private configurationChangeEvent: IConfigurationChangeEvent, private workspace: Workspace | undefined) { } - - get changedConfiguration(): IConfigurationModel { - return this.configurationChangeEvent.changedConfiguration; - } - - get changedConfigurationByResource(): ResourceMap { - return this.configurationChangeEvent.changedConfigurationByResource; - } - - get affectedKeys(): string[] { - return this.configurationChangeEvent.affectedKeys; - } - - get source(): ConfigurationTarget { - return this.configurationChangeEvent.source; - } - - get sourceConfig(): any { - return this.configurationChangeEvent.sourceConfig; - } - - affectsConfiguration(config: string, resource?: URI): boolean { - if (this.configurationChangeEvent.affectsConfiguration(config, resource)) { - return true; - } - - if (resource && this.workspace) { - let workspaceFolder = this.workspace.getFolder(resource); - if (workspaceFolder) { - return this.configurationChangeEvent.affectsConfiguration(config, workspaceFolder.uri); - } - } - - return false; - } } diff --git a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts index 672c28dd637..471099c29b3 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts @@ -12,7 +12,7 @@ import { ConfigurationModel } from 'vs/platform/configuration/common/configurati import { TestRPCProtocol } from './testRPCProtocol'; import { mock } from 'vs/workbench/test/electron-browser/api/mock'; import { IWorkspaceFolder, WorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { ConfigurationTarget, IConfigurationModel } from 'vs/platform/configuration/common/configuration'; +import { ConfigurationTarget, IConfigurationModel, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; import { NullLogService } from 'vs/platform/log/common/log'; import { assign } from 'vs/base/common/objects'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; @@ -621,20 +621,7 @@ suite('ExtHostConfiguration', function () { 'newConfig': true, } }); - const changedConfigurationByResource = Object.create({}); - changedConfigurationByResource[workspaceFolder.uri.toString()] = new ConfigurationModel({ - 'farboo': { - 'newConfig': true, - } - }, ['farboo.newConfig']); - const configEventData = { - changedConfiguration: new ConfigurationModel({ - 'farboo': { - 'updatedConfig': true, - } - }, ['farboo.updatedConfig']), - changedConfigurationByResource - }; + const configEventData: IConfigurationChange = { keys: ['farboo.updatedConfig'], overrides: [] }; testObject.onDidChangeConfiguration(e => { assert.deepEqual(testObject.getConfiguration().get('farboo'), { From b9f0336dc36e9231a3325bd246fbd3d38e820297 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Dec 2019 16:20:18 +0100 Subject: [PATCH 377/637] Debug activity bar decoration when debugging fixes #85674 --- .../contrib/debug/browser/debugService.ts | 15 ++++++++++++++- .../contrib/debug/browser/rawDebugSession.ts | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index b1892e1364e..8cbdcbb4f22 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -44,6 +44,7 @@ import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHo import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { TaskRunResult, DebugTaskRunner } from 'vs/workbench/contrib/debug/browser/debugTaskRunner'; +import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity'; const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint'; const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint'; @@ -71,6 +72,7 @@ export class DebugService implements IDebugService { private initializing = false; private previousState: State | undefined; private initCancellationToken: CancellationTokenSource | undefined; + private activity: IDisposable | undefined; constructor( @IStorageService private readonly storageService: IStorageService, @@ -89,7 +91,8 @@ export class DebugService implements IDebugService { @IExtensionService private readonly extensionService: IExtensionService, @IFileService private readonly fileService: IFileService, @IConfigurationService private readonly configurationService: IConfigurationService, - @IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService + @IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService, + @IActivityService private readonly activityService: IActivityService ) { this.toDispose = []; @@ -155,6 +158,16 @@ export class DebugService implements IDebugService { this.toDispose.push(this.configurationManager.onDidSelectConfiguration(() => { this.debugUx.set(!!(this.state !== State.Inactive || this.configurationManager.selectedConfiguration.name) ? 'default' : 'simple'); })); + this.toDispose.push(Event.any(this.onDidNewSession, this.onDidEndSession)(() => { + const numberOfSessions = this.model.getSessions().length; + if (numberOfSessions === 0) { + if (this.activity) { + this.activity.dispose(); + } + } else { + this.activity = this.activityService.showActivity(VIEWLET_ID, new NumberBadge(numberOfSessions, n => n === 1 ? nls.localize('1activeSession', "1 active session") : nls.localize('nActiveSessions', "{0} active sessions", n))); + } + })); } getModel(): IDebugModel { diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index e1f8c1e665c..f7bbb068852 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -80,7 +80,6 @@ export class RawDebugSession implements IDisposable { public readonly customTelemetryService: ITelemetryService | undefined, private readonly extensionHostDebugService: IExtensionHostDebugService, private readonly openerService: IOpenerService - ) { this.debugAdapter = debugAdapter; this._capabilities = Object.create(null); From ef4e7cfda38e9ce00e076e4f69b3ce053cb7ac84 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Dec 2019 16:49:07 +0100 Subject: [PATCH 378/637] debug: remove-token-colors not needed. Also unverified color should not get priority --- .../contrib/debug/browser/breakpointEditorContribution.ts | 2 +- .../contrib/debug/browser/callStackEditorContribution.ts | 2 -- .../contrib/debug/browser/media/debug.contribution.css | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index d77deee93be..22aab183e06 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -662,7 +662,7 @@ registerThemingParticipant((theme, collector) => { if (debugIconBreakpointUnverifiedColor) { collector.addRule(` .monaco-workbench .codicon[class*='-unverified'] { - color: ${debugIconBreakpointUnverifiedColor} !important; + color: ${debugIconBreakpointUnverifiedColor}; } `); } diff --git a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts index de13f54b873..aa5ca3a1e92 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.ts @@ -119,7 +119,6 @@ class CallStackEditorContribution implements IEditorContribution { private static TOP_STACK_FRAME_DECORATION: IModelDecorationOptions = { isWholeLine: true, - inlineClassName: 'debug-remove-token-colors', className: 'debug-top-stack-frame-line', stickiness }; @@ -130,7 +129,6 @@ class CallStackEditorContribution implements IEditorContribution { private static FOCUSED_STACK_FRAME_DECORATION: IModelDecorationOptions = { isWholeLine: true, - inlineClassName: 'debug-remove-token-colors', className: 'debug-focused-stack-frame-line', stickiness }; diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index f88a902579c..748852c409d 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -182,7 +182,3 @@ .hc-black .monaco-workbench .monaco-list-row .expression .name { color: inherit; } - -.hc-black .monaco-editor .debug-remove-token-colors { - color:black; -} From 59111abe557f312a5dcc105d4e6f9fc0d6bf4352 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 12 Dec 2019 17:39:02 +0100 Subject: [PATCH 379/637] add tests for merge changes --- .../test/common/configuration.test.ts | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/configuration/test/common/configuration.test.ts b/src/vs/platform/configuration/test/common/configuration.test.ts index 17ee0b3e334..5470fd08a45 100644 --- a/src/vs/platform/configuration/test/common/configuration.test.ts +++ b/src/vs/platform/configuration/test/common/configuration.test.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { merge, removeFromValueTree } from 'vs/platform/configuration/common/configuration'; +import { mergeChanges } from 'vs/platform/configuration/common/configurationModels'; suite('Configuration', () => { @@ -104,4 +105,43 @@ suite('Configuration', () => { assert.deepEqual(target, { 'a': { 'b': { 'd': 1 } } }); }); -}); \ No newline at end of file +}); + +suite('Configuration Changes: Merge', () => { + + test('merge only keys', () => { + const actual = mergeChanges({ keys: ['a', 'b'], overrides: [] }, { keys: ['c', 'd'], overrides: [] }); + assert.deepEqual(actual, { keys: ['a', 'b', 'c', 'd'], overrides: [] }); + }); + + test('merge only keys with duplicates', () => { + const actual = mergeChanges({ keys: ['a', 'b'], overrides: [] }, { keys: ['c', 'd'], overrides: [] }, { keys: ['a', 'd', 'e'], overrides: [] }); + assert.deepEqual(actual, { keys: ['a', 'b', 'c', 'd', 'e'], overrides: [] }); + }); + + test('merge only overrides', () => { + const actual = mergeChanges({ keys: [], overrides: [['a', ['1', '2']]] }, { keys: [], overrides: [['b', ['3', '4']]] }); + assert.deepEqual(actual, { keys: [], overrides: [['a', ['1', '2']], ['b', ['3', '4']]] }); + }); + + test('merge only overrides with duplicates', () => { + const actual = mergeChanges({ keys: [], overrides: [['a', ['1', '2']], ['b', ['5', '4']]] }, { keys: [], overrides: [['b', ['3', '4']]] }, { keys: [], overrides: [['c', ['1', '4']], ['a', ['2', '3']]] }); + assert.deepEqual(actual, { keys: [], overrides: [['a', ['1', '2', '3']], ['b', ['5', '4', '3']], ['c', ['1', '4']]] }); + }); + + test('merge', () => { + const actual = mergeChanges({ keys: ['b', 'b'], overrides: [['a', ['1', '2']], ['b', ['5', '4']]] }, { keys: ['b'], overrides: [['b', ['3', '4']]] }, { keys: ['c', 'a'], overrides: [['c', ['1', '4']], ['a', ['2', '3']]] }); + assert.deepEqual(actual, { keys: ['b', 'c', 'a'], overrides: [['a', ['1', '2', '3']], ['b', ['5', '4', '3']], ['c', ['1', '4']]] }); + }); + + test('merge single change', () => { + const actual = mergeChanges({ keys: ['b', 'b'], overrides: [['a', ['1', '2']], ['b', ['5', '4']]] }); + assert.deepEqual(actual, { keys: ['b', 'b'], overrides: [['a', ['1', '2']], ['b', ['5', '4']]] }); + }); + + test('merge no changes', () => { + const actual = mergeChanges(); + assert.deepEqual(actual, { keys: [], overrides: [] }); + }); + +}); From 5c569d1cebbbe4ffad74c6cf76111f48b53fb316 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Dec 2019 17:47:26 +0100 Subject: [PATCH 380/637] fixes #86106 --- src/vs/workbench/contrib/files/browser/views/explorerView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index 686c81d0a32..bd1e27a2150 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -485,7 +485,7 @@ export class ExplorerView extends ViewPane { const controller = this.renderer.getCompressedNavigationController(stat); if (controller) { - if (isCompressedFolderName(e.browserEvent.target)) { + if (e.browserEvent instanceof KeyboardEvent || isCompressedFolderName(e.browserEvent.target)) { anchor = controller.labels[controller.index]; } else { controller.last(); From e1bfea5b63c81291d8c552a8b42500e66338ae61 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Thu, 12 Dec 2019 18:03:04 +0100 Subject: [PATCH 381/637] Add candidate finding to ports view Part of #81388 --- .../api/browser/mainThreadTunnelService.ts | 5 +- .../workbench/api/common/extHost.protocol.ts | 3 +- .../api/common/extHostTunnelService.ts | 40 +---- src/vs/workbench/api/node/extHost.services.ts | 3 +- .../api/node/extHostTunnelService.ts | 149 ++++++++++++++++++ .../contrib/remote/browser/tunnelView.ts | 35 ++-- .../extensions/worker/extHost.services.ts | 2 - .../remote/common/remoteExplorerService.ts | 32 ++-- 8 files changed, 198 insertions(+), 71 deletions(-) create mode 100644 src/vs/workbench/api/node/extHostTunnelService.ts diff --git a/src/vs/workbench/api/browser/mainThreadTunnelService.ts b/src/vs/workbench/api/browser/mainThreadTunnelService.ts index afab7499495..1e320448107 100644 --- a/src/vs/workbench/api/browser/mainThreadTunnelService.ts +++ b/src/vs/workbench/api/browser/mainThreadTunnelService.ts @@ -10,7 +10,6 @@ import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remo @extHostNamedCustomer(MainContext.MainThreadTunnelService) export class MainThreadTunnelService implements MainThreadTunnelServiceShape { - // @ts-ignore private readonly _proxy: ExtHostTunnelServiceShape; constructor( @@ -36,6 +35,10 @@ export class MainThreadTunnelService implements MainThreadTunnelServiceShape { return Promise.resolve(this.remoteExplorerService.addDetected(tunnels)); } + async $registerCandidateFinder(): Promise { + this.remoteExplorerService.registerCandidateFinder(() => this._proxy.$findCandidatePorts()); + } + dispose(): void { // } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index f37e0e96236..a8e142ccd15 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -782,6 +782,7 @@ export interface MainThreadTunnelServiceShape extends IDisposable { $openTunnel(tunnelOptions: TunnelOptions): Promise; $closeTunnel(remotePort: number): Promise; $addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise; + $registerCandidateFinder(): Promise; } // -- extension host @@ -1400,7 +1401,7 @@ export interface ExtHostStorageShape { export interface ExtHostTunnelServiceShape { - + $findCandidatePorts(): Promise<{ port: number, detail: string }[]>; } // --- proxy identifiers diff --git a/src/vs/workbench/api/common/extHostTunnelService.ts b/src/vs/workbench/api/common/extHostTunnelService.ts index 5b13798e294..55492233e43 100644 --- a/src/vs/workbench/api/common/extHostTunnelService.ts +++ b/src/vs/workbench/api/common/extHostTunnelService.ts @@ -3,11 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ExtHostTunnelServiceShape, MainThreadTunnelServiceShape, MainContext } from 'vs/workbench/api/common/extHost.protocol'; +import { ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import * as vscode from 'vscode'; -import { Disposable } from 'vs/base/common/lifecycle'; export interface TunnelOptions { remote: { port: number, host: string }; @@ -28,39 +26,3 @@ export interface IExtHostTunnelService extends ExtHostTunnelServiceShape { } export const IExtHostTunnelService = createDecorator('IExtHostTunnelService'); - - -export class ExtHostTunnelService extends Disposable implements IExtHostTunnelService { - readonly _serviceBrand: undefined; - private readonly _proxy: MainThreadTunnelServiceShape; - - constructor( - @IExtHostRpcService extHostRpc: IExtHostRpcService - ) { - super(); - this._proxy = extHostRpc.getProxy(MainContext.MainThreadTunnelService); - } - async makeTunnel(forward: TunnelOptions): Promise { - const tunnel = await this._proxy.$openTunnel(forward); - if (tunnel) { - const disposableTunnel: vscode.Tunnel = { - remote: tunnel.remote, - localAddress: tunnel.localAddress, - dispose: () => { - return this._proxy.$closeTunnel(tunnel.remote.port); - } - }; - this._register(disposableTunnel); - return disposableTunnel; - } - return undefined; - } - - async addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise { - if (tunnels) { - return this._proxy.$addDetected(tunnels); - } - } - -} - diff --git a/src/vs/workbench/api/node/extHost.services.ts b/src/vs/workbench/api/node/extHost.services.ts index 7dd3169394c..326a1c9cb8d 100644 --- a/src/vs/workbench/api/node/extHost.services.ts +++ b/src/vs/workbench/api/node/extHost.services.ts @@ -26,7 +26,8 @@ import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionS import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService'; -import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; +import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; +import { ExtHostTunnelService } from 'vs/workbench/api/node/extHostTunnelService'; // register singleton services registerSingleton(ILogService, ExtHostLogService); diff --git a/src/vs/workbench/api/node/extHostTunnelService.ts b/src/vs/workbench/api/node/extHostTunnelService.ts new file mode 100644 index 00000000000..4cd66bcef67 --- /dev/null +++ b/src/vs/workbench/api/node/extHostTunnelService.ts @@ -0,0 +1,149 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { MainThreadTunnelServiceShape, MainContext } from 'vs/workbench/api/common/extHost.protocol'; +import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; +import * as vscode from 'vscode'; +import { Disposable } from 'vs/base/common/lifecycle'; +import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; +import { URI } from 'vs/base/common/uri'; +import { exec } from 'child_process'; +import * as resources from 'vs/base/common/resources'; +import * as fs from 'fs'; +import { isLinux } from 'vs/base/common/platform'; +import { IExtHostTunnelService, TunnelOptions } from 'vs/workbench/api/common/extHostTunnelService'; + +export class ExtHostTunnelService extends Disposable implements IExtHostTunnelService { + readonly _serviceBrand: undefined; + private readonly _proxy: MainThreadTunnelServiceShape; + + constructor( + @IExtHostRpcService extHostRpc: IExtHostRpcService, + @IExtHostInitDataService initData: IExtHostInitDataService + ) { + super(); + this._proxy = extHostRpc.getProxy(MainContext.MainThreadTunnelService); + if (initData.remote.isRemote && initData.remote.authority) { + this.registerCandidateFinder(); + } + } + async makeTunnel(forward: TunnelOptions): Promise { + const tunnel = await this._proxy.$openTunnel(forward); + if (tunnel) { + const disposableTunnel: vscode.Tunnel = { + remote: tunnel.remote, + localAddress: tunnel.localAddress, + dispose: () => { + return this._proxy.$closeTunnel(tunnel.remote.port); + } + }; + this._register(disposableTunnel); + return disposableTunnel; + } + return undefined; + } + + async addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise { + if (tunnels) { + return this._proxy.$addDetected(tunnels); + } + } + + registerCandidateFinder(): Promise { + return this._proxy.$registerCandidateFinder(); + } + + async $findCandidatePorts(): Promise<{ port: number, detail: string }[]> { + if (!isLinux) { + return []; + } + + const ports: { port: number, detail: string }[] = []; + const tcp: string = fs.readFileSync('/proc/net/tcp', 'utf8'); + const tcp6: string = fs.readFileSync('/proc/net/tcp6', 'utf8'); + const procSockets: string = await (new Promise(resolve => { + exec('ls -l /proc/[0-9]*/fd/[0-9]* | grep socket:', (error, stdout, stderr) => { + resolve(stdout); + }); + })); + + const procChildren = fs.readdirSync('/proc'); + const processes: { pid: number, cwd: string, cmd: string }[] = []; + for (let childName of procChildren) { + try { + const pid: number = Number(childName); + const childUri = resources.joinPath(URI.file('/proc'), childName); + const childStat = fs.statSync(childUri.fsPath); + if (childStat.isDirectory() && !isNaN(pid)) { + const cwd = fs.readlinkSync(resources.joinPath(childUri, 'cwd').fsPath); + const cmd = fs.readFileSync(resources.joinPath(childUri, 'cmdline').fsPath, 'utf8').replace(/\0/g, ' '); + processes.push({ pid, cwd, cmd }); + } + } catch (e) { + // + } + } + + const connections: { socket: number, ip: string, port: number }[] = this.loadListeningPorts(tcp, tcp6); + const sockets = this.getSockets(procSockets); + + const socketMap = sockets.reduce((m, socket) => { + m[socket.socket] = socket; + return m; + }, {} as Record); + const processMap = processes.reduce((m, process) => { + m[process.pid] = process; + return m; + }, {} as Record); + + connections.filter((connection => socketMap[connection.socket])).forEach(({ socket, ip, port }) => { + const command = processMap[socketMap[socket].pid].cmd; + if (!command.match('.*\.vscode\-server\-[a-zA-Z]+\/bin.*') && (command.indexOf('out/vs/server/main.js') === -1)) { + ports.push({ port, detail: processMap[socketMap[socket].pid].cmd }); + } + }); + + return ports; + } + + private getSockets(stdout: string) { + const lines = stdout.trim().split('\n'); + return lines.map(line => { + const match = /\/proc\/(\d+)\/fd\/\d+ -> socket:\[(\d+)\]/.exec(line)!; + return { + pid: parseInt(match[1], 10), + socket: parseInt(match[2], 10) + }; + }); + } + + private loadListeningPorts(...stdouts: string[]): { socket: number, ip: string, port: number }[] { + const table = ([] as Record[]).concat(...stdouts.map(this.loadConnectionTable)); + return [ + ...new Map( + table.filter(row => row.st === '0A') + .map(row => { + const address = row.local_address.split(':'); + return { + socket: parseInt(row.inode, 10), + ip: address[0], + port: parseInt(address[1], 16) + }; + }).map(port => [port.port, port]) + ).values() + ]; + } + + private loadConnectionTable(stdout: string): Record[] { + const lines = stdout.trim().split('\n'); + const names = lines.shift()!.trim().split(/\s+/) + .filter(name => name !== 'rx_queue' && name !== 'tm->when'); + const table = lines.map(line => line.trim().split(/\s+/).reduce((obj, value, i) => { + obj[names[i] || i] = value; + return obj; + }, {} as Record)); + return table; + } +} diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 8077d549082..c61a3d2661e 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -52,8 +52,8 @@ export interface ITunnelViewModel { onForwardedPortsChanged: Event; readonly forwarded: TunnelItem[]; readonly detected: TunnelItem[]; - readonly candidates: TunnelItem[]; - readonly groups: ITunnelGroup[]; + readonly candidates: Promise; + groups(): Promise; } export class TunnelViewModel extends Disposable implements ITunnelViewModel { @@ -70,7 +70,7 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { this._register(this.model.onPortName(() => this._onForwardedPortsChanged.fire())); } - get groups(): ITunnelGroup[] { + async groups(): Promise { const groups: ITunnelGroup[] = []; if (this.model.forwarded.size > 0) { groups.push({ @@ -86,8 +86,8 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { items: this.detected }); } - const candidates = this.candidates; - if (this.candidates.length > 0) { + const candidates = await this.candidates; + if (candidates.length > 0) { groups.push({ label: nls.localize('remote.tunnelsView.candidates', "Candidates"), tunnelType: TunnelType.Candidate, @@ -113,17 +113,16 @@ export class TunnelViewModel extends Disposable implements ITunnelViewModel { }); } - get candidates(): TunnelItem[] { - const candidates: TunnelItem[] = []; - const values = this.model.candidates.values(); - let iterator = values.next(); - while (!iterator.done) { - if (!this.model.forwarded.has(iterator.value.remote) && !this.model.detected.has(iterator.value.remote)) { - candidates.push(new TunnelItem(TunnelType.Candidate, iterator.value.remote, iterator.value.localAddress, false, undefined, iterator.value.description)); - } - iterator = values.next(); - } - return candidates; + get candidates(): Promise { + return this.model.candidates.then(values => { + const candidates: TunnelItem[] = []; + values.forEach(value => { + if (!this.model.forwarded.has(value.port) && !this.model.detected.has(value.port)) { + candidates.push(new TunnelItem(TunnelType.Candidate, value.port, undefined, false, undefined, value.detail)); + } + }); + return candidates; + }); } dispose() { @@ -312,7 +311,7 @@ class TunnelDataSource implements IAsyncDataSourceelement).items) { @@ -332,7 +331,7 @@ enum TunnelType { interface ITunnelGroup { tunnelType: TunnelType; label: string; - items?: ITunnelItem[]; + items?: ITunnelItem[] | Promise; } interface ITunnelItem { diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts index de59a448147..8a65101aa4e 100644 --- a/src/vs/workbench/services/extensions/worker/extHost.services.ts +++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts @@ -21,7 +21,6 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { ILogService } from 'vs/platform/log/common/log'; import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; -import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; // register singleton services registerSingleton(ILogService, ExtHostLogService); @@ -34,7 +33,6 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors); registerSingleton(IExtHostStorage, ExtHostStorage); registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(IExtHostSearch, ExtHostSearch); -registerSingleton(IExtHostTunnelService, ExtHostTunnelService); // register services that only throw errors function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { diff --git a/src/vs/workbench/services/remote/common/remoteExplorerService.ts b/src/vs/workbench/services/remote/common/remoteExplorerService.ts index f1dd74ca8fa..01f41b09a1c 100644 --- a/src/vs/workbench/services/remote/common/remoteExplorerService.ts +++ b/src/vs/workbench/services/remote/common/remoteExplorerService.ts @@ -29,13 +29,14 @@ export interface Tunnel { export class TunnelModel extends Disposable { readonly forwarded: Map; readonly detected: Map; - readonly candidates: Map; private _onForwardPort: Emitter = new Emitter(); public onForwardPort: Event = this._onForwardPort.event; private _onClosePort: Emitter = new Emitter(); public onClosePort: Event = this._onClosePort.event; private _onPortName: Emitter = new Emitter(); public onPortName: Event = this._onPortName.event; + private _candidateFinder: (() => Promise<{ port: number, detail: string }[]>) | undefined; + constructor( @ITunnelService private readonly tunnelService: ITunnelService ) { @@ -54,11 +55,7 @@ export class TunnelModel extends Disposable { }); this.detected = new Map(); - this.candidates = new Map(); this._register(this.tunnelService.onTunnelOpened(tunnel => { - if (this.candidates.has(tunnel.tunnelRemotePort)) { - this.candidates.delete(tunnel.tunnelRemotePort); - } if (!this.forwarded.has(tunnel.tunnelRemotePort) && tunnel.localAddress) { this.forwarded.set(tunnel.tunnelRemotePort, { remote: tunnel.tunnelRemotePort, @@ -122,6 +119,17 @@ export class TunnelModel extends Disposable { }); }); } + + registerCandidateFinder(finder: () => Promise<{ port: number, detail: string }[]>): void { + this._candidateFinder = finder; + } + + get candidates(): Promise<{ port: number, detail: string }[]> { + if (this._candidateFinder) { + return this._candidateFinder(); + } + return Promise.resolve([]); + } } export interface IRemoteExplorerService { @@ -136,6 +144,7 @@ export interface IRemoteExplorerService { forward(remote: number, local?: number, name?: string): Promise; close(remote: number): Promise; addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): void; + registerCandidateFinder(finder: () => Promise<{ port: number, detail: string }[]>): void; } export interface HelpInformation { @@ -180,7 +189,7 @@ class RemoteExplorerService implements IRemoteExplorerService { public readonly onDidChangeTargetType: Event = this._onDidChangeTargetType.event; private _helpInformation: HelpInformation[] = []; private _tunnelModel: TunnelModel; - private editable: { remote: number | undefined, data: IEditableData } | undefined; + private _editable: { remote: number | undefined, data: IEditableData } | undefined; private readonly _onDidChangeEditable: Emitter = new Emitter(); public readonly onDidChangeEditable: Event = this._onDidChangeEditable.event; @@ -253,16 +262,21 @@ class RemoteExplorerService implements IRemoteExplorerService { setEditable(remote: number | undefined, data: IEditableData | null): void { if (!data) { - this.editable = undefined; + this._editable = undefined; } else { - this.editable = { remote, data }; + this._editable = { remote, data }; } this._onDidChangeEditable.fire(remote); } getEditableData(remote: number | undefined): IEditableData | undefined { - return this.editable && this.editable.remote === remote ? this.editable.data : undefined; + return this._editable && this._editable.remote === remote ? this._editable.data : undefined; } + + registerCandidateFinder(finder: () => Promise<{ port: number, detail: string }[]>): void { + this.tunnelModel.registerCandidateFinder(finder); + } + } registerSingleton(IRemoteExplorerService, RemoteExplorerService, true); From 84bd121cbce4a298a3b2244cd1310be9e9b06dbb Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Thu, 12 Dec 2019 09:23:11 -0800 Subject: [PATCH 382/637] Add inline stackframe breakpoints #86469 --- .../browser/breakpointEditorContribution.ts | 3 +- .../browser/media/debug.contribution.css | 90 +++++++++++-------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 22aab183e06..85b3fb708bf 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -670,7 +670,8 @@ registerThemingParticipant((theme, collector) => { const debugIconBreakpointCurrentStackframeForegroundColor = theme.getColor(debugIconBreakpointCurrentStackframeForeground); if (debugIconBreakpointCurrentStackframeForegroundColor) { collector.addRule(` - .monaco-workbench .codicon-debug-stackframe { + .monaco-workbench .codicon-debug-stackframe, + .monaco-editor .debug-top-stack-frame-column::before { color: ${debugIconBreakpointCurrentStackframeForegroundColor} !important; } `); diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index 748852c409d..4a44bad1a57 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -8,7 +8,7 @@ } .codicon-debug-hint:not([class*='codicon-debug-breakpoint']) { - opacity: .4 !important; + opacity: 0.4 !important; } .inline-breakpoint-widget.codicon { @@ -18,7 +18,7 @@ .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, .codicon-debug-breakpoint.codicon-debug-stackframe::after { - content: "\eb8a"; + content: '\eb8a'; position: absolute; } @@ -28,26 +28,38 @@ .monaco-editor .debug-breakpoint-placeholder::before, .monaco-editor .debug-top-stack-frame-column::before { - content: " "; + content: ' '; width: 0.9em; - display: inline-block; - vertical-align: text-bottom; + display: inline-flex; + vertical-align: middle; margin-right: 2px; margin-left: 2px; + margin-top: -1px; /* TODO @misolori: figure out a way to not use negative margin for alignment */ +} + +.monaco-editor .debug-top-stack-frame-column { + display: inline-flex; + vertical-align: middle; +} + +.monaco-editor .debug-top-stack-frame-column::before { + content: '\eb8b'; + font: normal normal normal 16px/1 codicon; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + margin-left: 0; + margin-right: 4px; } /* Do not show call stack decoration when we plan to show breakpoint and top stack frame in one decoration */ .monaco-editor .debug-breakpoint-placeholder ~ .debug-top-stack-frame-column::before { width: 0em; - content: ""; + content: ''; margin-right: 0px; margin-left: 0px; } -.monaco-editor .debug-top-stack-frame-column::before { - height: 1.3em; -} - .monaco-editor .inline-breakpoint-widget { cursor: pointer; } @@ -104,7 +116,7 @@ } .monaco-workbench .monaco-list-row .expression .name { - color: #9B46B0; + color: #9b46b0; } .monaco-workbench .monaco-list-row .expression .name.virtual { @@ -120,61 +132,61 @@ } .monaco-workbench .monaco-list-row .expression .error { - color: #E51400; + color: #e51400; } .monaco-workbench .monaco-list-row .expression .value.number { - color: #09885A; + color: #09885a; } .monaco-workbench .monaco-list-row .expression .value.boolean { - color: #0000FF; + color: #0000ff; } .monaco-workbench .monaco-list-row .expression .value.string { - color: #A31515; + color: #a31515; } -.vs-dark .monaco-workbench > .monaco-list-row .expression .value { +.vs-dark .monaco-workbench > .monaco-list-row .expression .value { color: rgba(204, 204, 204, 0.6); } -.vs-dark .monaco-workbench .monaco-list-row .expression .error { - color: #F48771; -} - -.vs-dark .monaco-workbench .monaco-list-row .expression .value.number { - color: #B5CEA8; -} - -.hc-black .monaco-workbench .monaco-list-row .expression .value.number { - color: #89d185; -} - -.hc-black .monaco-workbench .monaco-list-row .expression .value.boolean { - color: #75bdfe; -} - -.hc-black .monaco-workbench .monaco-list-row .expression .value.string { +.vs-dark .monaco-workbench .monaco-list-row .expression .error { color: #f48771; } -.vs-dark .monaco-workbench .monaco-list-row .expression .value.boolean { - color: #4E94CE; +.vs-dark .monaco-workbench .monaco-list-row .expression .value.number { + color: #b5cea8; } -.vs-dark .monaco-workbench .monaco-list-row .expression .value.string { - color: #CE9178; +.hc-black .monaco-workbench .monaco-list-row .expression .value.number { + color: #89d185; +} + +.hc-black .monaco-workbench .monaco-list-row .expression .value.boolean { + color: #75bdfe; +} + +.hc-black .monaco-workbench .monaco-list-row .expression .value.string { + color: #f48771; +} + +.vs-dark .monaco-workbench .monaco-list-row .expression .value.boolean { + color: #4e94ce; +} + +.vs-dark .monaco-workbench .monaco-list-row .expression .value.string { + color: #ce9178; } .hc-black .monaco-workbench .monaco-list-row .expression .error { - color: #F48771; + color: #f48771; } /* Dark theme */ .vs-dark .monaco-workbench .monaco-list-row .expression .name { - color: #C586C0; + color: #c586c0; } /* High Contrast Theming */ From 1dd79d573cdb4b8bf5a658a466923270d6b81a52 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 11 Dec 2019 23:27:14 -0800 Subject: [PATCH 383/637] Use more explicit names --- .../src/utils/tsconfig.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/typescript-language-features/src/utils/tsconfig.ts b/extensions/typescript-language-features/src/utils/tsconfig.ts index 994292dd621..a8ce9bff2cb 100644 --- a/extensions/typescript-language-features/src/utils/tsconfig.ts +++ b/extensions/typescript-language-features/src/utils/tsconfig.ts @@ -13,23 +13,23 @@ export function isImplicitProjectConfigFile(configFileName: string) { } export function inferredProjectConfig( - config: TypeScriptServiceConfiguration + serviceConfig: TypeScriptServiceConfiguration, ): Proto.ExternalProjectCompilerOptions { - const base: Proto.ExternalProjectCompilerOptions = { + const projectConfig: Proto.ExternalProjectCompilerOptions = { module: 'commonjs' as Proto.ModuleKind, target: 'es2016' as Proto.ScriptTarget, - jsx: 'preserve' as Proto.JsxEmit + jsx: 'preserve' as Proto.JsxEmit, }; - if (config.checkJs) { - base.checkJs = true; + if (serviceConfig.checkJs) { + projectConfig.checkJs = true; } - if (config.experimentalDecorators) { - base.experimentalDecorators = true; + if (serviceConfig.experimentalDecorators) { + projectConfig.experimentalDecorators = true; } - return base; + return projectConfig; } function inferredProjectConfigSnippet( From faf453c1c49fa08ab0650f64228de865f42067f8 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 11 Dec 2019 23:27:34 -0800 Subject: [PATCH 384/637] Prefer startsWith --- extensions/typescript-language-features/src/utils/tsconfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/utils/tsconfig.ts b/extensions/typescript-language-features/src/utils/tsconfig.ts index a8ce9bff2cb..55057d9d1b7 100644 --- a/extensions/typescript-language-features/src/utils/tsconfig.ts +++ b/extensions/typescript-language-features/src/utils/tsconfig.ts @@ -9,7 +9,7 @@ import * as Proto from '../protocol'; import { TypeScriptServiceConfiguration } from './configuration'; export function isImplicitProjectConfigFile(configFileName: string) { - return configFileName.indexOf('/dev/null/') === 0; + return configFileName.startsWith('/dev/null/'); } export function inferredProjectConfig( From c645eeee692cc43a831b3fd984b006f360788f19 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 12 Dec 2019 10:31:26 -0800 Subject: [PATCH 385/637] Remove extra check --- .../src/commands/goToProjectConfiguration.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts b/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts index dbc10ea2e26..37873767085 100644 --- a/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts +++ b/extensions/typescript-language-features/src/commands/goToProjectConfiguration.ts @@ -75,13 +75,14 @@ async function goToProjectConfig( } catch { // noop } - if (!res || res.type !== 'response' || !res.body) { + + if (res?.type !== 'response' || !res.body) { vscode.window.showWarningMessage(localize('typescript.projectConfigCouldNotGetInfo', 'Could not determine TypeScript or JavaScript project')); return; } const { configFileName } = res.body; - if (configFileName && !isImplicitProjectConfigFile(configFileName)) { + if (!isImplicitProjectConfigFile(configFileName)) { const doc = await vscode.workspace.openTextDocument(configFileName); vscode.window.showTextDocument(doc, vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined); return; From dc592aab90e021d50a0ae4ae072e3ca6435458c3 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 12 Dec 2019 13:42:40 -0500 Subject: [PATCH 386/637] Removes negative look-behind, not supported in FF --- src/vs/base/common/codicons.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/base/common/codicons.ts b/src/vs/base/common/codicons.ts index 414410812a4..00b2f8b1c17 100644 --- a/src/vs/base/common/codicons.ts +++ b/src/vs/base/common/codicons.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -const escapeCodiconsRegex = /(? `\\${match}`); + return text.replace(escapeCodiconsRegex, (match, escaped) => escaped ? match : `\\${match}`); } const markdownEscapedCodiconsRegex = /\\\$\([a-z0-9\-]+?(?:~[a-z0-9\-]*?)?\)/gi; @@ -14,15 +14,15 @@ export function markdownEscapeEscapedCodicons(text: string): string { return text.replace(markdownEscapedCodiconsRegex, match => `\\${match}`); } -const markdownUnescapeCodiconsRegex = /(? `$(${codicon})`); + return text.replace(markdownUnescapeCodiconsRegex, (match, escaped, codicon) => escaped ? match : `$(${codicon})`); } const renderCodiconsRegex = /(\\)?\$\((([a-z0-9\-]+?)(?:~([a-z0-9\-]*?))?)\)/gi; export function renderCodicons(text: string): string { - return text.replace(renderCodiconsRegex, (_, escape, codicon, name, animation) => { - return escape + return text.replace(renderCodiconsRegex, (_, escaped, codicon, name, animation) => { + return escaped ? `$(${codicon})` : ``; }); From 0050cdc65334a0a2ae9c25b96c07682dc638ab7c Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Thu, 12 Dec 2019 11:42:25 -0800 Subject: [PATCH 387/637] Update Codicons: breakpoints and alt debug icon --- .../ui/codiconLabel/codicon/codicon.css | 5 ++++- .../ui/codiconLabel/codicon/codicon.ttf | Bin 47404 -> 48152 bytes 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css index 322f814c01a..5f675dd962b 100644 --- a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css +++ b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.css @@ -5,7 +5,7 @@ @font-face { font-family: "codicon"; - src: url("./codicon.ttf?c4e66586cd3ad4acc55fc456c0760dec") format("truetype"); + src: url("./codicon.ttf?492a6fd01b6016b3b49ce30bcd89656e") format("truetype"); } .codicon[class*='codicon-'] { @@ -396,6 +396,7 @@ .codicon-debug-breakpoint-function:before { content: "\eb88" } .codicon-debug-breakpoint-function-disabled:before { content: "\eb88" } .codicon-debug-stackframe-active:before { content: "\eb89" } +.codicon-debug-stackframe-dot:before { content: "\eb8a" } .codicon-debug-stackframe:before { content: "\eb8b" } .codicon-debug-stackframe-focused:before { content: "\eb8b" } .codicon-debug-breakpoint-unsupported:before { content: "\eb8c" } @@ -404,4 +405,6 @@ .codicon-debug-step-back:before { content: "\eb8f" } .codicon-debug-restart-frame:before { content: "\eb90" } .codicon-debug-alternate:before { content: "\eb91" } +.codicon-call-incoming:before { content: "\eb92" } +.codicon-call-outgoing:before { content: "\eb93" } .codicon-debug-alt:before { content: "\f101" } diff --git a/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf b/src/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf index a51c284681e086082aecd8d267d334a25b9bce8f..bde5e0589ad894d0e86644e9ebfa15db295a625f 100644 GIT binary patch delta 5828 zcmZYD34B!5y$A5$xp(HynthoNLbgdVfslpCMj#|1thLlfQ7N^Egs_Ad79n6nbPy3K zrhd_GHgT`VBA)TpIu)v9%++EPoYMQTwgJx8q|P--o_-_5`6d!P3vpYQzV-rSkw zo_o&!|G#tKtaaZ-YkM^D7@+zA%@J|I1NNzcuTzqw(_8^G`|u&u6Z zQOClJXI^`s$G$@iUEG0_>KlCh6qR%>>+QRv?eb-Q-g|)O(Vi8Z9S^^8!~t>+0@mDR z9epdU>DbTT=kWN#sr>W{z=0V+%4_#N6>Y7A;<2>t zq2P1Zr!=2O2rIbqSE-F+QS0PE2U>Ny1uBGd*r^oGD_aGX7niXKpDN!# zkFOvx4&%{`324Jaq$2~F$U-)TAs54uhY`p}0SZxsVnk7jGQ?1hkr;*1s6-X2QG+q4 zMLinOh_RT2$(Vv^n888(H_XHrF$-7Y8qCI*Fb7}8wfG9=;yPT94s`OQ7bUO+U08~4 z+<+b|!*X7)8?g$j(Tg=$i<@vW*5MW&vmUqNHf+G{xC3`$Gw#9`Y{lK^$Jek8+i@>; zU;sPub?m~w<38Mv|HN+m7rupW<2!f|-@{()<9vDu-^auF0S;mikAf5WaU8;r@g%3^ zPw+IJ!B6oVp2rLL8D7N8cm=QGH5|sz@jBkXFL4BK;@9{Mj^Vd>3%|p0yp0q1Jtz4e za1!t0eVoD{aT*36;3NDQALA@O!3F#U7x7nohQH&Ig0hrHIm)k+!zx9ksx+0ZGF0Zk z{(U2A%T!F2tC4Dys!*fx0KS25Vh>u-iqGK+d>-v8fa&-GrXqqIG;!WKgB<}&CBStD zB#)JurK;SSC)`=CI|Szz^a8)s;&pMxLvz8pIQOAf39bU@)uM$9 z0=idlX+W<&c|?nmDuxSXKZ3ob0^TLqUG^lgHRjpr@6 z?4UOYJi>Up;8KL%D7Yx0?+{#`(3=DoD)gN|!hPbJh2AWF!-&ZO`s)IpGVT&gASc7m zOc=+l?+K<7=)HnT1$v)gdV$_A(8l7 zF!Mn_E0_bJe=3*_p`R1Xi_p&tW=QB41al?y&jiOA`bEL~nSg$Y8^lx!{jy+Eg?>da zy+R)rOtjEH7fiX(uL~w$=r;t@Ftj^Qi3u6{mx8Go`iNkXhW?d{6PWoL`c2`MKmBXL z91eX{Fq=dFMli2K9}~>*(7zST_0Vq#W_{@23Fd$3Ve z0sW3($$kU@Ve+!jQi5pLU|&kB|~=uh11{|V22H8;)) z);{R-f>jXuf?z#_{)=E`guW8VUf`u5y7A(my9>L-a;}tB^FpglshVcoOZWuo$_{1s>6A-ND zFhRk}4igfr@i1Y*Y7dhnSodL)1v>zk6yYXAlPcI1z@!QG2QcY^odOajgB!%A0VY$h zeSpalY$RZ^1zQT3h+uO8lOxz>zzh>?IAC%GTMwAwf=viao?tryGhztGe=lF;3-%~5 z1;XuqO`%}l0#hW|!N3#?_A)S0!LA0TM6kbsDHZH=V9Er09+;TGV~pke`=*>{|2X4F z!Hx)KlwfZJQz6(T!HgDe8*eHFJ13Yb!5#{xTCkgfsS)g}V8#e`STJ#c#PfVnE7*3y z)Co3VF!h417)*m;QwGy0*q*_R6>QXCngm-mm~n#58_amYHV&p)u%UyQ;9h?|vA2V1 z5$y6{S_S((m^Q)A4`!lZ4+zsP*bTx=66_0MCJT0mFjEA3MVP6AT_emi!TvD;Go2g6 zRublOf=wmN6@u+0%;yE(VVoh@a>9H;u=#|!Qm_q$nJL(i!hBJ%HHDca*rdW-<>K{c zzY24;a2LI~MzDv4nJw7O!hA`vuZ5W-*x|x_S+LiIxmK|2h53qL{|hr$uoH&4POvBD z`k%)qVtWj8y6)KN$jZh;P*9w)-c#}{CjD12CGTtmy5#u_ciWzSaD$2NCs4~V|g^Ka|o7;pc zXLPqojbz*)l$#4~7pj7Bqu>n+%pHQaDlnS_Z(3mP6uf6Cuv5~ z`lKC6Pb9sbq?0~N9-TZZxi5Kd@)IdFDf3b`r5sH;n@G)0ZAhJ$x-Rwp)WfM4({j?< z(t6T%rkzgjO5c;NGx9U~G7e^XGP^PlW}eHc%epV?)vSxznb{k%AILtG{br;%GCQ&< zav^74&iH`|~_`lk;Zh?aF&X94=f?xT7#}p=fT=!$qfygT>v&8;f^G{n5f`d$c!tq-0*nBPAzG{iWrl(@WQu z9xlC57BA~A+h2A(mK->5C49v^kCVsypiik^!8 zic_OANAIab<^0MQDlb&!RrOSDsoGiHUj41==W60LeKn`XOdYd5G3G=(7;lU3ieIRm zRlBZsckQvdoVw<^m38~;QD0Mke?w}+oQ7u`E;iOQZf*R<*l}ZLk6qO?wyC>mL(_vz zFE(8q*F5g!ae92o_yyxPjXya4NVBJTbMv9*_a>B2m^I<$7Eeo8%l4L6TgSHcwjOFd z*Vf!Nziofp(Y6mJHc#wtPi?QhqW#+T?)G)7BB3%8@CTrp}wXZd(4d`P1$nJf557PuQG3V3W9%x48@42C=cMIK^^`tL?g0tD(NG zT2-my6qRgc<~z0V7S*a6>SJ})R+-O<7MI1!VpVp1T?6;V3+zn3F*CbBW!J{}-dcBu zavFWLS<(91tj0N($FhC=CMRMmSG=e4}HvaEpeTDBAN zh67%|<59|IS;}!36~BSVwY?U9%flS6QhqDFFcS3@R`XXpBFDCPm~B}eJ7C#7((441 z!r@SWA7k4dJ}hPXtpaZN0^U#}6mo1YztB)#$Nd|&#RGEr5ArWL{3k7+x~9+S=OtScEcSL+~ccAL4 zZFhvD#qQ81hDMpg>5j3=%FMSS*^zuT!9As-4EG%P@A4!#G~uMszs`c=f=9bd#wL;797T04wak+M~bK8@dmtsuoIkE3^<(^4i{TDC7}$X4p+UbN-7?*zpYw4PS&ksnZJst;vCMr>xBJ4<8*0rg)Pa z$M5wzNonapf57qi!rrjQ$8&W8UJqY~!k$8pFA(ru<;in~+tsm*!RqQQYH-Pzd#r&U z)*Ku>U)#S%RSs_4H=9$q(yAIb_Rza|Nu3=%J(WwBcdl5rbomn5TCt{g$qH@_K6&6q zYvAr5Y@85TxM;zeC6%jtJ34Pzyoz51S9WyvE?v7Q^Z)H%xS}`p|LhzLA1n+g{5Ojh Btk(bl delta 5108 zcmaLbd0f|vUaT7 z?pm5#u9%gX*=6RMm6@fPrIOk6n59yYneON3cl)>T^`7tihM9Re{GR9g{rqU_vTeO& zYe{sU0#q}AvDLFGXU|AFcM0%p0Rk^gnYnQC*dF#sAmRkj+&HzivL?7G`WRpP6%|b7 z6F99N=i}X!G<8-(ObluR!dC&dakDBLXWNEg3x6KY*T>aW z&Z>>y98s|xcxDV=;Fw)Mui;{c%>bJx0Raae-JMvL0mawS&*9T2P7Emd5x$tsXK?Il z{k7lgb>1+C{{U~;tY>-SdsIeij9TcEf{{E9KuY^YwW(YCNRPXf`|yp=h3z1^-FTGA z>HxYOhTXQ2ulB$3NuIh%H|zJzNYiprS>H@g(rffueb9`OW4`kDo8o)!K^2awlmoZIPbFX$KjaWz#0%J_ zg7E+rU>S1p3nnQaT*9Am9ha3--l`jZ!wPgMkJcq#vF;-DMKSuJ6lDlPFhbx$D8dkq z9*96Bq7aQ3#3ByyNJJ8nk%FE`MLIH&i7aHJ7kVQP`RIcJ48mXx!B7mtaE#zD?@t(o z(YOs`a68804vfQ{7>~PfHzuNzU%A?iT1>_iOvN-z#|+Fw9qM_W=3p-7p#k%8FB-9s zuUUk}Sc0W+V>wo074FAsG~q$4!9#c$k64#E7svLtVbLEiYM?lY{cL3H2#Ty zVH2Lgv)GL1uoeHt^Y{<8qi;KQU?*O}E7*lsxg1}^>)4Ao@Fw2E+t`P9u^;c@0RD@E zcpo3&LmbA(_yk8=4|#{V&!7We<1D^~#(8{)3-|#S(TN}N6Mn`O{EDl%rl4%ft~`}f z`6+)Dpt`F-6{JFxONFX16|Q=y2oS(A2%TMGJ$QZ%LO+j^a{c43B6Kqqe8RKSzx{I ze!0N=WG3oc>IiDSAl+3u)jcW7VI?8TLgO!^m77b zt(W|6a) zg1rrzqsVRDvCTohCfM+x_XxH==+_0CAoO0rb_o53U}J=SQ?Nxsza`i#q2Cs4o6y$w zA~sOyeS)o&tN2|W5W6b$e!>0<{hnZ_g+3_QbD`fC?7q;}iX`@7=nn)tGW3Uny&3u= z!7dGbSg>D1e{A6jX6uGNBG|;CKM`!_&_{(e74@frEgt$a!DbJAOt9@k9~T?|(4PyA z0_YQhLjn2=!STRVe3Ey>Ndf((;LL#jN^p8WpAwuS(5D3_3iKJl*#g}mIAx%}7MwTG zX9Xt@^fv<4tmlL^jiA33oH@{1a6&;F!C3`;UT|tbem2hf&WJsB{+#;Y=Scxrkmh&hOrCIX&4W| zi4Ef^IJ;rI1gAKRH@SJofezy%IND(xfV~Gf zU_gKg6pRWmL4u(HZWGJ{Vt#-L5lj*=F2PIz6DpW4V8R4*228lXM%EsJ*#jm*FonQG z3g!`*D8Xa`6MX}Jx10DNMli0x#0mx%m^i@*0~0S8W?&KoV+~BAV8DS%5{x=9$%3H= zCPgs*!1NSoXHB)vZ7RS04%Rfma0HVs7?WT!1OpRHreJh}$r21vFxkRN_okO%u!6}E zj94(e1@^M$3b^0kgFL|m29qzC#bEjfrZSiU!F&c&D45h>iUczoOkctD22(7U<6!y; zCOViB!E6W9-#Y)iW6Xmo6%2eZWrEQUrd%)t!c+*xL6`x8!4PJkz){vg0-v%D7Wj;H zh`=${n*@$?Z<(PyAbiexv%m?~VFF*U-Xd_4b-2KntRn=zVjU@PiglF08P;0`b1Tef z!2}C)n}z3}VHReLV626?T`=Inj1`Q!Fn0)sUYK!$@fYS!!5|DXUN92F+$9)}VI~O1 zWSF}J12gykJ-j1kXPAkCDH>*yV4jAl6in7IRRY&otA*m*O^r}C)>@(LtdoWEWSt_E zlXa?aD?dJ%CX_$xbfK(9GDE2DtTTlQWSu2c5Nn-KA*}U6xmafl70NnCs4&*K!n&?C z^Q`kfkNK+y4;qAuV4W{iBON2^dy-%oQ zo`17cs1#P~m{d>JWkRL0E*C0|b%o$%3d~Bu3l^AFf|o8Z_X}Rcz^oR$oPl{j@WKYB ziQK&7H4e;!0_Ci01h0Ew9um9)f@v18w%fykS4A+72woq-tQD|!OpD+p6E1R*SWrmT zt(cLf5$jubhbOyh>>t`s+dDlxJ>ooaJxV<$cr%3chY(6nQLw&~h>~+AA?wI6Q<#@ue)v?>L-*LjBeS>^cd#;EQ-7*a#v($R6%9 zI@6XpIkPQuPnLgHdR9SJNA{rXn(QOJB6>CTI+v51vn*$;JLh!oqTX%2J9DFQ%X1gy z?#exx7nCa(HG;eyP9xdkT*x(Y)Ij~6+M5{iZvO)c6`bh7XC zzRi9272AtbiboeW6mRO6+HZWn)%_0i>nxdGvZ=qLe{TPo{g0Q1mX0r7UwX34RyMq> zvFwquljYgv+sn_FU#-Y+Rzy`~R;;QxP|-P{e88@O&Vi)^7Y*Dw@TWncg9-*U4B9vt zgQEuT9by|&((a6OdAH9=KJPo49fh}POqSi?#XmI#@-Hde)P;$C@?43oyq?rc^(hQ< z^>h`6@yV*PvJoTv)6++KddA0v59{6gF0V0OiC&(zoNnQsAqjzYulC5?Ce>P4u%-RU zymhwrQw7cQRYrT=*0HwM{m-9ifA@tswuuQfwN>+{WL3?rt(-Btep+2a*1U$w>KT*g j@-JjrmDLT?7SzW6(MxLT8zTSU=dDHCSG0F+kM;Q Date: Thu, 12 Dec 2019 11:42:46 -0800 Subject: [PATCH 388/637] Don't show debug hint on stackframes --- .../contrib/debug/browser/breakpointEditorContribution.ts | 2 +- .../contrib/debug/browser/media/debug.contribution.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 85b3fb708bf..69022ed59f4 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -641,7 +641,7 @@ registerThemingParticipant((theme, collector) => { .monaco-workbench .codicon-debug-breakpoint-function, .monaco-workbench .codicon-debug-breakpoint-data, .monaco-workbench .codicon-debug-breakpoint-unsupported, - .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']), + .monaco-workbench .codicon-debug-hint:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']), .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe-focused::after, .monaco-workbench .codicon-debug-breakpoint.codicon-debug-stackframe::after { color: ${debugIconBreakpointColor} !important; diff --git a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css index 4a44bad1a57..85738aad25c 100644 --- a/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css +++ b/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css @@ -7,7 +7,7 @@ cursor: pointer; } -.codicon-debug-hint:not([class*='codicon-debug-breakpoint']) { +.codicon-debug-hint:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']) { opacity: 0.4 !important; } From 19587ff1167011f6716ac384843874d3d6fb2754 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Thu, 12 Dec 2019 12:01:11 -0800 Subject: [PATCH 389/637] Improve rendering of errors within issue reporter --- .../code/electron-browser/issue/issueReporterMain.ts | 12 ++++++++++-- .../electron-browser/issue/media/issueReporter.css | 11 ++--------- src/vs/platform/issue/node/issue.ts | 2 ++ .../contrib/issue/electron-browser/issueService.ts | 4 +++- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/vs/code/electron-browser/issue/issueReporterMain.ts b/src/vs/code/electron-browser/issue/issueReporterMain.ts index cc60334760f..6b1bab2128b 100644 --- a/src/vs/code/electron-browser/issue/issueReporterMain.ts +++ b/src/vs/code/electron-browser/issue/issueReporterMain.ts @@ -185,8 +185,16 @@ export class IssueReporter extends Disposable { } if (styles.inputErrorBorder) { - content.push(`.invalid-input, .invalid-input:focus { border: 1px solid ${styles.inputErrorBorder} !important; }`); - content.push(`.validation-error, .required-input { color: ${styles.inputErrorBorder}; }`); + content.push(`.invalid-input, .invalid-input:focus, .validation-error { border: 1px solid ${styles.inputErrorBorder} !important; }`); + content.push(`.required-input { color: ${styles.inputErrorBorder}; }`); + } + + if (styles.inputErrorBackground) { + content.push(`.validation-error { background: ${styles.inputErrorBackground}; }`); + } + + if (styles.inputErrorForeground) { + content.push(`.validation-error { color: ${styles.inputErrorForeground}; }`); } if (styles.inputActiveBorder) { diff --git a/src/vs/code/electron-browser/issue/media/issueReporter.css b/src/vs/code/electron-browser/issue/media/issueReporter.css index 78e41309e48..eb4f53747a8 100644 --- a/src/vs/code/electron-browser/issue/media/issueReporter.css +++ b/src/vs/code/electron-browser/issue/media/issueReporter.css @@ -251,16 +251,9 @@ a { text-decoration: none; } -.invalid-input { - border: 1px solid #be1100; -} - -.required-input, .validation-error { - color: #be1100; -} - .section .input-group .validation-error { - margin-left: 15%; + margin-left: calc(15% + 5px); + padding: 10px; } .section .inline-form-control, .section .inline-label { diff --git a/src/vs/platform/issue/node/issue.ts b/src/vs/platform/issue/node/issue.ts index 99b9a3b8565..aeb55398adf 100644 --- a/src/vs/platform/issue/node/issue.ts +++ b/src/vs/platform/issue/node/issue.ts @@ -32,6 +32,8 @@ export interface IssueReporterStyles extends WindowStyles { inputForeground?: string; inputBorder?: string; inputErrorBorder?: string; + inputErrorBackground?: string; + inputErrorForeground?: string; inputActiveBorder?: string; buttonBackground?: string; buttonForeground?: string; diff --git a/src/vs/workbench/contrib/issue/electron-browser/issueService.ts b/src/vs/workbench/contrib/issue/electron-browser/issueService.ts index 8be9212e101..e0079914b9a 100644 --- a/src/vs/workbench/contrib/issue/electron-browser/issueService.ts +++ b/src/vs/workbench/contrib/issue/electron-browser/issueService.ts @@ -5,7 +5,7 @@ import { IssueReporterStyles, IIssueService, IssueReporterData, ProcessExplorerData, IssueReporterExtensionData } from 'vs/platform/issue/node/issue'; import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService'; -import { textLinkForeground, inputBackground, inputBorder, inputForeground, buttonBackground, buttonHoverBackground, buttonForeground, inputValidationErrorBorder, foreground, inputActiveOptionBorder, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, editorBackground, editorForeground, listHoverBackground, listHoverForeground, listHighlightForeground, textLinkActiveForeground } from 'vs/platform/theme/common/colorRegistry'; +import { textLinkForeground, inputBackground, inputBorder, inputForeground, buttonBackground, buttonHoverBackground, buttonForeground, inputValidationErrorBorder, foreground, inputActiveOptionBorder, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, editorBackground, editorForeground, listHoverBackground, listHoverForeground, listHighlightForeground, textLinkActiveForeground, inputValidationErrorBackground, inputValidationErrorForeground } from 'vs/platform/theme/common/colorRegistry'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; @@ -86,6 +86,8 @@ export function getIssueReporterStyles(theme: ITheme): IssueReporterStyles { inputBorder: getColor(theme, inputBorder), inputActiveBorder: getColor(theme, inputActiveOptionBorder), inputErrorBorder: getColor(theme, inputValidationErrorBorder), + inputErrorBackground: getColor(theme, inputValidationErrorBackground), + inputErrorForeground: getColor(theme, inputValidationErrorForeground), buttonBackground: getColor(theme, buttonBackground), buttonForeground: getColor(theme, buttonForeground), buttonHoverBackground: getColor(theme, buttonHoverBackground), From 33e545eeddf7873608a2f01d88523be898299b98 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 12 Dec 2019 21:30:00 +0100 Subject: [PATCH 390/637] add and fix tests --- .../configuration/common/configuration.ts | 18 +- .../common/configurationModels.ts | 43 +- .../test/common/configurationModels.test.ts | 656 +++++++++++++++--- .../api/common/extHostConfiguration.ts | 2 +- .../common/configurationModels.ts | 63 +- .../test/common/configurationModels.test.ts | 211 ++---- .../api/extHostConfiguration.test.ts | 10 +- 7 files changed, 693 insertions(+), 310 deletions(-) diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index ffe876e4859..da2b28fb921 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -160,10 +160,12 @@ export function compare(from: IConfigurationModel | undefined, to: IConfiguratio if (to && from) { for (const key of from.keys) { - const value1 = getConfigurationValue(from.contents, key); - const value2 = getConfigurationValue(to.contents, key); - if (!objects.equals(value1, value2)) { - updated.push(key); + if (to.keys.indexOf(key) !== -1) { + const value1 = getConfigurationValue(from.contents, key); + const value2 = getConfigurationValue(to.contents, key); + if (!objects.equals(value1, value2)) { + updated.push(key); + } } } } @@ -173,7 +175,7 @@ export function compare(from: IConfigurationModel | undefined, to: IConfiguratio const result: IStringDictionary = {}; for (const override of overrides) { for (const identifier of override.identifiers) { - result[identifier] = override; + result[keyFromOverrideIdentifier(identifier)] = override; } } return result; @@ -185,7 +187,7 @@ export function compare(from: IConfigurationModel | undefined, to: IConfiguratio for (const key of added) { const override = toOverridesByIdentifier[key]; if (override) { - overrides.push([key, override.keys]); + overrides.push([overrideIdentifierFromKey(key), override.keys]); } } } @@ -193,7 +195,7 @@ export function compare(from: IConfigurationModel | undefined, to: IConfiguratio for (const key of removed) { const override = fromOverridesByIdentifier[key]; if (override) { - overrides.push([key, override.keys]); + overrides.push([overrideIdentifierFromKey(key), override.keys]); } } } @@ -204,7 +206,7 @@ export function compare(from: IConfigurationModel | undefined, to: IConfiguratio const toOverride = toOverridesByIdentifier[key]; if (fromOverride && toOverride) { const result = compare({ contents: fromOverride.contents, keys: fromOverride.keys, overrides: [] }, { contents: toOverride.contents, keys: toOverride.keys, overrides: [] }); - overrides.push([key, [...result.added, ...result.removed, ...result.updated]]); + overrides.push([overrideIdentifierFromKey(key), [...result.added, ...result.removed, ...result.updated]]); } } } diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index ecc33ce7e4d..704d5348f95 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -466,7 +466,8 @@ export class Configuration { compareAndUpdateDefaultConfiguration(defaults: ConfigurationModel, keys: string[]): IConfigurationChange { const overrides: [string, string[]][] = keys .filter(key => OVERRIDE_PROPERTY_PATTERN.test(key)) - .map(overrideIdentifier => { + .map(key => { + const overrideIdentifier = overrideIdentifierFromKey(key); const fromKeys = this._defaultConfiguration.getKeysForOverrideIdentifier(overrideIdentifier); const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier); const keys = [ @@ -489,6 +490,44 @@ export class Configuration { return { keys, overrides }; } + compareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): IConfigurationChange { + const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { + this.updateRemoteUserConfiguration(user); + } + return { keys, overrides }; + } + + compareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): IConfigurationChange { + const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { + this.updateWorkspaceConfiguration(workspaceConfiguration); + } + return { keys, overrides }; + } + + compareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): IConfigurationChange { + const currentFolderConfiguration = this.folderConfigurations.get(resource); + const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration); + let keys = [...added, ...updated, ...removed]; + if (keys.length) { + this.updateFolderConfiguration(resource, folderConfiguration); + } + return { keys, overrides }; + } + + compareAndDeleteFolderConfiguration(folder: URI): IConfigurationChange { + const folderConfig = this.folderConfigurations.get(folder); + if (!folderConfig) { + throw new Error('Unknown folder'); + } + this.deleteFolderConfiguration(folder); + const { added, updated, removed, overrides } = compare(folderConfig, undefined); + return { keys: [...added, ...updated, ...removed], overrides }; + } + get defaults(): ConfigurationModel { return this._defaultConfiguration; } @@ -675,7 +714,7 @@ export class ConfigurationChangeEvent implements IConfigurationChangeEvent { this.affectedKeys = values(keysSet); const configurationModel = new ConfigurationModel(); - this.affectedKeys.forEach(key => this.affectedKeysTree.setValue(key, {})); + this.affectedKeys.forEach(key => configurationModel.setValue(key, {})); this.affectedKeysTree = configurationModel.contents; } diff --git a/src/vs/platform/configuration/test/common/configurationModels.test.ts b/src/vs/platform/configuration/test/common/configurationModels.test.ts index 91e4cf5c864..2bc6ae07958 100644 --- a/src/vs/platform/configuration/test/common/configurationModels.test.ts +++ b/src/vs/platform/configuration/test/common/configurationModels.test.ts @@ -3,10 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, ConfigurationModelParser, Configuration } from 'vs/platform/configuration/common/configurationModels'; +import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, ConfigurationModelParser, Configuration, mergeChanges, AllKeysConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; import { URI } from 'vs/base/common/uri'; +import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace'; +import { join } from 'vs/base/common/path'; +import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; suite('ConfigurationModel', () => { @@ -181,7 +184,7 @@ suite('ConfigurationModel', () => { let result = base.merge(add); assert.deepEqual(result.contents, { 'a': { 'b': 2 } }); - assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': 2, 'b': 2 } }]); + assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': 2, 'b': 2 }, keys: ['a'] }]); assert.deepEqual(result.override('c').contents, { 'a': 2, 'b': 2 }); assert.deepEqual(result.keys, ['a.b']); }); @@ -192,7 +195,7 @@ suite('ConfigurationModel', () => { let result = base.merge(add); assert.deepEqual(result.contents, { 'a': { 'b': 2 }, 'f': 1 }); - assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': { 'd': 1, 'e': 2 } } }]); + assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': { 'd': 1, 'e': 2 } }, keys: ['a'] }]); assert.deepEqual(result.override('c').contents, { 'a': { 'b': 2, 'd': 1, 'e': 2 }, 'f': 1 }); assert.deepEqual(result.keys, ['a.b', 'f']); }); @@ -203,7 +206,7 @@ suite('ConfigurationModel', () => { let result = new ConfigurationModel().merge(model1, model2); assert.deepEqual(result.contents, { 'a': { 'b': 2 }, 'f': 1 }); - assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': { 'd': 1, 'e': 2 } } }]); + assert.deepEqual(result.overrides, [{ identifiers: ['c'], contents: { 'a': { 'd': 1, 'e': 2 } }, keys: ['a'] }]); assert.deepEqual(result.override('c').contents, { 'a': { 'b': 2, 'd': 1, 'e': 2 }, 'f': 1 }); assert.deepEqual(result.keys, ['a.b', 'f']); }); @@ -360,108 +363,6 @@ suite('CustomConfigurationModel', () => { }); }); -suite('ConfigurationChangeEvent', () => { - - test('changeEvent affecting keys', () => { - let testObject = new ConfigurationChangeEvent({ keys: ['window.zoomLevel', 'workbench.editor.enablePreview', 'files', '[markdown]'], overrides: [] }, undefined, anEmptyConfiguration()); - - assert.deepEqual(testObject.affectedKeys, ['window.zoomLevel', 'workbench.editor.enablePreview', 'files', '[markdown]']); - assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files.exclude')); - assert.ok(testObject.affectsConfiguration('[markdown]')); - }); - - test('changeEvent affecting a root key and its children', () => { - let testObject = new ConfigurationChangeEvent({ keys: ['launch', 'launch.version', 'tasks'], overrides: [] }, undefined, anEmptyConfiguration()); - - assert.deepEqual(testObject.affectedKeys, ['launch.version', 'tasks']); - assert.ok(testObject.affectsConfiguration('launch')); - assert.ok(testObject.affectsConfiguration('launch.version')); - assert.ok(testObject.affectsConfiguration('tasks')); - }); - - test('changeEvent affecting keys for resources', () => { - const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); - configuration.updateLocalUserConfiguration(toConfigurationModel({ 'window.title': false })); - configuration.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ 'window.zoomLevel': false, 'window.restoreFullscreen': false })); - configuration.updateFolderConfiguration(URI.file('file2'), toConfigurationModel({ 'workbench.editor.enablePreview': false, 'window.restoreWindows': false })); - const testObject = new ConfigurationChangeEvent({ keys: ['window.title', 'window.zoomLevel', 'workbench.editor.enablePreview', 'window.restoreFullscreen', 'window.restoreWindows'], overrides: [] }, undefined, configuration); - - assert.deepEqual(testObject.affectedKeys, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); - - assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window.restoreWindows')); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('window.title')); - assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); - assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); - - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file1') })); - - assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('file2') })); - assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('file1') })); - - assert.ok(!testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file1') })); - assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file2') })); - }); - - test('merging change events', () => { - let event1 = new ConfigurationChangeEvent().change(['window.zoomLevel', 'files']); - let event2 = new ConfigurationChangeEvent().change(['window.title'], URI.file('file1')).change(['[markdown]']); - - let actual = event1.change(event2); - - assert.deepEqual(actual.affectedKeys, ['window.zoomLevel', 'files', '[markdown]', 'window.title']); - - assert.ok(actual.affectsConfiguration('window.zoomLevel')); - assert.ok(actual.affectsConfiguration('window.zoomLevel', URI.file('file1'))); - assert.ok(actual.affectsConfiguration('window.zoomLevel', URI.file('file2'))); - - assert.ok(actual.affectsConfiguration('window')); - assert.ok(actual.affectsConfiguration('window', URI.file('file1'))); - assert.ok(actual.affectsConfiguration('window', URI.file('file2'))); - - assert.ok(actual.affectsConfiguration('files')); - assert.ok(actual.affectsConfiguration('files', URI.file('file1'))); - assert.ok(actual.affectsConfiguration('files', URI.file('file2'))); - - assert.ok(actual.affectsConfiguration('window.title')); - assert.ok(actual.affectsConfiguration('window.title', URI.file('file1'))); - assert.ok(!actual.affectsConfiguration('window.title', URI.file('file2'))); - - assert.ok(actual.affectsConfiguration('[markdown]')); - assert.ok(actual.affectsConfiguration('[markdown]', URI.file('file1'))); - assert.ok(actual.affectsConfiguration('[markdown]', URI.file('file2'))); - }); - -}); - suite('Configuration', () => { test('Test update value', () => { @@ -485,12 +386,549 @@ suite('Configuration', () => { assert.equal(testObject.getValue('a', {}, undefined), 2); }); + test('Test compare and update default configuration', () => { + const testObject = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + testObject.updateDefaultConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'on', + })); + + const actual = testObject.compareAndUpdateDefaultConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'off', + '[markdown]': { + 'editor.wordWrap': 'off' + } + }), ['editor.lineNumbers', '[markdown]']); + + assert.deepEqual(actual, { keys: ['editor.lineNumbers', '[markdown]'], overrides: [['markdown', ['editor.wordWrap']]] }); + + }); + + test('Test compare and update user configuration', () => { + const testObject = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + testObject.updateLocalUserConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'off', + 'editor.fontSize': 12, + '[typescript]': { + 'editor.wordWrap': 'off' + } + })); + + const actual = testObject.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'on', + 'window.zoomLevel': 1, + '[typescript]': { + 'editor.wordWrap': 'on', + 'editor.insertSpaces': false + } + })); + + assert.deepEqual(actual, { keys: ['window.zoomLevel', 'editor.lineNumbers', '[typescript]', 'editor.fontSize'], overrides: [['typescript', ['editor.insertSpaces', 'editor.wordWrap']]] }); + + }); + + test('Test compare and update workspace configuration', () => { + const testObject = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + testObject.updateWorkspaceConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'off', + 'editor.fontSize': 12, + '[typescript]': { + 'editor.wordWrap': 'off' + } + })); + + const actual = testObject.compareAndUpdateWorkspaceConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'on', + 'window.zoomLevel': 1, + '[typescript]': { + 'editor.wordWrap': 'on', + 'editor.insertSpaces': false + } + })); + + assert.deepEqual(actual, { keys: ['window.zoomLevel', 'editor.lineNumbers', '[typescript]', 'editor.fontSize'], overrides: [['typescript', ['editor.insertSpaces', 'editor.wordWrap']]] }); + + }); + + test('Test compare and update workspace folder configuration', () => { + const testObject = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + testObject.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ + 'editor.lineNumbers': 'off', + 'editor.fontSize': 12, + '[typescript]': { + 'editor.wordWrap': 'off' + } + })); + + const actual = testObject.compareAndUpdateFolderConfiguration(URI.file('file1'), toConfigurationModel({ + 'editor.lineNumbers': 'on', + 'window.zoomLevel': 1, + '[typescript]': { + 'editor.wordWrap': 'on', + 'editor.insertSpaces': false + } + })); + + assert.deepEqual(actual, { keys: ['window.zoomLevel', 'editor.lineNumbers', '[typescript]', 'editor.fontSize'], overrides: [['typescript', ['editor.insertSpaces', 'editor.wordWrap']]] }); + + }); + + test('Test compare and deletre workspace folder configuration', () => { + const testObject = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + testObject.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ + 'editor.lineNumbers': 'off', + 'editor.fontSize': 12, + '[typescript]': { + 'editor.wordWrap': 'off' + } + })); + + const actual = testObject.compareAndDeleteFolderConfiguration(URI.file('file1')); + + assert.deepEqual(actual, { keys: ['editor.lineNumbers', 'editor.fontSize', '[typescript]'], overrides: [['typescript', ['editor.wordWrap']]] }); + + }); }); -function anEmptyConfiguration(): Configuration { - return new Configuration(new ConfigurationModel(), new ConfigurationModel()); -} +suite('ConfigurationChangeEvent', () => { + + test('changeEvent affecting keys with new configuration', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + const change = configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'window.zoomLevel': 1, + 'workbench.editor.enablePreview': false, + 'files.autoSave': 'off', + })); + let testObject = new ConfigurationChangeEvent(change, undefined, configuration); + + assert.deepEqual(testObject.affectedKeys, ['window.zoomLevel', 'workbench.editor.enablePreview', 'files.autoSave']); + + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window')); + + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench')); + + assert.ok(testObject.affectsConfiguration('files')); + assert.ok(testObject.affectsConfiguration('files.autoSave')); + assert.ok(!testObject.affectsConfiguration('files.exclude')); + + assert.ok(!testObject.affectsConfiguration('[markdown]')); + assert.ok(!testObject.affectsConfiguration('editor')); + }); + + test('changeEvent affecting keys when configuration changed', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateLocalUserConfiguration(toConfigurationModel({ + 'window.zoomLevel': 2, + 'workbench.editor.enablePreview': true, + 'files.autoSave': 'off', + })); + const data = configuration.toData(); + const change = configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'window.zoomLevel': 1, + 'workbench.editor.enablePreview': false, + 'files.autoSave': 'off', + })); + let testObject = new ConfigurationChangeEvent(change, { data }, configuration); + + assert.deepEqual(testObject.affectedKeys, ['window.zoomLevel', 'workbench.editor.enablePreview']); + + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window')); + + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench')); + + assert.ok(!testObject.affectsConfiguration('files')); + assert.ok(!testObject.affectsConfiguration('[markdown]')); + assert.ok(!testObject.affectsConfiguration('editor')); + }); + + test('changeEvent affecting overrides with new configuration', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + const change = configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'files.autoSave': 'off', + '[markdown]': { + 'editor.wordWrap': 'off' + } + })); + let testObject = new ConfigurationChangeEvent(change, undefined, configuration); + + assert.deepEqual(testObject.affectedKeys, ['files.autoSave', '[markdown]', 'editor.wordWrap']); + + assert.ok(testObject.affectsConfiguration('files')); + assert.ok(testObject.affectsConfiguration('files.autoSave')); + assert.ok(!testObject.affectsConfiguration('files.exclude')); + + assert.ok(testObject.affectsConfiguration('[markdown]')); + assert.ok(!testObject.affectsConfiguration('[markdown].editor')); + assert.ok(!testObject.affectsConfiguration('[markdown].workbench')); + + assert.ok(testObject.affectsConfiguration('editor')); + assert.ok(testObject.affectsConfiguration('editor.wordWrap')); + assert.ok(testObject.affectsConfiguration('editor', { overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.wordWrap', { overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor', { overrideIdentifier: 'json' })); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { overrideIdentifier: 'markdown' })); + + assert.ok(!testObject.affectsConfiguration('editor.fontSize')); + assert.ok(!testObject.affectsConfiguration('window')); + }); + + test('changeEvent affecting overrides when configuration changed', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateLocalUserConfiguration(toConfigurationModel({ + 'workbench.editor.enablePreview': true, + '[markdown]': { + 'editor.fontSize': 12, + 'editor.wordWrap': 'off' + }, + 'files.autoSave': 'off', + })); + const data = configuration.toData(); + const change = configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'files.autoSave': 'off', + '[markdown]': { + 'editor.fontSize': 13, + 'editor.wordWrap': 'off' + }, + 'window.zoomLevel': 1, + })); + let testObject = new ConfigurationChangeEvent(change, { data }, configuration); + + assert.deepEqual(testObject.affectedKeys, ['window.zoomLevel', '[markdown]', 'workbench.editor.enablePreview', 'editor.fontSize']); + + assert.ok(!testObject.affectsConfiguration('files')); + + assert.ok(testObject.affectsConfiguration('[markdown]')); + assert.ok(!testObject.affectsConfiguration('[markdown].editor')); + assert.ok(!testObject.affectsConfiguration('[markdown].editor.fontSize')); + assert.ok(!testObject.affectsConfiguration('[markdown].editor.wordWrap')); + assert.ok(!testObject.affectsConfiguration('[markdown].workbench')); + + assert.ok(testObject.affectsConfiguration('editor')); + assert.ok(testObject.affectsConfiguration('editor', { overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.fontSize', { overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap')); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor', { overrideIdentifier: 'json' })); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { overrideIdentifier: 'json' })); + + assert.ok(testObject.affectsConfiguration('window')); + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window', { overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { overrideIdentifier: 'markdown' })); + + assert.ok(testObject.affectsConfiguration('workbench')); + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench', { overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('workbench.editor', { overrideIdentifier: 'markdown' })); + }); + + test('changeEvent affecting workspace folders', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateWorkspaceConfiguration(toConfigurationModel({ 'window.title': 'custom' })); + configuration.updateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'window.zoomLevel': 2, 'window.restoreFullscreen': true })); + configuration.updateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ 'workbench.editor.enablePreview': true, 'window.restoreWindows': true })); + const data = configuration.toData(); + const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('folder1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('folder2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); + const change = mergeChanges( + configuration.compareAndUpdateWorkspaceConfiguration(toConfigurationModel({ 'window.title': 'native' })), + configuration.compareAndUpdateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'window.zoomLevel': 1, 'window.restoreFullscreen': false })), + configuration.compareAndUpdateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ 'workbench.editor.enablePreview': false, 'window.restoreWindows': false })) + ); + let testObject = new ConfigurationChangeEvent(change, { data, workspace }, configuration, workspace); + + assert.deepEqual(testObject.affectedKeys, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); + + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('folder1') })); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file(join('folder3', 'file3')) })); + + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('folder1') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file(join('folder3', 'file3')) })); + + assert.ok(testObject.affectsConfiguration('window.restoreWindows')); + assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file(join('folder3', 'file3')) })); + + assert.ok(testObject.affectsConfiguration('window.title')); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('folder1') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('folder3') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file(join('folder3', 'file3')) })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file3') })); + + assert.ok(testObject.affectsConfiguration('window')); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('folder1') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('folder3') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file(join('folder3', 'file3')) })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file3') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('folder1') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('folder3') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('folder1') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('folder3') })); + + assert.ok(testObject.affectsConfiguration('workbench')); + assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('folder2') })); + assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('folder1') })); + assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('folder3') })); + + assert.ok(!testObject.affectsConfiguration('files')); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('folder1') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file(join('folder1', 'file1')) })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('folder2') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file(join('folder2', 'file2')) })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('folder3') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file(join('folder3', 'file3')) })); + }); + + test('changeEvent - all', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ 'window.zoomLevel': 2, 'window.restoreFullscreen': true })); + const data = configuration.toData(); + const change = mergeChanges( + configuration.compareAndUpdateDefaultConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'off', + '[markdown]': { + 'editor.wordWrap': 'off' + } + }), ['editor.lineNumbers', '[markdown]']), + configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + '[json]': { + 'editor.lineNumbers': 'relative' + } + })), + configuration.compareAndUpdateWorkspaceConfiguration(toConfigurationModel({ 'window.title': 'custom' })), + configuration.compareAndDeleteFolderConfiguration(URI.file('file1')), + configuration.compareAndUpdateFolderConfiguration(URI.file('file2'), toConfigurationModel({ 'workbench.editor.enablePreview': true, 'window.restoreWindows': true }))); + const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('file1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('file2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); + const testObject = new ConfigurationChangeEvent(change, { data, workspace }, configuration, workspace); + + assert.deepEqual(testObject.affectedKeys, ['editor.lineNumbers', '[markdown]', '[json]', 'window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows', 'editor.wordWrap']); + + assert.ok(testObject.affectsConfiguration('window.title')); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window')); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.restoreWindows')); + assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench')); + assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('file1') })); + + assert.ok(!testObject.affectsConfiguration('files')); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('editor')); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(testObject.affectsConfiguration('editor.lineNumbers')); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(testObject.affectsConfiguration('editor.wordWrap')); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(!testObject.affectsConfiguration('editor.fontSize')); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file2') })); + }); + + test('changeEvent affecting tasks and launches', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + const change = configuration.compareAndUpdateLocalUserConfiguration(toConfigurationModel({ + 'launch': { + 'configuraiton': {} + }, + 'launch.version': 1, + 'tasks': { + 'version': 2 + } + })); + let testObject = new ConfigurationChangeEvent(change, undefined, configuration); + + assert.deepEqual(testObject.affectedKeys, ['launch', 'launch.version', 'tasks']); + assert.ok(testObject.affectsConfiguration('launch')); + assert.ok(testObject.affectsConfiguration('launch.version')); + assert.ok(testObject.affectsConfiguration('tasks')); + }); + +}); + +suite('AllKeysConfigurationChangeEvent', () => { + + test('changeEvent', () => { + const configuration = new Configuration(new ConfigurationModel(), new ConfigurationModel()); + configuration.updateDefaultConfiguration(toConfigurationModel({ + 'editor.lineNumbers': 'off', + '[markdown]': { + 'editor.wordWrap': 'off' + } + })); + configuration.updateLocalUserConfiguration(toConfigurationModel({ + '[json]': { + 'editor.lineNumbers': 'relative' + } + })); + configuration.updateWorkspaceConfiguration(toConfigurationModel({ 'window.title': 'custom' })); + configuration.updateFolderConfiguration(URI.file('file1'), toConfigurationModel({ 'window.zoomLevel': 2, 'window.restoreFullscreen': true })); + configuration.updateFolderConfiguration(URI.file('file2'), toConfigurationModel({ 'workbench.editor.enablePreview': true, 'window.restoreWindows': true })); + const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('file1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('file2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); + let testObject = new AllKeysConfigurationChangeEvent(configuration, workspace, ConfigurationTarget.USER, null); + + assert.deepEqual(testObject.affectedKeys, ['editor.lineNumbers', '[markdown]', '[json]', 'window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); + + assert.ok(testObject.affectsConfiguration('window.title')); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window.title', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window')); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('window', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.zoomLevel')); + assert.ok(testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.zoomLevel', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); + assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('window.restoreWindows')); + assert.ok(testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('window.restoreWindows', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); + assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench.editor')); + assert.ok(testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench.editor', { resource: URI.file('file1') })); + + assert.ok(testObject.affectsConfiguration('workbench')); + assert.ok(testObject.affectsConfiguration('workbench', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('workbench', { resource: URI.file('file1') })); + + assert.ok(!testObject.affectsConfiguration('files')); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('files', { resource: URI.file('file2') })); + + assert.ok(testObject.affectsConfiguration('editor')); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(testObject.affectsConfiguration('editor.lineNumbers')); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1') })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2') })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(testObject.affectsConfiguration('editor.lineNumbers', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(!testObject.affectsConfiguration('editor.wordWrap')); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2') })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'json' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file1'), overrideIdentifier: 'typescript' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'json' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'markdown' })); + assert.ok(!testObject.affectsConfiguration('editor.wordWrap', { resource: URI.file('file2'), overrideIdentifier: 'typescript' })); + + assert.ok(!testObject.affectsConfiguration('editor.fontSize')); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file1') })); + assert.ok(!testObject.affectsConfiguration('editor.fontSize', { resource: URI.file('file2') })); + }); +}); function toConfigurationModel(obj: any): ConfigurationModel { const parser = new ConfigurationModelParser('test'); diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index e754474f4e3..ba79a5357fb 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -257,7 +257,7 @@ export class ExtHostConfigProvider { private _toConfigurationChangeEvent(change: IConfigurationChange, previous: { data: IConfigurationData, workspace: Workspace | undefined }): vscode.ConfigurationChangeEvent { const event = new ConfigurationChangeEvent(change, previous, this._configuration, this._extHostWorkspace.workspace); return Object.freeze({ - affectsConfiguration: (section: string, resource?: URI) => event.affectsConfiguration(section, { resource }) + affectsConfiguration: (section: string, resource?: URI) => event.affectsConfiguration(section, resource ? { resource } : undefined) }); } diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index cdebd413e5a..5159bd43fe8 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { equals } from 'vs/base/common/objects'; -import { compare, toValuesTree, IConfigurationModel, IConfigurationOverrides, IConfigurationValue, IConfigurationChange } from 'vs/platform/configuration/common/configuration'; +import { toValuesTree, IConfigurationModel, IConfigurationOverrides, IConfigurationValue, IConfigurationChange, overrideIdentifierFromKey } from 'vs/platform/configuration/common/configuration'; import { Configuration as BaseConfiguration, ConfigurationModelParser, ConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; import { IStoredWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces'; import { Workspace } from 'vs/platform/workspace/common/workspace'; @@ -115,62 +115,39 @@ export class Configuration extends BaseConfiguration { return super.keys(this._workspace); } - compareAndUpdateRemoteUserConfiguration(user: ConfigurationModel): IConfigurationChange { - const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user); - let keys = [...added, ...updated, ...removed]; - if (keys.length) { - super.updateRemoteUserConfiguration(user); - } - return { keys, overrides }; - } - - compareAndUpdateWorkspaceConfiguration(workspaceConfiguration: ConfigurationModel): IConfigurationChange { - const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration); - let keys = [...added, ...updated, ...removed]; - if (keys.length) { - super.updateWorkspaceConfiguration(workspaceConfiguration); - } - return { keys, overrides }; - } - - compareAndUpdateFolderConfiguration(resource: URI, folderConfiguration: ConfigurationModel): IConfigurationChange { - const currentFolderConfiguration = this.folderConfigurations.get(resource); - const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration); - let keys = [...added, ...updated, ...removed]; - if (keys.length) { - super.updateFolderConfiguration(resource, folderConfiguration); - } - return { keys, overrides }; - } - compareAndDeleteFolderConfiguration(folder: URI): IConfigurationChange { if (this._workspace && this._workspace.folders.length > 0 && this._workspace.folders[0].uri.toString() === folder.toString()) { // Do not remove workspace configuration return { keys: [], overrides: [] }; } - const folderConfig = this.folderConfigurations.get(folder); - if (!folderConfig) { - throw new Error('Unknown folder'); - } - super.deleteFolderConfiguration(folder); - const { added, updated, removed, overrides } = compare(folderConfig, undefined); - return { keys: [...added, ...updated, ...removed], overrides }; + return super.compareAndDeleteFolderConfiguration(folder); } compare(other: Configuration): IConfigurationChange { const compare = (fromKeys: string[], toKeys: string[], overrideIdentifier?: string): string[] => { - return [ - ...toKeys.filter(key => fromKeys.indexOf(key) === -1), - ...fromKeys.filter(key => toKeys.indexOf(key) === -1), - ...fromKeys.filter(key => !equals(this.getValue(key, { overrideIdentifier }), other.getValue(key, { overrideIdentifier })) - || (this._workspace && this._workspace.folders.some(folder => !equals(this.getValue(key, { resource: folder.uri, overrideIdentifier }), other.getValue(key, { resource: folder.uri, overrideIdentifier }))))) - ]; + const keys: string[] = []; + keys.push(...toKeys.filter(key => fromKeys.indexOf(key) === -1)); + keys.push(...fromKeys.filter(key => toKeys.indexOf(key) === -1)); + keys.push(...fromKeys.filter(key => { + // Ignore if the key does not exist in both models + if (toKeys.indexOf(key) === -1) { + return false; + } + // Compare workspace value + if (!equals(this.getValue(key, { overrideIdentifier }), other.getValue(key, { overrideIdentifier }))) { + return true; + } + // Compare workspace folder value + return this._workspace && this._workspace.folders.some(folder => !equals(this.getValue(key, { resource: folder.uri, overrideIdentifier }), other.getValue(key, { resource: folder.uri, overrideIdentifier }))); + })); + return keys; }; const keys = compare(this.allKeys(), other.allKeys()); const overrides: [string, string[]][] = []; for (const key of keys) { if (OVERRIDE_PROPERTY_PATTERN.test(key)) { - overrides.push([key, compare(this.getAllKeysForOverrideIdentifier(key), other.getAllKeysForOverrideIdentifier(key), key)]); + const overrideIdentifier = overrideIdentifierFromKey(key); + overrides.push([overrideIdentifier, compare(this.getAllKeysForOverrideIdentifier(overrideIdentifier), other.getAllKeysForOverrideIdentifier(overrideIdentifier), overrideIdentifier)]); } } return { keys, overrides }; diff --git a/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts b/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts index 950b215df35..83fcb92b685 100644 --- a/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts +++ b/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts @@ -3,15 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { join } from 'vs/base/common/path'; import { Registry } from 'vs/platform/registry/common/platform'; -import { WorkspaceConfigurationChangeEvent, StandaloneConfigurationModelParser, AllKeysConfigurationChangeEvent, Configuration } from 'vs/workbench/services/configuration/common/configurationModels'; -import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace'; -import { URI } from 'vs/base/common/uri'; -import { ConfigurationChangeEvent, ConfigurationModel, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels'; -import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; +import { StandaloneConfigurationModelParser, Configuration } from 'vs/workbench/services/configuration/common/configurationModels'; +import { ConfigurationModelParser, ConfigurationModel } from 'vs/platform/configuration/common/configurationModels'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { ResourceMap } from 'vs/base/common/map'; +import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace'; +import { URI } from 'vs/base/common/uri'; suite('FolderSettingsModelParser', () => { @@ -66,7 +64,7 @@ suite('FolderSettingsModelParser', () => { testObject.parseContent(JSON.stringify({ '[json]': { 'FolderSettingsModelParser.window': 'window', 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.application': 'application', 'FolderSettingsModelParser.machine': 'executable' } })); - assert.deepEqual(testObject.configurationModel.overrides, [{ 'contents': { 'FolderSettingsModelParser': { 'resource': 'resource' } }, 'identifiers': ['json'] }]); + assert.deepEqual(testObject.configurationModel.overrides, [{ 'contents': { 'FolderSettingsModelParser': { 'resource': 'resource' } }, 'identifiers': ['json'], 'keys': ['FolderSettingsModelParser.resource'] }]); }); test('reprocess folder settings excludes application and machine setting', () => { @@ -112,143 +110,72 @@ suite('StandaloneConfigurationModelParser', () => { }); -suite('WorkspaceConfigurationChangeEvent', () => { +suite('Workspace Configuration', () => { - test('changeEvent affecting workspace folders', () => { - let configurationChangeEvent = new ConfigurationChangeEvent(); - configurationChangeEvent.change(['window.title']); - configurationChangeEvent.change(['window.zoomLevel'], URI.file('folder1')); - configurationChangeEvent.change(['workbench.editor.enablePreview'], URI.file('folder2')); - configurationChangeEvent.change(['window.restoreFullscreen'], URI.file('folder1')); - configurationChangeEvent.change(['window.restoreWindows'], URI.file('folder2')); - configurationChangeEvent.telemetryData(ConfigurationTarget.WORKSPACE, {}); - - let testObject = new WorkspaceConfigurationChangeEvent(configurationChangeEvent, new Workspace('id', - [new WorkspaceFolder({ index: 0, name: '1', uri: URI.file('folder1') }), - new WorkspaceFolder({ index: 1, name: '2', uri: URI.file('folder2') }), - new WorkspaceFolder({ index: 2, name: '3', uri: URI.file('folder3') })])); - - assert.deepEqual(testObject.affectedKeys, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); - assert.equal(testObject.source, ConfigurationTarget.WORKSPACE); - - assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', URI.file('folder1'))); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', URI.file(join('folder1', 'file1')))); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', URI.file('file1'))); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('window.zoomLevel', URI.file(join('folder3', 'file3')))); - - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', URI.file(join('folder1', 'file1')))); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', URI.file('folder1'))); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file1'))); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('window.restoreFullscreen', URI.file(join('folder3', 'file3')))); - - assert.ok(testObject.affectsConfiguration('window.restoreWindows')); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', URI.file('file2'))); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', URI.file(join('folder1', 'file1')))); - assert.ok(!testObject.affectsConfiguration('window.restoreWindows', URI.file(join('folder3', 'file3')))); - - assert.ok(testObject.affectsConfiguration('window.title')); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('folder1'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file(join('folder1', 'file1')))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file(join('folder2', 'file2')))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('folder3'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file(join('folder3', 'file3')))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file3'))); - - assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('window', URI.file('folder1'))); - assert.ok(testObject.affectsConfiguration('window', URI.file(join('folder1', 'file1')))); - assert.ok(testObject.affectsConfiguration('window', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('window', URI.file(join('folder2', 'file2')))); - assert.ok(testObject.affectsConfiguration('window', URI.file('folder3'))); - assert.ok(testObject.affectsConfiguration('window', URI.file(join('folder3', 'file3')))); - assert.ok(testObject.affectsConfiguration('window', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('window', URI.file('file3'))); - - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('folder1'))); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file(join('folder1', 'file1')))); - assert.ok(!testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('folder3'))); - - assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench.editor', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('workbench.editor', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('workbench.editor', URI.file('folder1'))); - assert.ok(!testObject.affectsConfiguration('workbench.editor', URI.file(join('folder1', 'file1')))); - assert.ok(!testObject.affectsConfiguration('workbench.editor', URI.file('folder3'))); - - assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('workbench', URI.file('folder2'))); - assert.ok(testObject.affectsConfiguration('workbench', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('workbench', URI.file('folder1'))); - assert.ok(!testObject.affectsConfiguration('workbench', URI.file('folder3'))); - - assert.ok(!testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files', URI.file('folder1'))); - assert.ok(!testObject.affectsConfiguration('files', URI.file(join('folder1', 'file1')))); - assert.ok(!testObject.affectsConfiguration('files', URI.file('folder2'))); - assert.ok(!testObject.affectsConfiguration('files', URI.file(join('folder2', 'file2')))); - assert.ok(!testObject.affectsConfiguration('files', URI.file('folder3'))); - assert.ok(!testObject.affectsConfiguration('files', URI.file(join('folder3', 'file3')))); + const defaultConfigurationModel = toConfigurationModel({ + 'editor.lineNumbers': 'on', + 'editor.fontSize': 12, + 'window.zoomLevel': 1, + '[markdown]': { + 'editor.wordWrap': 'off' + }, + 'window.title': 'custom', + 'workbench.enableTabs': false, + 'editor.insertSpaces': true }); + test('Test compare same configurations', () => { + const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('folder1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('folder2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); + const configuration1 = new Configuration(new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), workspace); + configuration1.updateDefaultConfiguration(defaultConfigurationModel); + configuration1.updateLocalUserConfiguration(toConfigurationModel({ 'window.title': 'native', '[typescript]': { 'editor.insertSpaces': false } })); + configuration1.updateWorkspaceConfiguration(toConfigurationModel({ 'editor.lineNumbers': 'on' })); + configuration1.updateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'editor.fontSize': 14 })); + configuration1.updateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ 'editor.wordWrap': 'on' })); + + const configuration2 = new Configuration(new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), workspace); + configuration2.updateDefaultConfiguration(defaultConfigurationModel); + configuration2.updateLocalUserConfiguration(toConfigurationModel({ 'window.title': 'native', '[typescript]': { 'editor.insertSpaces': false } })); + configuration2.updateWorkspaceConfiguration(toConfigurationModel({ 'editor.lineNumbers': 'on' })); + configuration2.updateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'editor.fontSize': 14 })); + configuration2.updateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ 'editor.wordWrap': 'on' })); + + const actual = configuration2.compare(configuration1); + + assert.deepEqual(actual, { keys: [], overrides: [] }); + }); + + test('Test compare different configurations', () => { + const workspace = new Workspace('a', [new WorkspaceFolder({ index: 0, name: 'a', uri: URI.file('folder1') }), new WorkspaceFolder({ index: 1, name: 'b', uri: URI.file('folder2') }), new WorkspaceFolder({ index: 2, name: 'c', uri: URI.file('folder3') })]); + const configuration1 = new Configuration(new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), workspace); + configuration1.updateDefaultConfiguration(defaultConfigurationModel); + configuration1.updateLocalUserConfiguration(toConfigurationModel({ 'window.title': 'native', '[typescript]': { 'editor.insertSpaces': false } })); + configuration1.updateWorkspaceConfiguration(toConfigurationModel({ 'editor.lineNumbers': 'on' })); + configuration1.updateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'editor.fontSize': 14 })); + configuration1.updateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ 'editor.wordWrap': 'on' })); + + const configuration2 = new Configuration(new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), workspace); + configuration2.updateDefaultConfiguration(defaultConfigurationModel); + configuration2.updateLocalUserConfiguration(toConfigurationModel({ 'workbench.enableTabs': true, '[typescript]': { 'editor.insertSpaces': true } })); + configuration2.updateWorkspaceConfiguration(toConfigurationModel({ 'editor.fontSize': 11 })); + configuration2.updateFolderConfiguration(URI.file('folder1'), toConfigurationModel({ 'editor.insertSpaces': true })); + configuration2.updateFolderConfiguration(URI.file('folder2'), toConfigurationModel({ + '[markdown]': { + 'editor.wordWrap': 'on', + 'editor.lineNumbers': 'relative' + }, + })); + + const actual = configuration2.compare(configuration1); + + assert.deepEqual(actual, { keys: ['editor.wordWrap', 'editor.fontSize', '[markdown]', 'window.title', 'workbench.enableTabs', '[typescript]'], overrides: [['markdown', ['editor.lineNumbers', 'editor.wordWrap']], ['typescript', ['editor.insertSpaces']]] }); + }); + + }); -suite('AllKeysConfigurationChangeEvent', () => { - - test('changeEvent affects keys for any resource', () => { - const configuraiton = new Configuration(new ConfigurationModel({}, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']), - new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), null!); - let testObject = new AllKeysConfigurationChangeEvent(configuraiton, ConfigurationTarget.USER, null); - - assert.deepEqual(testObject.affectedKeys, ['window.title', 'window.zoomLevel', 'window.restoreFullscreen', 'workbench.editor.enablePreview', 'window.restoreWindows']); - - assert.ok(testObject.affectsConfiguration('window.zoomLevel')); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window.zoomLevel', URI.file('file2'))); - - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen')); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window.restoreFullscreen', URI.file('file2'))); - - assert.ok(testObject.affectsConfiguration('window.restoreWindows')); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('window.restoreWindows', URI.file('file1'))); - - assert.ok(testObject.affectsConfiguration('window.title')); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window.title', URI.file('file2'))); - - assert.ok(testObject.affectsConfiguration('window')); - assert.ok(testObject.affectsConfiguration('window', URI.file('file1'))); - assert.ok(testObject.affectsConfiguration('window', URI.file('file2'))); - - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview')); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('workbench.editor.enablePreview', URI.file('file1'))); - - assert.ok(testObject.affectsConfiguration('workbench.editor')); - assert.ok(testObject.affectsConfiguration('workbench.editor', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('workbench.editor', URI.file('file1'))); - - assert.ok(testObject.affectsConfiguration('workbench')); - assert.ok(testObject.affectsConfiguration('workbench', URI.file('file2'))); - assert.ok(testObject.affectsConfiguration('workbench', URI.file('file1'))); - - assert.ok(!testObject.affectsConfiguration('files')); - assert.ok(!testObject.affectsConfiguration('files', URI.file('file1'))); - }); -}); +function toConfigurationModel(obj: any): ConfigurationModel { + const parser = new ConfigurationModelParser('test'); + parser.parseContent(JSON.stringify(obj)); + return parser.configurationModel; +} diff --git a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts index 471099c29b3..a56f1d41f4c 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts @@ -608,7 +608,7 @@ suite('ExtHostConfiguration', function () { createConfigurationData({ 'farboo': { 'config': false, - 'updatedconfig': false + 'updatedConfig': false } }), new NullLogService() @@ -617,16 +617,16 @@ suite('ExtHostConfiguration', function () { const newConfigData = createConfigurationData({ 'farboo': { 'config': false, - 'updatedconfig': true, + 'updatedConfig': true, 'newConfig': true, } }); - const configEventData: IConfigurationChange = { keys: ['farboo.updatedConfig'], overrides: [] }; + const configEventData: IConfigurationChange = { keys: ['farboo.updatedConfig', 'farboo.newConfig'], overrides: [] }; testObject.onDidChangeConfiguration(e => { assert.deepEqual(testObject.getConfiguration().get('farboo'), { 'config': false, - 'updatedconfig': true, + 'updatedConfig': true, 'newConfig': true, }); @@ -640,7 +640,7 @@ suite('ExtHostConfiguration', function () { assert.ok(e.affectsConfiguration('farboo.newConfig')); assert.ok(e.affectsConfiguration('farboo.newConfig', workspaceFolder.uri)); - assert.ok(!e.affectsConfiguration('farboo.newConfig', URI.file('any'))); + assert.ok(e.affectsConfiguration('farboo.newConfig', URI.file('any'))); assert.ok(!e.affectsConfiguration('farboo.config')); assert.ok(!e.affectsConfiguration('farboo.config', workspaceFolder.uri)); From dfd849b91599305f9034bc95d90866abda43acd0 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 12 Dec 2019 21:58:55 +0100 Subject: [PATCH 391/637] Remove unused types from monaco.d.ts --- build/monaco/monaco.d.ts.recipe | 1 - src/vs/editor/common/config/editorOptions.ts | 39 +++++ .../common/standalone/standaloneEnums.ts | 99 ------------ .../standalone/browser/standaloneEditor.ts | 5 - src/vs/monaco.d.ts | 142 ------------------ 5 files changed, 39 insertions(+), 247 deletions(-) diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe index 0c49fac1c36..4fb5afe7804 100644 --- a/build/monaco/monaco.d.ts.recipe +++ b/build/monaco/monaco.d.ts.recipe @@ -62,7 +62,6 @@ export interface ICommandHandler { #includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent #includeAll(vs/editor/common/model/textModelEvents): #includeAll(vs/editor/common/controller/cursorEvents): -#include(vs/platform/accessibility/common/accessibility): AccessibilitySupport #includeAll(vs/editor/common/config/editorOptions): #includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>): #include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 035b36c09b1..f00fee34962 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -990,6 +990,7 @@ class EditorAccessibilitySupport extends BaseEditorOption>; class EditorFind extends BaseEditorOption { @@ -1346,6 +1351,9 @@ export interface IGotoLocationOptions { alternativeReferenceCommand?: string; } +/** + * @internal + */ export type GoToLocationOptions = Readonly>; class EditorGoToLocation extends BaseEditorOption { @@ -1475,6 +1483,9 @@ export interface IEditorHoverOptions { sticky?: boolean; } +/** + * @internal + */ export type EditorHoverOptions = Readonly>; class EditorHover extends BaseEditorOption { @@ -1851,6 +1862,9 @@ export interface IEditorLightbulbOptions { enabled?: boolean; } +/** + * @internal + */ export type EditorLightbulbOptions = Readonly>; class EditorLightbulb extends BaseEditorOption { @@ -1942,6 +1956,9 @@ export interface IEditorMinimapOptions { scale?: number; } +/** + * @internal + */ export type EditorMinimapOptions = Readonly>; class EditorMinimap extends BaseEditorOption { @@ -2043,6 +2060,9 @@ export interface IEditorParameterHintOptions { cycle?: boolean; } +/** + * @internal + */ export type InternalParameterHintOptions = Readonly>; class EditorParameterHints extends BaseEditorOption { @@ -2109,6 +2129,9 @@ export interface IQuickSuggestionsOptions { strings: boolean; } +/** + * @internal + */ export type ValidQuickSuggestionsOptions = boolean | Readonly>; class EditorQuickSuggestions extends BaseEditorOption { @@ -2185,6 +2208,9 @@ class EditorQuickSuggestions extends BaseEditorOption string); +/** + * @internal + */ export const enum RenderLineNumbersType { Off = 0, On = 1, @@ -2193,6 +2219,9 @@ export const enum RenderLineNumbersType { Custom = 4 } +/** + * @internal + */ export interface InternalEditorRenderLineNumbersOptions { readonly renderType: RenderLineNumbersType; readonly renderFn: ((lineNumber: number) => string) | null; @@ -2348,6 +2377,9 @@ export interface IEditorScrollbarOptions { horizontalSliderSize?: number; } +/** + * @internal + */ export interface InternalEditorScrollbarOptions { readonly arrowSize: number; readonly vertical: ScrollbarVisibility; @@ -2562,6 +2594,9 @@ export interface ISuggestOptions { showSnippets?: boolean; } +/** + * @internal + */ export type InternalSuggestOptions = Readonly>; class EditorSuggest extends BaseEditorOption { @@ -2855,6 +2890,7 @@ class EditorTabFocusMode extends ComputedEditorOption