From e97a41e850c0b03564e237a713c5e08b1822f762 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 7 Nov 2019 18:27:47 +0800 Subject: [PATCH 01/16] 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 02/16] 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 03/16] 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 04/16] 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 05/16] 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 06/16] 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 22cbe0c912b2d641ec4aec8e3ae7457f97b3c6c0 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 27 Nov 2019 09:57:21 -0800 Subject: [PATCH 07/16] 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 08/16] 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 09/16] 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 8d3a5b6e98c0831d59d10fb5154b9dbb05d7d9f4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 2 Dec 2019 06:17:21 -0800 Subject: [PATCH 10/16] 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 888c06f60542c829d567e43721a8174c5351a03f Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 2 Dec 2019 18:38:10 +0100 Subject: [PATCH 11/16] 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 12/16] 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 13/16] 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 14/16] 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 15/16] 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 16/16] 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 === '>' + ); +}