-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Uplift Monaco to VSCode v. 1.65.2 #10736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
colin-grant-work
merged 78 commits into
eclipse-theia:master
from
colin-grant-work:uplift/monaco
Mar 23, 2022
Merged
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
776d3b1
Initial work (and notes)
384aedc
A few more errors. StaticServices -> StandalonServices (in some cases)
afe9249
Finished mechanical replacements. Next come real problems
120be6c
Fixed a lot of substantive type issues, many remain
7ff3aef
A bit of progress, but the quick input stuff is thorny
d46d532
bit of copy-editing
cf535a8
Moving very slowly on quick picks
e0d5699
Lots of private API digging...
ac95f1c
The quick inputs are still very ugly
98eba70
New to do list
3663468
new todo list...
66033fa
only plugins left
14ee47f
It compiles!
e19bb17
builds and sort of runs
f59a8e0
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
73cc441
Maybe better initialization
d5c414a
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
ac7ea46
at least I'm sure I can get rid of these
b601596
update journal
59dfeeb
Accept default color values
de01a6f
fix quick command access
cec5696
support old style of service override, but with a typed alternative
f9cba84
editor configuration
c0b539d
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
d1b500e
finish up preference work
1272687
really only one bug left?
8aef00e
revert overzealous find and replace
6e41007
good lead re: colorization for Monday
3d5177c
fix handling of tokenization on startup
e4065df
make the API tests work
03014b1
Deciding which version to target will be tricky
42f546c
Encapsulate Electron Window Logic - Allow Exit during Load (#10600)
be0867a
Add extensions example (#10774)
thegecko fffb53c
Frontend use of Uri.joinPath with path-browserify (#10745)
thegecko 1c470b1
debug: fix `debuggingForeground` theming (#10760)
vince-fugnitto 1e5610f
core: update default loading animation
vince-fugnitto 305d80b
Fix starting pseudoterminal (#10780)
thegecko ae29550
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
7e2b064
resolve problems with event interfaces
af50720
describe tweaks to monaco code
19dcddc
Bring in published package and lint
4ce6ade
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
2c68eb8
update preference references
6f46563
revert lint settings change
064375c
fix bulk edit test
f70fb0f
fix linux default font family
659925f
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
b93bb86
remove old monaco references from toolbar
d319f15
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
544cc40
handle toolbar storage without circular dependency
4ccac34
bring back hasNext, hasPrevious
147c23c
check on potential reversions
a7c4018
use version with src in package
2eeaf7b
TM feedback
ce6b0c2
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
72b8f18
pre-resolve conflicts
7cf0dc0
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
9a45152
Fix code lens execution
bb3bc5b
bring in better marked exports
70a23ec
delegate snapshotting
bbd1ebd
dangling import
940b705
consistent monaco imports
417aedd
revert unnecessary preference schema extension
981d472
update toggle autosave behavior
5b694aa
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
fc48e63
move preference extractor to API samples
27c9496
Cleanup
ca38cf1
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
de6a56e
Remove old `singleModifierDispatchParts`
99d773c
Use release commit from VSCode 1.65.2
efdf766
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
de41922
Skip editor save test
9e8d979
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
d49ccc1
Add CHANGELOG and Migration entries.
e2be45e
Merge branch 'master' of https://github.com/eclipse-theia/theia into …
f06530e
Use non-alpha version
5bb8504
fix a typo, get CI?
8cc952b
unfix a typo, get CI?
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
...s/api-samples/src/browser/monaco-editor-preferences/monaco-editor-preference-extractor.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| /******************************************************************************** | ||
| * Copyright (C) 2022 Ericsson and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * This Source Code may also be made available under the following Secondary | ||
| * Licenses when the conditions for such availability set forth in the Eclipse | ||
| * Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
| * with the GNU Classpath Exception which is available at | ||
| * https://www.gnu.org/software/classpath/license.html. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
| ********************************************************************************/ | ||
|
|
||
| /** | ||
| * The command contributed in this file allows us to generate a copy of the schema expected for editor preferences by Monaco, | ||
| * as well as an interface corresponding to those properties for use with our EditorPreferences PreferenceProxy. | ||
| * It examines the schemata registered with the Monaco `ConfigurationRegistry` and writes any configurations associated with the editor | ||
| * to a file in the `editor` package. It also generates an interface based on the types specified in the schema. | ||
| * The only manual work required during a Monaco uplift is to run the command and then update any fields of the interface where the | ||
| * schema type is `array` or `object`, since it is tricky to extract the type details for such fields automatically. | ||
| */ | ||
| import { ConfigurationScope, Extensions, IConfigurationRegistry } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configurationRegistry'; | ||
| import { Registry } from '@theia/monaco-editor-core/esm/vs/platform/registry/common/platform'; | ||
| import { CommandContribution, CommandRegistry, MessageService } from '@theia/core'; | ||
| import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; | ||
| import { FileService } from '@theia/filesystem/lib/browser/file-service'; | ||
| import { WorkspaceService } from '@theia/workspace/lib/browser'; | ||
|
|
||
| function generateContent(properties: string, interfaceEntries: string[]): string { | ||
| return `/******************************************************************************** | ||
| * Copyright (C) 2022 Ericsson and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * This Source Code may also be made available under the following Secondary | ||
| * Licenses when the conditions for such availability set forth in the Eclipse | ||
| * Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
| * with the GNU Classpath Exception which is available at | ||
| * https://www.gnu.org/software/classpath/license.html. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
| ********************************************************************************/ | ||
|
|
||
| import { isOSX, isWindows, nls } from '@theia/core'; | ||
| import { PreferenceSchema } from '@theia/core/lib/browser'; | ||
|
|
||
| /* eslint-disable @typescript-eslint/quotes,max-len,@theia/localization-check,no-null/no-null */ | ||
|
|
||
| /** | ||
| * Please do not modify this file by hand. It should be generated automatically | ||
| * during a Monaco uplift using the command registered by monaco-editor-preference-extractor.ts | ||
| * The only manual work required is fixing preferences with type 'array' or 'object'. | ||
| */ | ||
|
|
||
| export const generatedEditorPreferenceProperties: PreferenceSchema['properties'] = ${properties}; | ||
|
|
||
| export interface GeneratedEditorPreferences { | ||
| ${interfaceEntries.join('\n ')} | ||
| } | ||
| `; | ||
| } | ||
| const deQuoteMarker = '@#@'; | ||
|
|
||
| // From src/vs/editor/common/config/editorOptions.ts | ||
| const DEFAULT_WINDOWS_FONT_FAMILY = "Consolas, \\'Courier New\\', monospace"; | ||
| const DEFAULT_MAC_FONT_FAMILY = "Menlo, Monaco, \\'Courier New\\', monospace"; | ||
| const DEFAULT_LINUX_FONT_FAMILY = "\\'Droid Sans Mono\\', \\'monospace\\', monospace"; | ||
|
|
||
| const fontFamilyText = `${deQuoteMarker}isOSX ? '${DEFAULT_MAC_FONT_FAMILY}' : isWindows ? '${DEFAULT_WINDOWS_FONT_FAMILY}' : '${DEFAULT_LINUX_FONT_FAMILY}'${deQuoteMarker}`; | ||
| const fontSizeText = `${deQuoteMarker}isOSX ? 12 : 14${deQuoteMarker}`; | ||
|
|
||
| /** | ||
| * This class is intended for use when uplifting Monaco. | ||
| */ | ||
| @injectable() | ||
| export class MonacoEditorPreferenceSchemaExtractor implements CommandContribution { | ||
| @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; | ||
| @inject(MessageService) protected readonly messageService: MessageService; | ||
| @inject(FileService) protected readonly fileService: FileService; | ||
|
|
||
| registerCommands(commands: CommandRegistry): void { | ||
| commands.registerCommand({ id: 'extract-editor-preference-schema', label: 'Extract Editor preference schema from Monaco' }, { | ||
| execute: async () => { | ||
| const roots = this.workspaceService.tryGetRoots(); | ||
| if (roots.length !== 1 || !(roots[0].resource.path.toString() ?? '').includes('theia')) { | ||
| this.messageService.warn('This command should only be executed in the Theia workspace.'); | ||
| } | ||
| const theiaRoot = roots[0]; | ||
| const fileToWrite = theiaRoot.resource.resolve('packages/editor/src/browser/editor-generated-preference-schema.ts'); | ||
| const properties = {}; | ||
| Registry.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurations().forEach(config => { | ||
| if (config.id === 'editor' && config.properties) { | ||
| Object.assign(properties, config.properties); | ||
| } | ||
| }); | ||
| this.guaranteePlatformOptions(properties); | ||
| const interfaceEntries = []; | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| for (const [name, description] of Object.entries(properties) as Array<[string, any]>) { | ||
| description.scope = this.getScope(description.scope); | ||
| delete description.defaultDefaultValue; | ||
| if (name === 'editor.fontSize') { | ||
| description.default = fontSizeText; | ||
| } else if (name === 'editor.fontFamily') { | ||
| description.default = fontFamilyText; | ||
| } | ||
| interfaceEntries.push(`'${name}': ${this.formatTypeForInterface(description.enum ?? description.type)};`); | ||
| } | ||
| const propertyList = this.deQuoteCodeSnippets(JSON.stringify(properties, (key, value) => this.withLocalization(key, value), 4)); | ||
| const content = generateContent(propertyList, interfaceEntries); | ||
| await this.fileService.write(fileToWrite, content); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| protected getScope(monacoScope: unknown): string | undefined { | ||
| switch (monacoScope) { | ||
| case ConfigurationScope.MACHINE_OVERRIDABLE: | ||
| case ConfigurationScope.WINDOW: | ||
| return 'window'; | ||
| case ConfigurationScope.RESOURCE: | ||
| return 'resource'; | ||
| case ConfigurationScope.LANGUAGE_OVERRIDABLE: | ||
| return 'language-overridable'; | ||
| case ConfigurationScope.APPLICATION: | ||
| case ConfigurationScope.MACHINE: | ||
| return 'application'; | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| protected formatTypeForInterface(jsonType: string | string[]): string { | ||
| if (Array.isArray(jsonType)) { | ||
| return jsonType.map(subtype => this.formatTypeForInterface(subtype)).join(' | '); | ||
| } | ||
| switch (jsonType) { | ||
| case 'boolean': | ||
| case 'number': | ||
| case 'string': | ||
| case 'true': | ||
| case 'false': | ||
| return jsonType; | ||
| case 'integer': | ||
| return 'number'; | ||
| case 'array': | ||
| case 'object': | ||
| // These have to be fixed manually, so we output a type that will cause a TS error. | ||
| return 'Help'; | ||
| } | ||
| // Most of the rest are string literals. | ||
| return `'${jsonType}'`; | ||
| } | ||
|
|
||
| protected withLocalization(key: string, value: unknown): unknown { | ||
| if ((key === 'description' || key === 'markdownDescription') && typeof value === 'string') { | ||
| return `nls.localizeByDefault("${value}")`; | ||
| } | ||
| if ((key === 'enumDescriptions' || key === 'markdownEnumDescriptions') && Array.isArray(value)) { | ||
| return value.map(description => `${deQuoteMarker}nls.localizeByDefault("${description}")${deQuoteMarker}`); | ||
| } | ||
| return value; | ||
| } | ||
|
|
||
| protected deQuoteCodeSnippets(stringification: string): string { | ||
| return stringification | ||
| .replace(new RegExp(`${deQuoteMarker}"|"${deQuoteMarker}`, 'g'), '') | ||
| .replace(/\\\\'/g, "\\'"); | ||
| } | ||
|
|
||
| /** | ||
| * Ensures that options that are only relevant on certain platforms are caught. | ||
| * Check for use of `platform` in src/vs/editor/common/config/editorOptions.ts | ||
| */ | ||
| protected guaranteePlatformOptions(properties: object): void { | ||
| Object.assign(properties, { | ||
| 'editor.find.globalFindClipboard': { | ||
| type: 'boolean', | ||
| default: false, | ||
| description: 'Controls whether the Find Widget should read or modify the shared find clipboard on macOS.', | ||
| included: `${deQuoteMarker}isOSX${deQuoteMarker}`, | ||
| }, | ||
| 'editor.selectionClipboard': { | ||
| type: 'boolean', | ||
| default: true, | ||
| description: 'Controls whether the Linux primary clipboard should be supported.', | ||
| included: `${deQuoteMarker}!isOSX && !isWindows${deQuoteMarker}` | ||
| } | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // Utility to assist with Monaco uplifts to generate preference schema. Not for regular use in the application. | ||
| export function bindMonacoPreferenceExtractor(bind: interfaces.Bind): void { | ||
| // bind(MonacoEditorPreferenceSchemaExtractor).toSelf().inSingletonScope(); | ||
| // bind(CommandContribution).to(MonacoEditorPreferenceSchemaExtractor); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.