From a62e6ebf99365f5adb72a696a16af983e8099001 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Dec 2022 03:47:14 +0800 Subject: [PATCH 01/10] chore(deps): bump decode-uri-component in /extensions/github1s (#466) Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2. - [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases) - [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2) --- updated-dependencies: - dependency-name: decode-uri-component dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- extensions/github1s/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/github1s/yarn.lock b/extensions/github1s/yarn.lock index 1358e5268..d871806df 100644 --- a/extensions/github1s/yarn.lock +++ b/extensions/github1s/yarn.lock @@ -681,9 +681,9 @@ dayjs@^1.11.1: integrity sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw== decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== define-properties@^1.1.3, define-properties@^1.1.4: version "1.1.4" From ae01dfd2833734c9424bc7e1172a4db1983d755a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Dec 2022 03:47:49 +0800 Subject: [PATCH 02/10] chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 in /tests (#467) Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2. - [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases) - [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2) --- updated-dependencies: - dependency-name: decode-uri-component dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tests/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/yarn.lock b/tests/yarn.lock index 3c48cf8db..e34d867e2 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -1297,9 +1297,9 @@ decimal.js@^10.2.1: integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og== + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== deep-is@~0.1.3: version "0.1.4" From 6f43c175a9073efcf7fc60044840382999369eea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Dec 2022 04:07:36 +0800 Subject: [PATCH 03/10] chore(deps): bump minimatch from 3.0.4 to 3.1.2 in /vscode-web (#468) Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2. - [Release notes](https://github.com/isaacs/minimatch/releases) - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- vscode-web/yarn.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vscode-web/yarn.lock b/vscode-web/yarn.lock index 6bd0e5012..274e86720 100644 --- a/vscode-web/yarn.lock +++ b/vscode-web/yarn.lock @@ -25,9 +25,9 @@ ansi-styles@^3.2.1: color-convert "^1.9.0" balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== brace-expansion@^1.1.7: version "1.1.11" @@ -69,7 +69,7 @@ color-name@1.1.3: concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== cross-spawn@^6.0.5: version "6.0.5" @@ -273,9 +273,9 @@ memorystream@^0.3.1: integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI= minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" From a91c7f3fdcf7ee66afe9f6596da5c53c3d1180b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:02:31 +0800 Subject: [PATCH 04/10] chore(deps): bump json5 from 2.2.1 to 2.2.3 in /tests (#469) Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tests/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/yarn.lock b/tests/yarn.lock index e34d867e2..cc604053b 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -2725,9 +2725,9 @@ json-parse-even-better-errors@^2.3.0: integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== json5@2.x, json5@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" - integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" From 199f61aaae589bbb871f038b9c276e073ff75a56 Mon Sep 17 00:00:00 2001 From: Victor Nogueira Date: Wed, 11 Jan 2023 20:07:00 +0200 Subject: [PATCH 05/10] Update the "Stargazers over time" section, to get the chart displayed again (#471) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e746f4f6c..0de43653b 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ We are partnered with [OSS Insight](https://ossinsight.io/?utm_source=github1s&u ## Stargazers over time -[![Stargazers over time](https://starchart.cc/conwnet/github1s.svg)](https://starchart.cc/conwnet/github1s) +[![Stargazers over time](https://api.star-history.com/svg?repos=conwnet/github1s&type=Date)](https://star-history.com/#conwnet/github1s&Date)
Third-party Related Projects From 369998a9090ebf5c62323d7ab16f1f95637d1b37 Mon Sep 17 00:00:00 2001 From: wolfsilver Date: Tue, 17 Jan 2023 13:53:26 +0800 Subject: [PATCH 06/10] fix: home logo with light theme (#464) * fix: home logo with light theme * feat: modify size of svgs * feat: modify svgs * feat: use mask instead background Co-authored-by: netcon --- .../browser/parts/activitybar/activitybarPart.ts | 4 +++- .../browser/parts/titlebar/media/titlebarpart.css | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index d620f613f..0907d1489 100644 --- a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -574,7 +574,9 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart if (logo?.icon) { const iconElement = this.homeBarContainer.querySelector('.home-bar-custom-icon') as HTMLElement; if (iconElement?.style) { - iconElement.style.backgroundImage = `url(${logo.icon})`; + const logoImage = `url(${window.encodeURI(logo?.icon)})` + iconElement.style.maskImage = logoImage; + iconElement.style.webkitMaskImage = logoImage; } } } diff --git a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index a491cbd1f..10da857a2 100644 --- a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -317,9 +317,13 @@ .monaco-workbench .activitybar > .content > .home-bar .home-bar-custom-icon { opacity: 1 !important; - background-size: 50% 50%; - background-position: 50% 50%; - background-repeat: no-repeat; + mask-repeat: no-repeat; + -webkit-mask-repeat: no-repeat; + mask-size: 50% 50%; + -webkit-mask-size: 50% 50%; + mask-position: 50% 50%; + -webkit-mask-position: 50% 50%; + background-color: var(--vscode-activityBar-foreground); } /* above codes are changed by github1s */ From 7cb44f1738ad1359bdbf96d97ab5c832057810bb Mon Sep 17 00:00:00 2001 From: netcon Date: Tue, 17 Jan 2023 21:20:19 +0800 Subject: [PATCH 07/10] chore: bump vscode to 1.74.3 (#472) --- package.json | 2 +- vscode-web/.VERSION | 2 +- vscode-web/package.json | 14 +- .../vs/editor/common/config/editorOptions.ts | 310 ++++++++++++---- .../parts/activitybar/activitybarActions.ts | 82 +++-- .../parts/activitybar/activitybarPart.ts | 57 +-- .../parts/titlebar/media/titlebarpart.css | 52 +-- .../src/vs/workbench/browser/web.main.ts | 72 +++- .../contrib/webview/browser/pre/index.html | 344 ++++++++++-------- .../builtinExtensionsScannerService.ts | 12 +- .../services/label/common/labelService.ts | 5 +- vscode-web/yarn.lock | 56 +-- yarn.lock | 76 ++-- 13 files changed, 666 insertions(+), 418 deletions(-) diff --git a/package.json b/package.json index 41d622a88..d333ea494 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lib": "lib" }, "devDependencies": { - "@github1s/vscode-web": "0.6.0", + "@github1s/vscode-web": "0.7.0", "@typescript-eslint/eslint-plugin": "^5.40.1", "@typescript-eslint/parser": "^5.40.1", "chokidar": "^3.5.3", diff --git a/vscode-web/.VERSION b/vscode-web/.VERSION index 698c6ba78..e75cd4ada 100644 --- a/vscode-web/.VERSION +++ b/vscode-web/.VERSION @@ -1 +1 @@ -1.72.1 \ No newline at end of file +1.74.3 \ No newline at end of file diff --git a/vscode-web/package.json b/vscode-web/package.json index 83515ee8d..c11dfc240 100644 --- a/vscode-web/package.json +++ b/vscode-web/package.json @@ -1,6 +1,6 @@ { "name": "@github1s/vscode-web", - "version": "0.5.0", + "version": "0.7.0", "description": "VS Code web for GitHub1s", "author": "github1s", "license": "MIT", @@ -32,13 +32,13 @@ "@vscode/vscode-languagedetection": "1.0.21", "jschardet": "3.0.0", "tas-client-umd": "0.1.6", - "vscode-oniguruma": "1.6.1", + "vscode-oniguruma": "1.7.0", "vscode-textmate": "7.0.1", - "xterm": "5.1.0-beta.15", - "xterm-addon-canvas": "0.3.0-beta.1", - "xterm-addon-search": "0.11.0-beta.1", - "xterm-addon-unicode11": "0.5.0-beta.1", - "xterm-addon-webgl": "0.14.0-beta.8" + "xterm": "5.1.0-beta.63", + "xterm-addon-canvas": "0.3.0-beta.27", + "xterm-addon-search": "0.11.0-beta.7", + "xterm-addon-unicode11": "0.5.0-beta.5", + "xterm-addon-webgl": "0.14.0-beta.40" }, "devDependencies": { "@types/trusted-types": "^2.0.0", diff --git a/vscode-web/src/vs/editor/common/config/editorOptions.ts b/vscode-web/src/vs/editor/common/config/editorOptions.ts index 6d9711c08..58edcd57c 100644 --- a/vscode-web/src/vs/editor/common/config/editorOptions.ts +++ b/vscode-web/src/vs/editor/common/config/editorOptions.ts @@ -15,6 +15,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; import * as arrays from 'vs/base/common/arrays'; import * as objects from 'vs/base/common/objects'; import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/core/textModelDefaults'; +import { IDocumentDiffProvider } from 'vs/editor/common/diff/documentDiffProvider'; //#region typed options @@ -230,6 +231,11 @@ export interface IEditorOptions { * Defaults to false. */ fontLigatures?: boolean | string; + /** + * Enable font variations. + * Defaults to false. + */ + fontVariations?: boolean | string; /** * Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers. * The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer. @@ -262,8 +268,7 @@ export interface IEditorOptions { */ smoothScrolling?: boolean; /** - * Enable that the editor will install an interval to check if its container dom node size has changed. - * Enabling this might have a severe performance impact. + * Enable that the editor will install a ResizeObserver to check if its container dom node size has changed. * Defaults to false. */ automaticLayout?: boolean; @@ -311,6 +316,12 @@ export interface IEditorOptions { * Configure word wrapping characters. A break will be introduced after these characters. */ wordWrapBreakAfterCharacters?: string; + /** + * Sets whether line breaks appear wherever the text would otherwise overflow its content box. + * When wordBreak = 'normal', Use the default line break rule. + * When wordBreak = 'keepAll', Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal. + */ + wordBreak?: 'normal' | 'keepAll'; /** * Performance guard: Stop rendering a line after x characters. * Defaults to 10000. @@ -374,6 +385,10 @@ export interface IEditorOptions { * Defaults to 'spread'. */ multiCursorPaste?: 'spread' | 'full'; + /** + * Controls the max number of text cursors that can be in an active editor at once. + */ + multiCursorLimit?: number; /** * Configure the editor's accessibility support. * Defaults to 'auto'. It is best to leave this to 'auto'. @@ -740,7 +755,7 @@ export interface IDiffEditorBaseOptions { /** * Diff Algorithm */ - diffAlgorithm?: 'smart' | 'experimental'; + diffAlgorithm?: 'smart' | 'experimental' | IDocumentDiffProvider; } /** @@ -1183,7 +1198,8 @@ class EditorAccessibilitySupport extends BaseEditorOption { + // Text is laid out using default settings. + public static OFF = 'normal'; + + // Translate `fontWeight` config to the `font-variation-settings` CSS property. + public static TRANSLATE = 'translate'; + + constructor() { + super( + EditorOption.fontVariations, 'fontVariations', EditorFontVariations.OFF, + { + anyOf: [ + { + type: 'boolean', + description: nls.localize('fontVariations', "Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property."), + }, + { + type: 'string', + description: nls.localize('fontVariationSettings', "Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.") + } + ], + description: nls.localize('fontVariationsGeneral', "Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."), + default: false + } + ); + } + + public validate(input: any): string { + if (typeof input === 'undefined') { + return this.defaultValue; + } + if (typeof input === 'string') { + if (input === 'false') { + return EditorFontVariations.OFF; + } + if (input === 'true') { + return EditorFontVariations.TRANSLATE; + } + return input; + } + if (Boolean(input)) { + return EditorFontVariations.TRANSLATE; + } + return EditorFontVariations.OFF; + } + + public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: string): string { + // The value is computed from the fontWeight if it is true. + // So take the result from env.fontInfo + return env.fontInfo.fontVariationSettings; + } +} + +//#endregion + //#region fontInfo class EditorFontInfo extends ComputedEditorOption { @@ -1740,9 +1816,9 @@ class EditorGoToLocation extends BaseEditorOption { + + constructor() { + super(EditorOption.wrappingStrategy, 'wrappingStrategy', 'simple', + { + 'editor.wrappingStrategy': { + enumDescriptions: [ + nls.localize('wrappingStrategy.simple', "Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."), + nls.localize('wrappingStrategy.advanced', "Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.") + ], + type: 'string', + enum: ['simple', 'advanced'], + default: 'simple', + description: nls.localize('wrappingStrategy', "Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.") + } + } + ); + } + + public validate(input: any): 'simple' | 'advanced' { + return stringSet<'simple' | 'advanced'>(input, 'simple', ['simple', 'advanced']); + } + + public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: 'simple' | 'advanced'): 'simple' | 'advanced' { + const accessibilitySupport = options.get(EditorOption.accessibilitySupport); + if (accessibilitySupport === AccessibilitySupport.Enabled) { + // if we know for a fact that a screen reader is attached, we switch our strategy to advanced to + // help that the editor's wrapping points match the textarea's wrapping points + return 'advanced'; + } + return value; + } +} +//#endregion + //#region lightbulb /** @@ -2497,7 +2595,7 @@ class EditorLightbulb extends BaseEditorOption { + + constructor() { + super(EditorOption.lineDecorationsWidth, 'lineDecorationsWidth', 10); + } + + public validate(input: any): number { + if (typeof input === 'string' && /^\d+(\.\d+)?ch$/.test(input)) { + const multiple = parseFloat(input.substring(0, input.length - 2)); + return -multiple; // negative numbers signal a multiple + } else { + return EditorIntOption.clampedInt(input, this.defaultValue, 0, 1000); + } + } + + public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: number): number { + if (value < 0) { + // negative numbers signal a multiple + return EditorIntOption.clampedInt(-value * env.fontInfo.typicalHalfwidthCharacterWidth, this.defaultValue, 0, 1000); + } else { + return value; + } + } +} + +//#endregion + //#region lineHeight class EditorLineHeight extends EditorFloatOption { @@ -3530,14 +3657,14 @@ class UnicodeHighlight extends BaseEditorOption { + + constructor() { + super(EditorOption.wrappingIndent, 'wrappingIndent', WrappingIndent.Same, + { + 'editor.wrappingIndent': { + type: 'string', + enum: ['none', 'same', 'indent', 'deepIndent'], + enumDescriptions: [ + nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."), + nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."), + nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."), + nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."), + ], + description: nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."), + default: 'same' + } + } + ); + } + + public validate(input: any): WrappingIndent { + switch (input) { + case 'none': return WrappingIndent.None; + case 'same': return WrappingIndent.Same; + case 'indent': return WrappingIndent.Indent; + case 'deepIndent': return WrappingIndent.DeepIndent; + } + return WrappingIndent.Same; + } + + public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: WrappingIndent): WrappingIndent { + const accessibilitySupport = options.get(EditorOption.accessibilitySupport); + if (accessibilitySupport === AccessibilitySupport.Enabled) { + // if we know for a fact that a screen reader is attached, we use no indent wrapping to + // help that the editor's wrapping points match the textarea's wrapping points + return WrappingIndent.None; + } + return value; } } @@ -4592,6 +4758,7 @@ export const enum EditorOption { fontLigatures, fontSize, fontWeight, + fontVariations, formatOnPaste, formatOnType, glyphMargin, @@ -4616,6 +4783,7 @@ export const enum EditorOption { multiCursorMergeOverlapping, multiCursorModifier, multiCursorPaste, + multiCursorLimit, occurrencesHighlight, overviewRulerBorder, overviewRulerLanes, @@ -4662,6 +4830,7 @@ export const enum EditorOption { unusualLineTerminators, useShadowDOM, useTabStops, + wordBreak, wordSeparators, wordWrap, wordWrapBreakAfterCharacters, @@ -4702,7 +4871,8 @@ export const EditorOptions = { accessibilitySupport: register(new EditorAccessibilitySupport()), accessibilityPageSize: register(new EditorIntOption(EditorOption.accessibilityPageSize, 'accessibilityPageSize', 10, 1, Constants.MAX_SAFE_SMALL_INTEGER, { - description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default.") + description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."), + tags: ['accessibility'] })), ariaLabel: register(new EditorStringOption( EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content") @@ -4813,7 +4983,7 @@ export const EditorOptions = { default: 0, minimum: 0, maximum: 100, - markdownDescription: nls.localize('codeLensFontSize', "Controls the font size in pixels for CodeLens. When set to `0`, 90% of `#editor.fontSize#` is used.") + markdownDescription: nls.localize('codeLensFontSize', "Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.") })), colorDecorators: register(new EditorBooleanOption( EditorOption.colorDecorators, 'colorDecorators', true, @@ -4942,6 +5112,7 @@ export const EditorOptions = { fontLigatures2: register(new EditorFontLigatures()), fontSize: register(new EditorFontSize()), fontWeight: register(new EditorFontWeight()), + fontVariations: register(new EditorFontVariations()), formatOnPaste: register(new EditorBooleanOption( EditorOption.formatOnPaste, 'formatOnPaste', false, { description: nls.localize('formatOnPaste', "Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.") } @@ -4969,7 +5140,7 @@ export const EditorOptions = { { description: nls.localize('letterSpacing', "Controls the letter spacing in pixels.") } )), lightbulb: register(new EditorLightbulb()), - lineDecorationsWidth: register(new SimpleEditorOption(EditorOption.lineDecorationsWidth, 'lineDecorationsWidth', 10 as number | string)), + lineDecorationsWidth: register(new EditorLineDecorationsWidth()), lineHeight: register(new EditorLineHeight()), lineNumbers: register(new EditorRenderLineNumbersOption()), lineNumbersMinChars: register(new EditorIntOption( @@ -4978,7 +5149,7 @@ export const EditorOptions = { )), linkedEditing: register(new EditorBooleanOption( EditorOption.linkedEditing, 'linkedEditing', false, - { description: nls.localize('linkedEditing', "Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.") } + { description: nls.localize('linkedEditing', "Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.") } )), links: register(new EditorBooleanOption( EditorOption.links, 'links', true, @@ -5040,6 +5211,12 @@ export const EditorOptions = { markdownDescription: nls.localize('multiCursorPaste', "Controls pasting when the line count of the pasted text matches the cursor count.") } )), + multiCursorLimit: register(new EditorIntOption( + EditorOption.multiCursorLimit, 'multiCursorLimit', 10000, 1, 100000, + { + markdownDescription: nls.localize('multiCursorLimit', "Controls the max number of cursors that can be in an active editor at once.") + } + )), occurrencesHighlight: register(new EditorBooleanOption( EditorOption.occurrencesHighlight, 'occurrencesHighlight', true, { description: nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.") } @@ -5278,6 +5455,18 @@ export const EditorOptions = { EditorOption.useTabStops, 'useTabStops', true, { description: nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops.") } )), + wordBreak: register(new EditorStringEnumOption( + EditorOption.wordBreak, 'wordBreak', + 'normal' as 'normal' | 'keepAll', + ['normal', 'keepAll'] as const, + { + markdownEnumDescriptions: [ + nls.localize('wordBreak.normal', "Use the default line break rule."), + nls.localize('wordBreak.keepAll', "Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal."), + ], + description: nls.localize('wordBreak', "Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.") + } + )), wordSeparators: register(new EditorStringOption( EditorOption.wordSeparators, 'wordSeparators', USUAL_WORD_SEPARATORS, { description: nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.") } @@ -5346,40 +5535,15 @@ export const EditorOptions = { 'inherit' as 'off' | 'on' | 'inherit', ['off', 'on', 'inherit'] as const )), - wrappingIndent: register(new EditorEnumOption( - EditorOption.wrappingIndent, 'wrappingIndent', - WrappingIndent.Same, 'same', - ['none', 'same', 'indent', 'deepIndent'], - _wrappingIndentFromString, - { - enumDescriptions: [ - nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."), - nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."), - nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."), - nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."), - ], - description: nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."), - } - )), - wrappingStrategy: register(new EditorStringEnumOption( - EditorOption.wrappingStrategy, 'wrappingStrategy', - 'simple' as 'simple' | 'advanced', - ['simple', 'advanced'] as const, - { - enumDescriptions: [ - nls.localize('wrappingStrategy.simple', "Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."), - nls.localize('wrappingStrategy.advanced', "Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.") - ], - description: nls.localize('wrappingStrategy', "Controls the algorithm that computes wrapping points.") - } - )), // Leave these at the end (because they have dependencies!) editorClassName: register(new EditorClassName()), pixelRatio: register(new EditorPixelRatio()), tabFocusMode: register(new EditorTabFocusMode()), layoutInfo: register(new EditorLayoutInfoComputer()), - wrappingInfo: register(new EditorWrappingInfoComputer()) + wrappingInfo: register(new EditorWrappingInfoComputer()), + wrappingIndent: register(new WrappingIndentOption()), + wrappingStrategy: register(new WrappingStrategy()) }; type EditorOptionsType = typeof EditorOptions; diff --git a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts index 3ec6e4970..784cbfaba 100644 --- a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts +++ b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarActions.ts @@ -5,7 +5,7 @@ import 'vs/css!./media/activityaction'; import { localize } from 'vs/nls'; -import { EventType, addDisposableListener, EventHelper, getDomNodePagePosition } from 'vs/base/browser/dom'; +import { EventType, addDisposableListener, EventHelper } from 'vs/base/browser/dom'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { EventType as TouchEventType, GestureEvent } from 'vs/base/browser/touch'; import { Action, IAction, Separator, SubmenuAction, toAction } from 'vs/base/common/actions'; @@ -16,10 +16,10 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { activeContrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry'; import { IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { ActivityAction, ActivityActionViewItem, IActivityActionViewItemOptions, IActivityHoverOptions, ICompositeBar, ICompositeBarColors, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions'; -import { CATEGORIES } from 'vs/workbench/common/actions'; +import { ActivityAction, ActivityActionViewItem, IActivityActionViewItemOptions, IActivityHoverOptions, ICompositeBar, ICompositeBarColors, ToggleCompositeBadgeAction, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions'; +import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { IActivity } from 'vs/workbench/common/activity'; -import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_SETTINGS_PROFILE_BACKGROUND, ACTIVITY_BAR_SETTINGS_PROFILE_HOVER_FOREGROUND } from 'vs/workbench/common/theme'; +import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_PROFILE_BACKGROUND, ACTIVITY_BAR_PROFILE_HOVER_FOREGROUND } from 'vs/workbench/common/theme'; import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; @@ -38,6 +38,7 @@ import { ViewContainerLocation } from 'vs/workbench/common/views'; import { IPaneCompositePart } from 'vs/workbench/browser/parts/paneCompositePart'; import { ICredentialsService } from 'vs/platform/credentials/common/credentials'; import { IUserDataProfileService, ManageProfilesSubMenu, PROFILES_CATEGORY } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; +import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; export class ViewContainerActivityAction extends ActivityAction { @@ -125,39 +126,39 @@ abstract class AbstractGlobalActivityActionViewItem extends ActivityActionViewIt @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, @IKeybindingService keybindingService: IKeybindingService, ) { - super(action, options, themeService, hoverService, configurationService, keybindingService); + super(action, options, () => true, themeService, hoverService, configurationService, keybindingService); } override render(container: HTMLElement): void { super.render(container); - // Context menus are triggered on mouse down so that an item can be picked - // and executed with releasing the mouse over it - this._register(addDisposableListener(this.container, EventType.MOUSE_DOWN, async (e: MouseEvent) => { EventHelper.stop(e, true); const isLeftClick = e?.button !== 2; // Left-click run if (isLeftClick) { this.run(); - } else { - const disposables = new DisposableStore(); - const actions = await this.resolveContextMenuActions(disposables); - - const elementPosition = getDomNodePagePosition(this.container); - const anchor = { - x: Math.floor(elementPosition.left + (elementPosition.width / 2)), - y: elementPosition.top + elementPosition.height - }; - - this.contextMenuService.showContextMenu({ - getAnchor: () => anchor, - getActions: () => actions, - onHide: () => disposables.dispose() - }); } })); + // The rest of the activity bar uses context menu event for the context menu, so we match this + this._register(addDisposableListener(this.container, EventType.CONTEXT_MENU, async (e: MouseEvent) => { + const disposables = new DisposableStore(); + const actions = await this.resolveContextMenuActions(disposables); + + const event = new StandardMouseEvent(e); + const anchor = { + x: event.posx, + y: event.posy + }; + + this.contextMenuService.showContextMenu({ + getAnchor: () => anchor, + getActions: () => actions, + onHide: () => disposables.dispose() + }); + })); + this._register(addDisposableListener(this.container, EventType.KEY_UP, (e: KeyboardEvent) => { const event = new StandardKeyboardEvent(e); if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) { @@ -194,7 +195,7 @@ export class HomeActivityActionViewItem extends ActivityActionViewItem { @IConfigurationService configurationService: IConfigurationService, @IKeybindingService keybindingService: IKeybindingService, ) { - super(action, { draggable: false, colors, icon: true, hasPopup: true, hoverOptions }, themeService, hoverService, configurationService, keybindingService); + super(action, { draggable: false, colors, icon: true, hasPopup: true, hoverOptions }, () => true, themeService, hoverService, configurationService, keybindingService); } override render(container: HTMLElement): void { @@ -414,7 +415,7 @@ export class ProfilesActivityActionViewItem extends MenuActivityActionViewItem { const actions = await super.resolveContextMenuActions(disposables); actions.unshift(...[ - toAction({ id: 'hideprofiles', label: localize('hideprofiles', "Hide {0}", PROFILES_CATEGORY), run: () => this.storageService.store(ProfilesActivityActionViewItem.PROFILES_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }), + toAction({ id: 'hideprofiles', label: localize('hideprofiles', "Hide {0}", PROFILES_CATEGORY.value), run: () => this.storageService.store(ProfilesActivityActionViewItem.PROFILES_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }), new Separator() ]); @@ -422,7 +423,7 @@ export class ProfilesActivityActionViewItem extends MenuActivityActionViewItem { } protected override computeTitle(): string { - return localize('profiles', "{0} (Settings Profile)", this.userDataProfileService.currentProfile.name); + return localize('profiles', "{0} (Profile)", this.userDataProfileService.currentProfile.name); } } @@ -460,6 +461,17 @@ export class PlaceHolderToggleCompositePinnedAction extends ToggleCompositePinne } } +export class PlaceHolderToggleCompositeBadgeAction extends ToggleCompositeBadgeAction { + + constructor(id: string, compositeBar: ICompositeBar) { + super({ id, name: id, cssClass: undefined }, compositeBar); + } + + setActivity(activity: IActivity): void { + this.label = activity.name; + } +} + class SwitchSideBarViewAction extends Action2 { constructor( @@ -496,7 +508,7 @@ registerAction2( super({ id: 'workbench.action.previousSideBarView', title: { value: localize('previousSideBarView', "Previous Primary Side Bar View"), original: 'Previous Primary Side Bar View' }, - category: CATEGORIES.View, + category: Categories.View, f1: true }, -1); } @@ -509,7 +521,7 @@ registerAction2( super({ id: 'workbench.action.nextSideBarView', title: { value: localize('nextSideBarView', "Next Primary Side Bar View"), original: 'Next Primary Side Bar View' }, - category: CATEGORIES.View, + category: Categories.View, f1: true }, 1); } @@ -522,7 +534,7 @@ registerAction2( super({ id: 'workbench.action.focusActivityBar', title: { value: localize('focusActivityBar', "Focus Activity Bar"), original: 'Focus Activity Bar' }, - category: CATEGORIES.View, + category: Categories.View, f1: true }); } @@ -551,24 +563,24 @@ registerThemingParticipant((theme, collector) => { `); } - const activityBarSettingsProfileBgColor = theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_BACKGROUND); - if (activityBarSettingsProfileBgColor) { + const activityBarProfileBgColor = theme.getColor(ACTIVITY_BAR_PROFILE_BACKGROUND); + if (activityBarProfileBgColor) { collector.addRule(` .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item, .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item, .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item { - background-color: ${activityBarSettingsProfileBgColor} !important; + background-color: ${activityBarProfileBgColor} !important; } `); } - const activityBarSettingsProfileHoverFgColor = theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_HOVER_FOREGROUND); - if (activityBarSettingsProfileHoverFgColor) { + const activityBarProfileHoverFgColor = theme.getColor(ACTIVITY_BAR_PROFILE_HOVER_FOREGROUND); + if (activityBarProfileHoverFgColor) { collector.addRule(` .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label.profile-activity-item, .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .action-label.profile-activity-item, .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label.profile-activity-item { - color: ${activityBarSettingsProfileHoverFgColor} !important; + color: ${activityBarProfileHoverFgColor} !important; } `); } diff --git a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 0907d1489..7c86adcce 100644 --- a/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -9,7 +9,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti import { GLOBAL_ACTIVITY_ID, IActivity, ACCOUNTS_ACTIVITY_ID } from 'vs/workbench/common/activity'; import { Part } from 'vs/workbench/browser/part'; // below codes are changed by github1s -import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, AccountsActivityActionViewItem, ProfilesActivityActionViewItem, IProfileActivity, HomeActivityActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions'; +import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, AccountsActivityActionViewItem, ProfilesActivityActionViewItem, IProfileActivity, PlaceHolderToggleCompositeBadgeAction, HomeActivityActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions'; // above codes are changed by github1s import { IBadge, NumberBadge } from 'vs/workbench/services/activity/common/activity'; import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService'; @@ -18,14 +18,14 @@ import { IDisposable, toDisposable, DisposableStore, Disposable } from 'vs/base/ import { Event } from 'vs/base/common/event'; import { ToggleActivityBarVisibilityAction, ToggleSidebarPositionAction } from 'vs/workbench/browser/actions/layoutActions'; import { IThemeService, IColorTheme, ThemeIcon } from 'vs/platform/theme/common/themeService'; -import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BORDER, ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND } from 'vs/workbench/common/theme'; +import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BORDER, ACTIVITY_BAR_PROFILE_FOREGROUND } from 'vs/workbench/common/theme'; import { contrastBorder } from 'vs/platform/theme/common/colorRegistry'; import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar'; import { Dimension, createCSSRule, asCSSUrl, addDisposableListener, EventType, isAncestor } from 'vs/base/browser/dom'; import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { URI, UriComponents } from 'vs/base/common/uri'; -import { ToggleCompositePinnedAction, ICompositeBarColors, ActivityAction, ICompositeActivity, IActivityHoverOptions } from 'vs/workbench/browser/parts/compositeBarActions'; +import { ToggleCompositePinnedAction, ICompositeBarColors, ActivityAction, ICompositeActivity, IActivityHoverOptions, ToggleCompositeBadgeAction } from 'vs/workbench/browser/parts/compositeBarActions'; import { IViewDescriptorService, ViewContainer, IViewContainerModel, ViewContainerLocation } from 'vs/workbench/common/views'; import { getEnabledViewContainerContextKey } from 'vs/workbench/common/contextkeys'; import { IContextKeyService, ContextKeyExpr, IContextKey } from 'vs/platform/contextkey/common/contextkey'; @@ -45,8 +45,6 @@ import { StringSHA1 } from 'vs/base/common/hash'; import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget'; import { GestureEvent } from 'vs/base/browser/touch'; import { IPaneCompositePart, IPaneCompositeSelectorPart } from 'vs/workbench/browser/parts/paneCompositePart'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { Extensions, IProfileStorageRegistry } from 'vs/workbench/services/userDataProfile/common/userDataProfileStorageRegistry'; import { IUserDataProfileService, PROFILES_TTILE } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; @@ -62,6 +60,7 @@ interface IPlaceholderViewContainer { interface IPinnedViewContainer { readonly id: string; readonly pinned: boolean; + readonly badgeEnabled: boolean; readonly order?: number; readonly visible: boolean; } @@ -71,6 +70,7 @@ interface ICachedViewContainer { name?: string; icon?: URI | ThemeIcon; readonly pinned: boolean; + readonly badgeEnabled: boolean; readonly order?: number; visible: boolean; isBuiltin?: boolean; @@ -120,7 +120,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart private readonly accountsActivity: ICompositeActivity[] = []; - private readonly compositeActions = new Map(); + private readonly compositeActions = new Map(); private readonly viewContainerDisposables = new Map(); private readonly keyboardNavigationDisposables = this._register(new DisposableStore()); @@ -155,14 +155,6 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart this.registerListeners(); - Registry.as(Extensions.ProfileStorageRegistry) - .registerKeys([{ - key: ActivitybarPart.PINNED_VIEW_CONTAINERS, - description: localize('pinned view containers', "Activity bar entries visibility customizations") - }, { - key: AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, - description: localize('accounts visibility key', "Accounts entry visibility customization in the activity bar.") - }]); } private createCompositeBar() { @@ -172,7 +164,8 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart name: container.name, visible: container.visible, order: container.order, - pinned: container.pinned + badgeEnabled: container.badgeEnabled, + pinned: container.pinned, })); return this._register(this.instantiationService.createInstance(CompositeBar, cachedItems, { @@ -185,6 +178,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart }, getActivityAction: compositeId => this.getCompositeActions(compositeId).activityAction, getCompositePinnedAction: compositeId => this.getCompositeActions(compositeId).pinnedAction, + getCompositeBadgeAction: compositeId => this.getCompositeActions(compositeId).badgeAction, getOnCompositeClickAction: compositeId => toAction({ id: compositeId, label: '', run: async () => this.paneCompositePart.getActivePaneComposite()?.getId() === compositeId ? this.paneCompositePart.hideActivePaneComposite() : this.paneCompositePart.openPaneComposite(compositeId) }), fillExtraContextMenuActions: (actions, e?: MouseEvent | GestureEvent) => { // Menu @@ -202,7 +196,9 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart // Accounts actions.push(new Separator()); actions.push(toAction({ id: 'toggleAccountsVisibility', label: localize('accounts', "Accounts"), checked: this.accountsVisibilityPreference, run: () => this.accountsVisibilityPreference = !this.accountsVisibilityPreference })); - actions.push(toAction({ id: 'toggleProfilesVisibility', label: PROFILES_TTILE.value, checked: this.profilesVisibilityPreference, run: () => this.profilesVisibilityPreference = !this.profilesVisibilityPreference })); + if (this.userDataProfilesService.isEnabled()) { + actions.push(toAction({ id: 'toggleProfilesVisibility', label: PROFILES_TTILE.value, checked: this.profilesVisibilityPreference, run: () => this.profilesVisibilityPreference = !this.profilesVisibilityPreference })); + } actions.push(new Separator()); // Toggle Sidebar @@ -470,7 +466,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart this.registerKeyboardNavigationListeners(); } - override createContentArea(parent: HTMLElement): HTMLElement { + protected override createContentArea(parent: HTMLElement): HTMLElement { this.element = parent; this.content = document.createElement('div'); @@ -594,7 +590,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart } if (action.id === 'workbench.actions.profiles') { - return this.instantiationService.createInstance(ProfilesActivityActionViewItem, action as ActivityAction, () => this.compositeBar.getContextMenuActions(), (theme: IColorTheme) => this.getSettingsProfileItemColors(theme), this.getActivityHoverOptions()); + return this.instantiationService.createInstance(ProfilesActivityActionViewItem, action as ActivityAction, () => this.compositeBar.getContextMenuActions(), (theme: IColorTheme) => this.getProfileItemColors(theme), this.getActivityHoverOptions()); } throw new Error(`No view item for action '${action.id}'`); @@ -692,7 +688,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart }; } - private getCompositeActions(compositeId: string): { activityAction: ViewContainerActivityAction; pinnedAction: ToggleCompositePinnedAction } { + private getCompositeActions(compositeId: string): { activityAction: ViewContainerActivityAction; pinnedAction: ToggleCompositePinnedAction; badgeAction: ToggleCompositeBadgeAction } { let compositeActions = this.compositeActions.get(compositeId); if (!compositeActions) { const viewContainer = this.getViewContainer(compositeId); @@ -700,13 +696,15 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer); compositeActions = { activityAction: this.instantiationService.createInstance(ViewContainerActivityAction, this.toActivity(viewContainerModel), this.paneCompositePart), - pinnedAction: new ToggleCompositePinnedAction(this.toActivity(viewContainerModel), this.compositeBar) + pinnedAction: new ToggleCompositePinnedAction(this.toActivity(viewContainerModel), this.compositeBar), + badgeAction: new ToggleCompositeBadgeAction(this.toActivity(viewContainerModel), this.compositeBar) }; } else { const cachedComposite = this.cachedViewContainers.filter(c => c.id === compositeId)[0]; compositeActions = { activityAction: this.instantiationService.createInstance(PlaceHolderViewContainerActivityAction, ActivitybarPart.toActivity(compositeId, compositeId, cachedComposite?.icon, undefined), this.paneCompositePart), - pinnedAction: new PlaceHolderToggleCompositePinnedAction(compositeId, this.compositeBar) + pinnedAction: new PlaceHolderToggleCompositePinnedAction(compositeId, this.compositeBar), + badgeAction: new PlaceHolderToggleCompositeBadgeAction(compositeId, this.compositeBar) }; } @@ -906,11 +904,11 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart }; } - private getSettingsProfileItemColors(theme: IColorTheme): ICompositeBarColors { + private getProfileItemColors(theme: IColorTheme): ICompositeBarColors { return { ...this.getActivitybarItemColors(theme), - activeForegroundColor: theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND), - inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND), + activeForegroundColor: theme.getColor(ACTIVITY_BAR_PROFILE_FOREGROUND), + inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_PROFILE_FOREGROUND), }; } @@ -956,6 +954,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart id: cachedViewContainer.id, name: cachedViewContainer.name, order: cachedViewContainer.order, + badgeEnabled: cachedViewContainer.badgeEnabled, pinned: cachedViewContainer.pinned, visible: !!compositeItems.find(({ id }) => id === cachedViewContainer.id) }); @@ -1000,15 +999,16 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart state.push({ id: compositeItem.id, name: viewContainerModel.title, - icon: URI.isUri(viewContainerModel.icon) && this.environmentService.remoteAuthority && isNative ? undefined : viewContainerModel.icon, /* Donot cache uri icons in desktop with remote connection */ + icon: URI.isUri(viewContainerModel.icon) && this.environmentService.remoteAuthority ? undefined : viewContainerModel.icon, /* Donot cache uri icons with remote connection */ views, pinned: compositeItem.pinned, + badgeEnabled: compositeItem.badgeEnabled, order: compositeItem.order, visible: compositeItem.visible, isBuiltin: !viewContainer.extensionId }); } else { - state.push({ id: compositeItem.id, pinned: compositeItem.pinned, order: compositeItem.order, visible: false, isBuiltin: false }); + state.push({ id: compositeItem.id, pinned: compositeItem.pinned, badgeEnabled: compositeItem.badgeEnabled, order: compositeItem.order, visible: false, isBuiltin: false }); } } @@ -1025,6 +1025,9 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart cachedViewContainer.name = placeholderViewContainer.name; cachedViewContainer.icon = placeholderViewContainer.themeIcon ? placeholderViewContainer.themeIcon : placeholderViewContainer.iconUrl ? URI.revive(placeholderViewContainer.iconUrl) : undefined; + if (URI.isUri(cachedViewContainer.icon) && this.environmentService.remoteAuthority) { + cachedViewContainer.icon = undefined; /* Donot cache uri icons with remote connection */ + } cachedViewContainer.views = placeholderViewContainer.views; cachedViewContainer.isBuiltin = placeholderViewContainer.isBuiltin; } @@ -1125,7 +1128,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart } private get profilesVisibilityPreference(): boolean { - return this.storageService.getBoolean(ProfilesActivityActionViewItem.PROFILES_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, this.userDataProfilesService.profiles.length > 1); + return this.userDataProfilesService.isEnabled() && this.storageService.getBoolean(ProfilesActivityActionViewItem.PROFILES_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, this.userDataProfilesService.profiles.length > 1); } private set profilesVisibilityPreference(value: boolean) { diff --git a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 10da857a2..20ac88243 100644 --- a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -97,7 +97,19 @@ } .monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center.hide { - display: none; + visibility: hidden; +} + +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item>.action-label { + color: var(--vscode-titleBar-foreground); +} + +.monaco-workbench .part.titlebar.inactive>.titlebar-container>.window-title>.command-center .action-item>.action-label { + color: var(--vscode-titleBar-inactiveForeground); +} + +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .codicon { + color: inherit; } .monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center { @@ -113,42 +125,30 @@ border-top-right-radius: 6px; border-bottom-right-radius: 6px; - width: 38vw; max-width: 600px; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .left { - display: inline-flex; - justify-content: center; - width: 100%; - margin: auto; - overflow: hidden; - text-overflow: ellipsis; +.monaco-workbench .part.titlebar.inactive>.titlebar-container>.window-title>.command-center .action-item.command-center { + color: var(--vscode-titleBar-inactiveForeground); + border-color: var(--vscode-commandCenter-inactiveBorder) !important; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .left .search-icon { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .search-icon { font-size: 14px; opacity: .8; margin: auto 3px; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .left .search-label { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .search-label { overflow: hidden; text-overflow: ellipsis; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .right { - margin-left: auto; - padding: 2px 2px 0 0; - width: 16px; - flex-shrink: 0; -} - -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .left:HOVER, -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center .right:HOVER { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.command-center:HOVER { color: var(--vscode-commandCenter-activeForeground); background-color: var(--vscode-commandCenter-activeBackground); + border-color: var(--vscode-commandCenter-activeBorder); } /* Menubar */ @@ -159,6 +159,10 @@ flex-wrap: nowrap; } +.monaco-workbench.web .part.titlebar>.titlebar-container>.menubar { + margin-left: 4px; +} + .monaco-workbench .part.titlebar>.titlebar-container.counter-zoom > .menubar .menubar-menu-button > .menubar-menu-items-holder.monaco-menu-container { zoom: var(--zoom-factor); } @@ -234,10 +238,13 @@ .monaco-workbench.mac .part.titlebar>.window-controls-container { width: 70px; - height: env(titlebar-area-width, 28px); } -.monaco-workbench.web .part.titlebar>.window-controls-container, +.monaco-workbench.web .part.titlebar>.window-controls-container { + width: calc(100% - env(titlebar-area-width, 100%)); + height: env(titlebar-area-height, 35px); +} + .monaco-workbench.fullscreen .part.titlebar>.window-controls-container { display: none; background-color: transparent; @@ -325,5 +332,4 @@ -webkit-mask-position: 50% 50%; background-color: var(--vscode-activityBar-foreground); } - /* above codes are changed by github1s */ diff --git a/vscode-web/src/vs/workbench/browser/web.main.ts b/vscode-web/src/vs/workbench/browser/web.main.ts index 7e0355604..3028d5343 100644 --- a/vscode-web/src/vs/workbench/browser/web.main.ts +++ b/vscode-web/src/vs/workbench/browser/web.main.ts @@ -6,7 +6,7 @@ import { mark } from 'vs/base/common/performance'; import { domContentLoaded, detectFullscreen, getCookieValue } from 'vs/base/browser/dom'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -import { ILogService, ConsoleLogger, MultiplexLogService, getLogLevel } from 'vs/platform/log/common/log'; +import { ILogService, ConsoleLogger, MultiplexLogService, getLogLevel, ILoggerService } from 'vs/platform/log/common/log'; import { ConsoleLogInAutomationLogger } from 'vs/platform/log/browser/log'; import { Disposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; import { BrowserWorkbenchEnvironmentService, IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; @@ -35,7 +35,7 @@ import { IWorkbenchConstructionOptions, IWorkbench, ITunnel } from 'vs/workbench import { BrowserStorageService } from 'vs/workbench/services/storage/browser/storageService'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { BufferLogService } from 'vs/platform/log/common/bufferLog'; -import { FileLogger } from 'vs/platform/log/common/fileLog'; +import { FileLoggerService } from 'vs/platform/log/common/fileLog'; import { toLocalISOString } from 'vs/base/common/date'; import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/window/common/window'; import { getSingleFolderWorkspaceIdentifier, getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces'; @@ -52,7 +52,7 @@ import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecy import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { localize } from 'vs/nls'; -import { CATEGORIES } from 'vs/workbench/common/actions'; +import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; @@ -81,6 +81,8 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { UserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfileService'; import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { BrowserUserDataProfilesService } from 'vs/platform/userDataProfile/browser/userDataProfile'; +import { timeout } from 'vs/base/common/async'; +import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; export class BrowserMain extends Disposable { @@ -136,7 +138,6 @@ export class BrowserMain extends Disposable { const timerService = accessor.get(ITimerService); const openerService = accessor.get(IOpenerService); const productService = accessor.get(IProductService); - const telemetryService = accessor.get(ITelemetryService); const progressService = accessor.get(IProgressService); const environmentService = accessor.get(IBrowserWorkbenchEnvironmentService); const instantiationService = accessor.get(IInstantiationService); @@ -150,7 +151,6 @@ export class BrowserMain extends Disposable { executeCommand: (command, ...args) => commandService.executeCommand(command, ...args) }, env: { - telemetryLevel: telemetryService.telemetryLevel, async getUriScheme(): Promise { return productService.urlProtocol; }, @@ -196,7 +196,7 @@ export class BrowserMain extends Disposable { } return new class extends DisposableTunnel implements ITunnel { - override localAddress!: string; + declare localAddress: string; }({ port: tunnel.tunnelRemotePort, host: tunnel.tunnelRemoteHost }, tunnel.localAddress, () => tunnel.dispose()); } }, @@ -268,7 +268,12 @@ export class BrowserMain extends Disposable { // Files const fileService = this._register(new FileService(logService)); serviceCollection.set(IWorkbenchFileService, fileService); - await this.registerFileSystemProviders(environmentService, fileService, remoteAgentService, logService, logsPath); + + // Logger + const loggerService = new FileLoggerService(logService, fileService); + serviceCollection.set(ILoggerService, loggerService); + + await this.registerFileSystemProviders(environmentService, fileService, remoteAgentService, logService, loggerService, logsPath); // URI Identity const uriIdentityService = new UriIdentityService(fileService); @@ -277,6 +282,21 @@ export class BrowserMain extends Disposable { // User Data Profiles const userDataProfilesService = new BrowserUserDataProfilesService(environmentService, fileService, uriIdentityService, logService); serviceCollection.set(IUserDataProfilesService, userDataProfilesService); + let isProfilesEnablementConfigured = false; + if (environmentService.remoteAuthority) { + // Always Disabled in web with remote connection + userDataProfilesService.setEnablement(false); + } else { + if (productService.quality === 'stable') { + // Enabled from Config + userDataProfilesService.setEnablement(window.localStorage.getItem(PROFILES_ENABLEMENT_CONFIG) === 'true'); + isProfilesEnablementConfigured = true; + } else { + // Always Enabled + userDataProfilesService.setEnablement(true); + } + } + const lastActiveProfile = environmentService.lastActiveProfile ? userDataProfilesService.profiles.find(p => p.id === environmentService.lastActiveProfile) : undefined; const currentProfile = userDataProfilesService.getOrSetProfileForWorkspace(isWorkspaceIdentifier(workspace) || isSingleFolderWorkspaceIdentifier(workspace) ? workspace : 'empty-window', lastActiveProfile ?? userDataProfilesService.defaultProfile); const userDataProfileService = new UserDataProfileService(currentProfile, userDataProfilesService); @@ -304,12 +324,14 @@ export class BrowserMain extends Disposable { }) ]); - userDataProfilesService.setEnablement(productService.quality !== 'stable' || configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); - this._register(configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration(PROFILES_ENABLEMENT_CONFIG)) { - userDataProfilesService.setEnablement(!!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); - } - })); + if (isProfilesEnablementConfigured) { + userDataProfilesService.setEnablement(!!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); + this._register(configurationService.onDidChangeConfiguration(e => { + if (e.source !== ConfigurationTarget.DEFAULT && e.affectsConfiguration(PROFILES_ENABLEMENT_CONFIG)) { + window.localStorage.setItem(PROFILES_ENABLEMENT_CONFIG, !!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG) ? 'true' : 'false'); + } + })); + } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // @@ -325,7 +347,7 @@ export class BrowserMain extends Disposable { const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService); serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService); - const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService); + const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService, fileService); serviceCollection.set(IWorkspaceTrustManagementService, workspaceTrustManagementService); // Update workspace trust so that configuration is updated accordingly @@ -358,6 +380,20 @@ export class BrowserMain extends Disposable { const userDataInitializationService = new UserDataInitializationService(environmentService, credentialsService, userDataSyncStoreManagementService, fileService, userDataProfilesService, storageService, productService, requestService, logService, uriIdentityService); serviceCollection.set(IUserDataInitializationService, userDataInitializationService); + try { + await Promise.race([ + // Do not block more than 5s + timeout(5000), + this.initializeUserData(userDataInitializationService, configurationService)] + ); + } catch (error) { + logService.error(error); + } + + return { serviceCollection, configurationService, logService }; + } + + private async initializeUserData(userDataInitializationService: UserDataInitializationService, configurationService: WorkspaceService) { if (await userDataInitializationService.requiresInitialization()) { mark('code/willInitRequiredUserData'); @@ -370,11 +406,9 @@ export class BrowserMain extends Disposable { mark('code/didInitRequiredUserData'); } - - return { serviceCollection, configurationService, logService }; } - private async registerFileSystemProviders(environmentService: IWorkbenchEnvironmentService, fileService: IWorkbenchFileService, remoteAgentService: IRemoteAgentService, logService: BufferLogService, logsPath: URI): Promise { + private async registerFileSystemProviders(environmentService: IWorkbenchEnvironmentService, fileService: IWorkbenchFileService, remoteAgentService: IRemoteAgentService, logService: BufferLogService, loggerService: ILoggerService, logsPath: URI): Promise { // IndexedDB is used for logging and user data let indexedDB: IndexedDB | undefined; @@ -401,7 +435,7 @@ export class BrowserMain extends Disposable { logService.logger = new MultiplexLogService(coalesce([ new ConsoleLogger(logService.getLevel()), - new FileLogger('window', environmentService.logFile, logService.getLevel(), false, fileService), + loggerService.createLogger(environmentService.logFile, { name: 'window' }), // Extension development test CLI: forward everything to test runner environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI ? new ConsoleLogInAutomationLogger(logService.getLevel()) : undefined ])); @@ -436,7 +470,7 @@ export class BrowserMain extends Disposable { super({ id: 'workbench.action.resetUserData', title: { original: 'Reset User Data', value: localize('reset', "Reset User Data") }, - category: CATEGORIES.Developer, + category: Categories.Developer, menu: { id: MenuId.CommandPalette } diff --git a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html index 9992fe1ee..2e9769ec1 100644 --- a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html +++ b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html @@ -86,92 +86,92 @@ const defaultStyles = document.createElement('style'); defaultStyles.id = '_defaultStyles'; defaultStyles.textContent = ` - html { - scrollbar-color: var(--vscode-scrollbarSlider-background) var(--vscode-editor-background); - } - - body { - background-color: transparent; - color: var(--vscode-editor-foreground); - font-family: var(--vscode-font-family); - font-weight: var(--vscode-font-weight); - font-size: var(--vscode-font-size); - margin: 0; - padding: 0 20px; - } - - img, video { - max-width: 100%; - max-height: 100%; - } - - a, a code { - color: var(--vscode-textLink-foreground); - } - - a:hover { - color: var(--vscode-textLink-activeForeground); - } - - a:focus, - input:focus, - select:focus, - textarea:focus { - outline: 1px solid -webkit-focus-ring-color; - outline-offset: -1px; - } - - code { - color: var(--vscode-textPreformat-foreground); - } - - blockquote { - background: var(--vscode-textBlockQuote-background); - border-color: var(--vscode-textBlockQuote-border); - } - - kbd { - color: var(--vscode-editor-foreground); - border-radius: 3px; - vertical-align: middle; - padding: 1px 3px; - - background-color: hsla(0,0%,50%,.17); - border: 1px solid rgba(71,71,71,.4); - border-bottom-color: rgba(88,88,88,.4); - box-shadow: inset 0 -1px 0 rgba(88,88,88,.4); - } - .vscode-light kbd { - background-color: hsla(0,0%,87%,.5); - border: 1px solid hsla(0,0%,80%,.7); - border-bottom-color: hsla(0,0%,73%,.7); - box-shadow: inset 0 -1px 0 hsla(0,0%,73%,.7); - } - - ::-webkit-scrollbar { - width: 10px; - height: 10px; - } - - ::-webkit-scrollbar-corner { - background-color: var(--vscode-editor-background); - } - - ::-webkit-scrollbar-thumb { - background-color: var(--vscode-scrollbarSlider-background); - } - ::-webkit-scrollbar-thumb:hover { - background-color: var(--vscode-scrollbarSlider-hoverBackground); - } - ::-webkit-scrollbar-thumb:active { - background-color: var(--vscode-scrollbarSlider-activeBackground); - } - ::highlight(find-highlight) { - background-color: var(--vscode-editor-findMatchHighlightBackground); - } - ::highlight(current-find-highlight) { - background-color: var(--vscode-editor-findMatchBackground); - }`; + html { + scrollbar-color: var(--vscode-scrollbarSlider-background) var(--vscode-editor-background); + } + + body { + background-color: transparent; + color: var(--vscode-editor-foreground); + font-family: var(--vscode-font-family); + font-weight: var(--vscode-font-weight); + font-size: var(--vscode-font-size); + margin: 0; + padding: 0 20px; + } + + img, video { + max-width: 100%; + max-height: 100%; + } + + a, a code { + color: var(--vscode-textLink-foreground); + } + + a:hover { + color: var(--vscode-textLink-activeForeground); + } + + a:focus, + input:focus, + select:focus, + textarea:focus { + outline: 1px solid -webkit-focus-ring-color; + outline-offset: -1px; + } + + code { + color: var(--vscode-textPreformat-foreground); + } + + blockquote { + background: var(--vscode-textBlockQuote-background); + border-color: var(--vscode-textBlockQuote-border); + } + + kbd { + color: var(--vscode-editor-foreground); + border-radius: 3px; + vertical-align: middle; + padding: 1px 3px; + + background-color: hsla(0,0%,50%,.17); + border: 1px solid rgba(71,71,71,.4); + border-bottom-color: rgba(88,88,88,.4); + box-shadow: inset 0 -1px 0 rgba(88,88,88,.4); + } + .vscode-light kbd { + background-color: hsla(0,0%,87%,.5); + border: 1px solid hsla(0,0%,80%,.7); + border-bottom-color: hsla(0,0%,73%,.7); + box-shadow: inset 0 -1px 0 hsla(0,0%,73%,.7); + } + + ::-webkit-scrollbar { + width: 10px; + height: 10px; + } + + ::-webkit-scrollbar-corner { + background-color: var(--vscode-editor-background); + } + + ::-webkit-scrollbar-thumb { + background-color: var(--vscode-scrollbarSlider-background); + } + ::-webkit-scrollbar-thumb:hover { + background-color: var(--vscode-scrollbarSlider-hoverBackground); + } + ::-webkit-scrollbar-thumb:active { + background-color: var(--vscode-scrollbarSlider-activeBackground); + } + ::highlight(find-highlight) { + background-color: var(--vscode-editor-findMatchHighlightBackground); + } + ::highlight(current-find-highlight) { + background-color: var(--vscode-editor-findMatchBackground); + }`; /** * @param {boolean} allowMultipleAPIAcquire @@ -181,40 +181,40 @@ function getVsCodeApiScript(allowMultipleAPIAcquire, state) { const encodedState = state ? encodeURIComponent(state) : undefined; return /* js */` - globalThis.acquireVsCodeApi = (function() { - const originalPostMessage = window.parent['${vscodePostMessageFuncName}'].bind(window.parent); - const doPostMessage = (channel, data, transfer) => { - originalPostMessage(channel, data, transfer); - }; + globalThis.acquireVsCodeApi = (function() { + const originalPostMessage = window.parent['${vscodePostMessageFuncName}'].bind(window.parent); + const doPostMessage = (channel, data, transfer) => { + originalPostMessage(channel, data, transfer); + }; - let acquired = false; + let acquired = false; - let state = ${state ? `JSON.parse(decodeURIComponent("${encodedState}"))` : undefined}; + let state = ${state ? `JSON.parse(decodeURIComponent("${encodedState}"))` : undefined}; - return () => { - if (acquired && !${allowMultipleAPIAcquire}) { - throw new Error('An instance of the VS Code API has already been acquired'); - } - acquired = true; - return Object.freeze({ - postMessage: function(message, transfer) { - doPostMessage('onmessage', { message, transfer }, transfer); - }, - setState: function(newState) { - state = newState; - doPostMessage('do-update-state', JSON.stringify(newState)); - return newState; - }, - getState: function() { - return state; - } - }); - }; - })(); - delete window.parent; - delete window.top; - delete window.frameElement; - `; + return () => { + if (acquired && !${allowMultipleAPIAcquire}) { + throw new Error('An instance of the VS Code API has already been acquired'); + } + acquired = true; + return Object.freeze({ + postMessage: function(message, transfer) { + doPostMessage('onmessage', { message, transfer }, transfer); + }, + setState: function(newState) { + state = newState; + doPostMessage('do-update-state', JSON.stringify(newState)); + return newState; + }, + getState: function() { + return state; + } + }); + }; + })(); + delete window.parent; + delete window.top; + delete window.frameElement; + `; } /** @type {Promise} */ @@ -279,6 +279,9 @@ }); }); + /** + * @type {import('../webviewMessages').WebviewHostMessaging} + */ const hostMessaging = new class HostMessaging { constructor() { @@ -300,19 +303,10 @@ }; } - /** - * @param {string} channel - * @param {any} data - * @param {any} [transfer] - */ postMessage(channel, data, transfer) { this.channel.port1.postMessage({ channel, data }, transfer); } - /** - * @param {string} channel - * @param {(event: MessageEvent, data: any) => void} handler - */ onMessage(channel, handler) { let handlers = this.handlers.get(channel); if (!handlers) { @@ -336,11 +330,11 @@ this.confirmBeforeClose = 'keyboardOnly'; this.isModifierKeyDown = false; - hostMessaging.onMessage('set-confirm-before-close', (_e, /** @type {string} */ data) => { + hostMessaging.onMessage('set-confirm-before-close', (_e, data) => { this.confirmBeforeClose = data; }); - hostMessaging.onMessage('content', (_e, /** @type {any} */ data) => { + hostMessaging.onMessage('content', (_e, data) => { this.confirmBeforeClose = data.confirmBeforeClose; }); @@ -372,11 +366,11 @@ } onIframeLoaded(/** @type {HTMLIFrameElement} */ frame) { - frame.contentWindow.addEventListener('keydown', e => { + assertIsDefined(frame.contentWindow).addEventListener('keydown', e => { this.isModifierKeyDown = e.metaKey || e.ctrlKey || e.altKey; }); - frame.contentWindow.addEventListener('keyup', () => { + assertIsDefined(frame.contentWindow).addEventListener('keyup', () => { this.isModifierKeyDown = false; }); } @@ -482,8 +476,8 @@ } // Re-add new properties - for (const variable of Object.keys(initData.styles)) { - documentStyle.setProperty(`--${variable}`, initData.styles[variable]); + for (const [variable, value] of Object.entries(initData.styles)) { + documentStyle.setProperty(`--${variable}`, value); } } }; @@ -506,10 +500,15 @@ event.view.scrollTo(0, 0); } else if (node.hash && (node.getAttribute('href') === node.hash || (baseElement && node.href === baseElement.href + node.hash))) { const fragment = node.hash.slice(1); - const scrollTarget = event.view.document.getElementById(fragment) ?? event.view.document.getElementById(decodeURIComponent(fragment)); - scrollTarget?.scrollIntoView(); + const decodedFragment = decodeURIComponent(fragment); + const scrollTarget = event.view.document.getElementById(fragment) ?? event.view.document.getElementById(decodedFragment); + if (scrollTarget) { + scrollTarget.scrollIntoView(); + } else if (decodedFragment.toLowerCase() === 'top') { + event.view.scrollTo(0, 0); + } } else { - hostMessaging.postMessage('did-click-link', node.href.baseVal || node.href); + hostMessaging.postMessage('did-click-link', { uri: node.href.baseVal || node.href }); } event.preventDefault(); return; @@ -554,6 +553,10 @@ } else { return; // let the browser handle this } + } else if (!onElectron && (isCloseTab(e) || isNewWindow(e))) { + // Prevent Ctrl+W closing window / Ctrl+N opening new window in PWA. + // (No effect in a regular browser tab.) + e.preventDefault(); } hostMessaging.postMessage('did-keydown', { @@ -629,6 +632,24 @@ return hasMeta && e.key.toLowerCase() === 's'; } + /** + * @param {KeyboardEvent} e + * @return {boolean} + */ + function isCloseTab(e) { + const hasMeta = e.ctrlKey || e.metaKey; + return hasMeta && e.key.toLowerCase() === 'w'; + } + + /** + * @param {KeyboardEvent} e + * @return {boolean} + */ + function isNewWindow(e) { + const hasMeta = e.ctrlKey || e.metaKey; + return hasMeta && e.key.toLowerCase() === 'n'; + } + let isHandlingScroll = false; /** @@ -671,7 +692,7 @@ isHandlingScroll = true; window.requestAnimationFrame(() => { try { - hostMessaging.postMessage('did-scroll', progress); + hostMessaging.postMessage('did-scroll', { scrollYPercentage: progress }); } catch (e) { // noop } @@ -691,7 +712,7 @@ // Only handle drags from outside editor for now if (e.dataTransfer.items.length && Array.prototype.every.call(e.dataTransfer.items, item => item.kind === 'file')) { - hostMessaging.postMessage('drag-start'); + hostMessaging.postMessage('drag-start', undefined); } } @@ -775,7 +796,7 @@ // Check for CSP const csp = newDocument.querySelector('meta[http-equiv="Content-Security-Policy"]'); if (!csp) { - hostMessaging.postMessage('no-csp-found'); + hostMessaging.postMessage('no-csp-found', undefined); } else { try { // Attempt to rewrite CSPs that hardcode old-style resource endpoint @@ -905,18 +926,18 @@ } newFrame.setAttribute('sandbox', Array.from(sandboxRules).join(' ')); - const allowRules = ['cross-origin-isolated;'] - if(!isFirefox && options.allowScripts) { - allowRules.push('clipboard-read;','clipboard-write;') + const allowRules = ['cross-origin-isolated;', 'autoplay;']; + if (!isFirefox && options.allowScripts) { + allowRules.push('clipboard-read;', 'clipboard-write;'); } newFrame.setAttribute('allow', allowRules.join(' ')); // We should just be able to use srcdoc, but I wasn't // seeing the service worker applying properly. // Fake load an empty on the correct origin and then write real html // into it to get around this. - const fakeUrlParams = new URLSearchParams({id: ID}); - if(globalThis.crossOriginIsolated) { - fakeUrlParams.set('vscode-coi', '3') /*COOP+COEP*/ + const fakeUrlParams = new URLSearchParams({ id: ID }); + if (globalThis.crossOriginIsolated) { + fakeUrlParams.set('vscode-coi', '3'); /*COOP+COEP*/ } newFrame.src = `./fake.html?${fakeUrlParams.toString()}`; @@ -1039,9 +1060,10 @@ e.preventDefault(); + /** @type { Record} */ let context = {}; - /** @type HTMLElement */ + /** @type {HTMLElement | null} */ let el = e.target; while (true) { if (!el) { @@ -1057,7 +1079,7 @@ try { context = { ...JSON.parse(el.dataset.vscodeContext), ...context }; } catch (e) { - console.error(`Error parsing 'data-vscode-context' as json`, el, e) + console.error(`Error parsing 'data-vscode-context' as json`, el, e); } el = el.parentElement; @@ -1078,7 +1100,7 @@ }); // Forward message to the embedded iframe - hostMessaging.onMessage('message', (_event, /** @type {{message: any, transfer?: ArrayBuffer[] }} */ data) => { + hostMessaging.onMessage('message', (_event, data) => { const pending = getPendingFrame(); if (!pending) { const target = getActiveFrame(); @@ -1111,20 +1133,22 @@ return; } - if (!data.previous && lastFindValue !== data.value) { + if (!data.previous && lastFindValue !== data.value && target.contentWindow) { // Reset selection so we start search at the head of the last search const selection = target.contentWindow.getSelection(); - selection.collapse(selection.anchorNode); + if (selection) { + selection.collapse(selection.anchorNode); + } } lastFindValue = data.value; const didFind = (/** @type {any} */ (target.contentWindow)).find( data.value, - /* caseSensitive*/ false, - /* backwards*/ data.previous, - /* wrapAround*/ true, - /* wholeWord */ false, - /* searchInFrames*/ false, + /* caseSensitive*/ false, + /* backwards*/ data.previous, + /* wrapAround*/ true, + /* wholeWord */ false, + /* searchInFrames*/ false, false); hostMessaging.postMessage('did-find', didFind); }); @@ -1137,17 +1161,19 @@ lastFindValue = undefined; - if (!data.clearSelection) { + if (!data.clearSelection && target.contentWindow) { const selection = target.contentWindow.getSelection(); - for (let i = 0; i < selection.rangeCount; i++) { - selection.removeRange(selection.getRangeAt(i)); + if (selection) { + for (let i = 0; i < selection.rangeCount; i++) { + selection.removeRange(selection.getRangeAt(i)); + } } } }); trackFocus({ - onFocus: () => hostMessaging.postMessage('did-focus'), - onBlur: () => hostMessaging.postMessage('did-blur') + onFocus: () => hostMessaging.postMessage('did-focus', undefined), + onBlur: () => hostMessaging.postMessage('did-blur', undefined) }); (/** @type {any} */ (window))[vscodePostMessageFuncName] = (/** @type {string} */ command, /** @type {any} */ data) => { diff --git a/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts b/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts index 8d48fa1d2..7c48eec3a 100644 --- a/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts +++ b/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts @@ -7,14 +7,15 @@ import { IBuiltinExtensionsScannerService, ExtensionType, IExtensionManifest, Ta import { isWeb, Language } from 'vs/base/common/platform'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; -import { FileAccess } from 'vs/base/common/network'; +import { builtinExtensionsPath, FileAccess } from 'vs/base/common/network'; import { URI } from 'vs/base/common/uri'; -import { IExtensionResourceLoaderService } from 'vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader'; +import { IExtensionResourceLoaderService } from 'vs/platform/extensionResourceLoader/common/extensionResourceLoader'; import { IProductService } from 'vs/platform/product/common/productService'; import { ITranslations, localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls'; import { ILogService } from 'vs/platform/log/common/log'; +import { ImplicitActivationEvents } from 'vs/platform/extensionManagement/common/implicitActivationEvents'; interface IBundledExtension { extensionPath: string; @@ -47,7 +48,7 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne this.nlsUrl = URI.joinPath(URI.parse(nlsBaseUrl), productService.commit, productService.version, Language.value()); } - const builtinExtensionsServiceUrl = FileAccess.asBrowserUri('../../../../../../extensions', require); + const builtinExtensionsServiceUrl = FileAccess.asBrowserUri(builtinExtensionsPath); if (builtinExtensionsServiceUrl) { let bundledExtensions: IBundledExtension[] = []; @@ -82,6 +83,7 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne } browserNlsBundleUris.en = uriIdentityService.extUri.resolvePath(builtinExtensionsServiceUrl!, e.browserNlsMetadataPath); } + ImplicitActivationEvents.updateManifest(e.packageJSON); return { identifier: { id }, location: uriIdentityService.extUri.joinPath(builtinExtensionsServiceUrl!, e.extensionPath), @@ -121,4 +123,4 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne } } -registerSingleton(IBuiltinExtensionsScannerService, BuiltinExtensionsScannerService, true); +registerSingleton(IBuiltinExtensionsScannerService, BuiltinExtensionsScannerService, InstantiationType.Delayed); diff --git a/vscode-web/src/vs/workbench/services/label/common/labelService.ts b/vscode-web/src/vs/workbench/services/label/common/labelService.ts index ae93a0845..dd2bb7502 100644 --- a/vscode-web/src/vs/workbench/services/label/common/labelService.ts +++ b/vscode-web/src/vs/workbench/services/label/common/labelService.ts @@ -18,7 +18,7 @@ import { ILabelService, ResourceLabelFormatter, ResourceLabelFormatting, IFormat import { ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry'; import { match } from 'vs/base/common/glob'; import { ILifecycleService, LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; -import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IPathService } from 'vs/workbench/services/path/common/pathService'; import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; import { OperatingSystem, OS } from 'vs/base/common/platform'; @@ -293,6 +293,7 @@ export class LabelService extends Disposable implements ILabelService { return (window as any)?.vscodeWeb?.workspaceLabel as string; } /* above codes are changed by github1s */ + if (isWorkspace(workspace)) { const identifier = toWorkspaceIdentifier(workspace); if (identifier) { @@ -460,4 +461,4 @@ export class LabelService extends Disposable implements ILabelService { } } -registerSingleton(ILabelService, LabelService, true); +registerSingleton(ILabelService, LabelService, InstantiationType.Delayed); diff --git a/vscode-web/yarn.lock b/vscode-web/yarn.lock index 274e86720..1f3cab5c2 100644 --- a/vscode-web/yarn.lock +++ b/vscode-web/yarn.lock @@ -489,10 +489,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vscode-oniguruma@1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz#2bf4dfcfe3dd2e56eb549a3068c8ee39e6c30ce5" - integrity sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ== +vscode-oniguruma@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== vscode-textmate@7.0.1: version "7.0.1" @@ -517,27 +517,27 @@ which@^1.2.9: dependencies: isexe "^2.0.0" -xterm-addon-canvas@0.3.0-beta.1: - version "0.3.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.3.0-beta.1.tgz#17a65f5da65416b01d620ddef6247ff5013ffc15" - integrity sha512-34PKhrkvK1RtlOOmni4i5GUIyoFKGMph8fWFvA2d52IDTKmX9YoLzZfU73D/sUAx+/GKobCE8sr14CuBZctgNw== - -xterm-addon-search@0.11.0-beta.1: - version "0.11.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0-beta.1.tgz#fe7178d70246cde73550447c5524672575467499" - integrity sha512-fKj8KnnhH1nC4oZpKsgnhtgxkTctoa9kGLMpTJjsNzFu0VvXvLGIRezTPI75UEIQdEdaxcwB7/aKelQTO+72LA== - -xterm-addon-unicode11@0.5.0-beta.1: - version "0.5.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.5.0-beta.1.tgz#8a9e9356018e082318abbe2be1f9599fcc6b46a2" - integrity sha512-uAErX4gwhW6N524stLG6oZR3yBGgPnFmZ2Tv4vyYy7tcgDuHRoc22xYSCDgO1ohz1FLlOm8JGXRjXliwO9ic3A== - -xterm-addon-webgl@0.14.0-beta.8: - version "0.14.0-beta.8" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.14.0-beta.8.tgz#486ae22b2eb88a12ebded366c4019ee26409cbb8" - integrity sha512-G0F70f6zGWtXuZxKiTn9BQswaVz85wcCuadnWRdPFDBlgdEfcboCvVZgQetklOIkluVpt8tYYK013/25iMRKTA== - -xterm@5.1.0-beta.15: - version "5.1.0-beta.15" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.1.0-beta.15.tgz#146b70c81fd286dbb003d18449918326fa355b6b" - integrity sha512-fO87pEPFMr+h7eo51+6+ew3OhzLm2wwSYz6w/y5lH986rD1lgAeEqFuzjr64pjBzwAihnoaTpumYg5lTZDQpSA== +xterm-addon-canvas@0.3.0-beta.27: + version "0.3.0-beta.27" + resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.3.0-beta.27.tgz#8b530a71473b2c2497e04ae27aa06aba213fef7c" + integrity sha512-8NZYm8mZXQms4aIMZFBwufakQQomnvzkwCUw3cPlJ5emErGD7OmXvV9zgJbSmhD1rnLOF5Z8AAIUqIvM3e+KUw== + +xterm-addon-search@0.11.0-beta.7: + version "0.11.0-beta.7" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0-beta.7.tgz#d90bcbe9e8f9238c18ba6145bd7ec2f8e3240052" + integrity sha512-i/c774V0/Eon3BIFRsRR3OjKTnMGkccBo12yDkOa40tnAD4aa8FjspE3bxW/Hh1mUEhCSgBSLnMDlK/GwnUC+g== + +xterm-addon-unicode11@0.5.0-beta.5: + version "0.5.0-beta.5" + resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.5.0-beta.5.tgz#6992a6f56349e67b903201d52b1ad41ba3469d93" + integrity sha512-MaqnU34WTHCUAo7moB4KhynGn03RckI0JJ8E/gXe96EzuCP6bVJIKSc5pc9iFeLF4BX1SuemOqIHYl2Q3u3NTA== + +xterm-addon-webgl@0.14.0-beta.40: + version "0.14.0-beta.40" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.14.0-beta.40.tgz#8152b293c07f921db3a7cd3c4996dfd4d90f340c" + integrity sha512-6E3KGqAFkTU6A32c6gUjkwCX+DfohN6y+j1IcTjwh5Cu92TWn4tMr5KwJlaULfmtO0e9BKZlhmucmuHTWi1F9w== + +xterm@5.1.0-beta.63: + version "5.1.0-beta.63" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.1.0-beta.63.tgz#c811680494922eab873bd36ac6fd9f5404a9e944" + integrity sha512-ar7SMARh6j3GUXb4tRgbqAO+kiNu4JTPx5FYXSDHr+HHt0jBgZ+lPh4AqIFwwG1pc90lRx2cvczpE5cJhG9sdw== diff --git a/yarn.lock b/yarn.lock index 3426ed5e9..e389ec656 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,22 +31,22 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@github1s/vscode-web@0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@github1s/vscode-web/-/vscode-web-0.6.0.tgz#14041e2e0e974588ceb4bd065ed65ac59a4a952f" - integrity sha512-VKOkYQcVr3sUh1UfG1gEyQcT0kEHYY+tXqDc8hULiz1WJT1GIYeLfw5UN9mU+NCtvEsWqXNiVulStqAJGZVAGw== +"@github1s/vscode-web@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@github1s/vscode-web/-/vscode-web-0.7.0.tgz#e094b859e1ba3c98d1e45a3a11ed3a59a1418e9b" + integrity sha512-aQkNjdoVF9dRzUdOJM4iF7aZX11eilRqm1mXQg/s1cWjl9l0qdG6PvlC0R4EZcQHP92B6s5uiHpaDdTWv0GjBQ== dependencies: "@vscode/iconv-lite-umd" "0.7.0" "@vscode/vscode-languagedetection" "1.0.21" jschardet "3.0.0" tas-client-umd "0.1.6" - vscode-oniguruma "1.6.1" + vscode-oniguruma "1.7.0" vscode-textmate "7.0.1" - xterm "5.1.0-beta.15" - xterm-addon-canvas "0.3.0-beta.1" - xterm-addon-search "0.11.0-beta.1" - xterm-addon-unicode11 "0.5.0-beta.1" - xterm-addon-webgl "0.14.0-beta.8" + xterm "5.1.0-beta.63" + xterm-addon-canvas "0.3.0-beta.27" + xterm-addon-search "0.11.0-beta.7" + xterm-addon-unicode11 "0.5.0-beta.5" + xterm-addon-webgl "0.14.0-beta.40" "@hapi/hoek@^9.0.0": version "9.3.0" @@ -3901,10 +3901,10 @@ vary@~1.1.2: resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -vscode-oniguruma@1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz#2bf4dfcfe3dd2e56eb549a3068c8ee39e6c30ce5" - integrity sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ== +vscode-oniguruma@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== vscode-textmate@7.0.1: version "7.0.1" @@ -4121,30 +4121,30 @@ ws@^8.4.2: resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.0.tgz#8e71c75e2f6348dbf8d78005107297056cb77769" integrity sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ== -xterm-addon-canvas@0.3.0-beta.1: - version "0.3.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.3.0-beta.1.tgz#17a65f5da65416b01d620ddef6247ff5013ffc15" - integrity sha512-34PKhrkvK1RtlOOmni4i5GUIyoFKGMph8fWFvA2d52IDTKmX9YoLzZfU73D/sUAx+/GKobCE8sr14CuBZctgNw== - -xterm-addon-search@0.11.0-beta.1: - version "0.11.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0-beta.1.tgz#fe7178d70246cde73550447c5524672575467499" - integrity sha512-fKj8KnnhH1nC4oZpKsgnhtgxkTctoa9kGLMpTJjsNzFu0VvXvLGIRezTPI75UEIQdEdaxcwB7/aKelQTO+72LA== - -xterm-addon-unicode11@0.5.0-beta.1: - version "0.5.0-beta.1" - resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.5.0-beta.1.tgz#8a9e9356018e082318abbe2be1f9599fcc6b46a2" - integrity sha512-uAErX4gwhW6N524stLG6oZR3yBGgPnFmZ2Tv4vyYy7tcgDuHRoc22xYSCDgO1ohz1FLlOm8JGXRjXliwO9ic3A== - -xterm-addon-webgl@0.14.0-beta.8: - version "0.14.0-beta.8" - resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.14.0-beta.8.tgz#486ae22b2eb88a12ebded366c4019ee26409cbb8" - integrity sha512-G0F70f6zGWtXuZxKiTn9BQswaVz85wcCuadnWRdPFDBlgdEfcboCvVZgQetklOIkluVpt8tYYK013/25iMRKTA== - -xterm@5.1.0-beta.15: - version "5.1.0-beta.15" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.1.0-beta.15.tgz#146b70c81fd286dbb003d18449918326fa355b6b" - integrity sha512-fO87pEPFMr+h7eo51+6+ew3OhzLm2wwSYz6w/y5lH986rD1lgAeEqFuzjr64pjBzwAihnoaTpumYg5lTZDQpSA== +xterm-addon-canvas@0.3.0-beta.27: + version "0.3.0-beta.27" + resolved "https://registry.yarnpkg.com/xterm-addon-canvas/-/xterm-addon-canvas-0.3.0-beta.27.tgz#8b530a71473b2c2497e04ae27aa06aba213fef7c" + integrity sha512-8NZYm8mZXQms4aIMZFBwufakQQomnvzkwCUw3cPlJ5emErGD7OmXvV9zgJbSmhD1rnLOF5Z8AAIUqIvM3e+KUw== + +xterm-addon-search@0.11.0-beta.7: + version "0.11.0-beta.7" + resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0-beta.7.tgz#d90bcbe9e8f9238c18ba6145bd7ec2f8e3240052" + integrity sha512-i/c774V0/Eon3BIFRsRR3OjKTnMGkccBo12yDkOa40tnAD4aa8FjspE3bxW/Hh1mUEhCSgBSLnMDlK/GwnUC+g== + +xterm-addon-unicode11@0.5.0-beta.5: + version "0.5.0-beta.5" + resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.5.0-beta.5.tgz#6992a6f56349e67b903201d52b1ad41ba3469d93" + integrity sha512-MaqnU34WTHCUAo7moB4KhynGn03RckI0JJ8E/gXe96EzuCP6bVJIKSc5pc9iFeLF4BX1SuemOqIHYl2Q3u3NTA== + +xterm-addon-webgl@0.14.0-beta.40: + version "0.14.0-beta.40" + resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.14.0-beta.40.tgz#8152b293c07f921db3a7cd3c4996dfd4d90f340c" + integrity sha512-6E3KGqAFkTU6A32c6gUjkwCX+DfohN6y+j1IcTjwh5Cu92TWn4tMr5KwJlaULfmtO0e9BKZlhmucmuHTWi1F9w== + +xterm@5.1.0-beta.63: + version "5.1.0-beta.63" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.1.0-beta.63.tgz#c811680494922eab873bd36ac6fd9f5404a9e944" + integrity sha512-ar7SMARh6j3GUXb4tRgbqAO+kiNu4JTPx5FYXSDHr+HHt0jBgZ+lPh4AqIFwwG1pc90lRx2cvczpE5cJhG9sdw== y18n@^5.0.5: version "5.0.8" From b1fab6d9c13a07e5fe5b7180d63156d58f6068e3 Mon Sep 17 00:00:00 2001 From: netcon Date: Fri, 20 Jan 2023 02:30:11 +0800 Subject: [PATCH 08/10] feat: add github link to trending page (#474) --- .../github1s/src/adapters/ossinsight/templates.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extensions/github1s/src/adapters/ossinsight/templates.ts b/extensions/github1s/src/adapters/ossinsight/templates.ts index 0d04181f3..5b4bf4cd3 100644 --- a/extensions/github1s/src/adapters/ossinsight/templates.ts +++ b/extensions/github1s/src/adapters/ossinsight/templates.ts @@ -27,16 +27,16 @@ const createRepoItemMarkdown = (repo: RepoItem, period: RankingPeriod) => { return `[${username}](https://github.com/${username})`; }); const repoBadges = [ - `![Language](https://img.shields.io/github/languages/top/${repo.repo_name})`, - `![Watch](https://img.shields.io/github/watchers/${repo.repo_name}?label=Watch)`, - `![Fork](https://img.shields.io/github/forks/${repo.repo_name}?label=Fork)`, - `![Star](https://img.shields.io/github/stars/${repo.repo_name}?label=Star)`, - `![LastCommit](https://img.shields.io/github/last-commit/${repo.repo_name})`, + `[![Language](https://img.shields.io/github/languages/top/${repo.repo_name})](https://github.com/${repo.repo_name})`, + `[![Watch](https://img.shields.io/github/watchers/${repo.repo_name}?label=Watch)](https://github.com/${repo.repo_name}/watchers)`, + `[![Fork](https://img.shields.io/github/forks/${repo.repo_name}?label=Fork)](https://github.com/${repo.repo_name}/forks)`, + `[![Star](https://img.shields.io/github/stars/${repo.repo_name}?label=Star)](https://github.com/${repo.repo_name}/stargazers)`, + `[![LastCommit](https://img.shields.io/github/last-commit/${repo.repo_name})](https://github.com/${repo.repo_name}/commits)`, ]; const increaseStarsText = (repo.stars || 0) >= 0 ? `+${repo.stars || 0}` : `-${repo.stars}`; const increaseForksText = (repo.forks || 0) >= 0 ? `+${repo.forks || 0}` : `-${repo.forks}`; - const contributorsMardown = contributorAvatars.length + const contributorsMarkdown = contributorAvatars.length ? '    Built by  ' + contributorAvatars.join('  ') : ''; const collectionMarkdown = repo.collection_names ? `    ${repo.collection_names}` : ''; @@ -47,7 +47,7 @@ const createRepoItemMarkdown = (repo: RepoItem, period: RankingPeriod) => { ${repo.description || ''} -⭐️ ${increaseStarsText}    🔗 ${increaseForksText} ${contributorsMardown}${collectionMarkdown} +⭐️ ${increaseStarsText}    🔗 ${increaseForksText} ${contributorsMarkdown}${collectionMarkdown} ${repoBadges.join(' ')} `; From 07a5ca32c91fc5d8010a7f4ed4d4e59be3d4554a Mon Sep 17 00:00:00 2001 From: netcon Date: Fri, 20 Jan 2023 02:31:08 +0800 Subject: [PATCH 09/10] fix: vscode-unpkg crashed (#473) --- api/tsconfig.json | 1 + api/vscode-unpkg/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 api/tsconfig.json diff --git a/api/tsconfig.json b/api/tsconfig.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/api/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/api/vscode-unpkg/index.ts b/api/vscode-unpkg/index.ts index 4bee2a184..213b69efc 100644 --- a/api/vscode-unpkg/index.ts +++ b/api/vscode-unpkg/index.ts @@ -7,7 +7,7 @@ import got from 'got'; import * as url from 'url'; import type { VercelRequest, VercelResponse } from '@vercel/node'; -module.exports = async (req: VercelRequest, res: VercelResponse) => { +export default async (req: VercelRequest, res: VercelResponse) => { const pathname = url.parse(req.url || '').pathname || ''; const matches = pathname.match(/^\/api\/vscode-unpkg\/([^/]+)\/(.*)/); From 042eb4a4255d7d622c8f0b1e4ac066a0354e3dbe Mon Sep 17 00:00:00 2001 From: netcon Date: Fri, 20 Jan 2023 02:33:23 +0800 Subject: [PATCH 10/10] fix: quick diff in commit/codereview pages (#475) --- .../src/adapters/github1s/parse-path.ts | 2 +- extensions/github1s/src/changes/index.ts | 4 +- extensions/github1s/src/changes/quick-diff.ts | 45 +++++++++++-------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/extensions/github1s/src/adapters/github1s/parse-path.ts b/extensions/github1s/src/adapters/github1s/parse-path.ts index f6f71dced..0a7ad4d32 100644 --- a/extensions/github1s/src/adapters/github1s/parse-path.ts +++ b/extensions/github1s/src/adapters/github1s/parse-path.ts @@ -77,7 +77,7 @@ const parsePullUrl = async (path: string): Promise => { return { repo: `${owner}/${repo}`, pageType: PageType.CodeReview, - ref: codeReview.base.commitSha, + ref: codeReview.head.commitSha, codeReviewId, }; }; diff --git a/extensions/github1s/src/changes/index.ts b/extensions/github1s/src/changes/index.ts index b5acc7d48..8847d5b5e 100644 --- a/extensions/github1s/src/changes/index.ts +++ b/extensions/github1s/src/changes/index.ts @@ -7,9 +7,11 @@ import * as vscode from 'vscode'; import * as adapterTypes from '@/adapters/types'; import { GitHub1sQuickDiffProvider } from './quick-diff'; import { getChangedFileDiffCommand, getChangedFiles } from './files'; +import adapterManager from '@/adapters/manager'; export const updateSourceControlChanges = (() => { - const sourceControl = vscode.scm.createSourceControl('github1s', 'GitHub1s'); + const rootUri = vscode.Uri.parse('').with({ scheme: adapterManager.getCurrentScheme() }); + const sourceControl = vscode.scm.createSourceControl('github1s', 'GitHub1s', rootUri); const changesGroup = sourceControl.createResourceGroup('changes', 'Changes'); sourceControl.quickDiffProvider = new GitHub1sQuickDiffProvider(); diff --git a/extensions/github1s/src/changes/quick-diff.ts b/extensions/github1s/src/changes/quick-diff.ts index 78e6c7219..654f57755 100644 --- a/extensions/github1s/src/changes/quick-diff.ts +++ b/extensions/github1s/src/changes/quick-diff.ts @@ -5,6 +5,7 @@ import * as vscode from 'vscode'; import router from '@/router'; +import { Repository } from '@/repository'; import { emptyFileUri } from '@/providers'; import adapterManager from '@/adapters/manager'; import * as adapterTypes from '@/adapters/types'; @@ -12,17 +13,22 @@ import * as adapterTypes from '@/adapters/types'; // get the original source uri when the `routerState.pageType` is `PageType.PULL` const getOriginalResourceForPull = async (uri: vscode.Uri, codeReviewId: string): Promise => { const routeState = await router.getState(); - const dataSource = await adapterManager.getCurrentAdapter().resolveDataSource(); - const codeReview = await dataSource.provideCodeReview(routeState.repo, codeReviewId); - const changedFile = codeReview?.files?.find((changedFile) => changedFile.path === uri.path.slice(1)); - - // TODO: why removed - if (!changedFile || changedFile.status === adapterTypes.FileChangeStatus.Removed) { + const currentScheme = adapterManager.getCurrentScheme(); + const repository = Repository.getInstance(currentScheme, routeState.repo); + const codeReviewFiles = await repository.getCodeReviewChangedFiles(codeReviewId); + const changedFile = codeReviewFiles?.find((changedFile) => changedFile.path === uri.path.slice(1)); + + if ( + !changedFile || + changedFile.status === adapterTypes.FileChangeStatus.Added || + changedFile.status === adapterTypes.FileChangeStatus.Removed + ) { return null; } - if (changedFile.status === adapterTypes.FileChangeStatus.Added) { - return emptyFileUri; + const codeReview = await repository.getCodeReviewItem(codeReviewId); + if (!codeReview?.base?.commitSha) { + return null; } const originalAuthority = `${routeState.repo}+${codeReview!.base.commitSha}`; @@ -34,20 +40,21 @@ const getOriginalResourceForPull = async (uri: vscode.Uri, codeReviewId: string) // get the original source uri when the `routerState.pageType` is `PageType.COMMIT` const getOriginalResourceForCommit = async (uri: vscode.Uri, commitSha: string) => { const routeState = await router.getState(); - const dataSource = await adapterManager.getCurrentAdapter().resolveDataSource(); - const commit = await dataSource.provideCommit(routeState.repo, commitSha); - const changedFile = commit?.files?.find((changedFile) => changedFile.path === uri.path.slice(1)); - - if (!changedFile || changedFile.status === adapterTypes.FileChangeStatus.Removed) { + const currentScheme = adapterManager.getCurrentScheme(); + const repository = Repository.getInstance(currentScheme, routeState.repo); + const commitFiles = await repository.getCommitChangedFiles(commitSha); + const changedFile = commitFiles?.find((changedFile) => changedFile.path === uri.path.slice(1)); + + if ( + !changedFile || + changedFile.status === adapterTypes.FileChangeStatus.Added || + changedFile.status === adapterTypes.FileChangeStatus.Removed + ) { return null; } - if (changedFile.status === adapterTypes.FileChangeStatus.Added) { - return emptyFileUri; - } - - const parentCommitSha = commit!.parents?.[0] || 'HEAD'; - + const commit = await repository.getCommitItem(commitSha); + const parentCommitSha = commit?.parents?.[0]; if (!parentCommitSha) { return emptyFileUri; }