Skip to content
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

Upgrade to Monaco 0.20.0 #8010

Merged
merged 8 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/api-tests/src/saveable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('Saveable', function () {

const toTearDown = new DisposableCollection();

/** @type {string | undefined} */
const autoSave = preferences.get('editor.autoSave', undefined, rootUri.toString());

beforeEach(async () => {
Expand Down
9 changes: 7 additions & 2 deletions examples/api-tests/src/typescript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('TypeScript', function () {
const { ProgressStatusBarItem } = require('@theia/core/lib/browser/progress-status-bar-item');
const { FileService } = require('@theia/filesystem/lib/browser/file-service');
const { PluginViewRegistry } = require('@theia/plugin-ext/lib/main/browser/view/plugin-view-registry');
const { Deferred } = require('@theia/core/lib/common/promise-util');

const container = window.theia.container;
const editorManager = container.get(EditorManager);
Expand Down Expand Up @@ -504,7 +505,7 @@ module.exports = (port, host, argv) => Promise.resolve()
assert.isTrue(contextKeyService.match('editorTextFocus'));
assert.isFalse(contextKeyService.match('renameInputVisible'));

const renaming = commands.executeCommand('editor.action.rename');
commands.executeCommand('editor.action.rename');
await waitForAnimation(() => contextKeyService.match('renameInputVisible')
&& document.activeElement instanceof HTMLInputElement
&& document.activeElement.selectionEnd === 'container'.length);
Expand All @@ -520,7 +521,11 @@ module.exports = (port, host, argv) => Promise.resolve()
input.value = 'foo';
keybindings.dispatchKeyDown('Enter', input);

await renaming;
// all rename edits should be grouped in one edit operation and applied in the same tick
const waitForApplyRenameEdits = new Deferred();
editor.getControl().onDidChangeModelContent(waitForApplyRenameEdits.resolve);
await waitForApplyRenameEdits.promise;

assert.isTrue(contextKeyService.match('editorTextFocus'));
assert.isFalse(contextKeyService.match('renameInputVisible'));

Expand Down
9 changes: 5 additions & 4 deletions packages/console/src/browser/console-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ export class ConsoleWidget extends BaseWidget implements StatefulWidget {
this.toDispose.push(input);
this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent()));

// todo update font if fontInfo was changed only
// it's impossible at the moment, but will be fixed for next upgrade of monaco version
// see https://github.com/microsoft/vscode/commit/5084e8ca1935698c98c163e339ca664818786c6d
this.toDispose.push(input.getControl().onDidChangeConfiguration(() => this.updateFont()));
this.toDispose.push(input.getControl().onDidChangeConfiguration(event => {
if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) {
this.updateFont();
}
}));

this.updateFont();
if (inputFocusContextKey) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"reflect-metadata": "^0.1.10",
"route-parser": "^0.0.5",
"safer-buffer": "^2.1.2",
"vscode-languageserver-protocol": "^3.15.0-next.8",
"vscode-languageserver-types": "^3.15.0-next",
"vscode-languageserver-types": "^3.15.1",
"vscode-languageserver-protocol": "^3.15.3",
"vscode-uri": "^2.1.1",
"vscode-ws-jsonrpc": "^0.2.0",
"ws": "^7.1.2",
Expand Down Expand Up @@ -107,4 +107,4 @@
"nyc": {
"extends": "../../configs/nyc.json"
}
}
}
2 changes: 1 addition & 1 deletion packages/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@theia/userstorage": "^1.4.0",
"@theia/variable-resolver": "^1.4.0",
"@theia/workspace": "^1.4.0",
"jsonc-parser": "^2.0.2",
"jsonc-parser": "^2.2.0",
"mkdirp": "^0.5.0",
"p-debounce": "^2.1.0",
"requestretry": "^3.1.0",
Expand Down
60 changes: 53 additions & 7 deletions packages/editor/src/browser/editor-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const platform = {
isLinux: OS.type() === OS.Type.Linux
};

// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/editorOptions.ts#L2974
// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/editorOptions.ts#L3042
export const EDITOR_FONT_DEFAULTS = {
fontFamily: (
isOSX ? DEFAULT_MAC_FONT_FAMILY : (isWindows ? DEFAULT_WINDOWS_FONT_FAMILY : DEFAULT_LINUX_FONT_FAMILY)
Expand All @@ -48,7 +48,7 @@ export const EDITOR_FONT_DEFAULTS = {
letterSpacing: 0,
};

// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/editorOptions.ts#L2989
// should be in sync with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/editorOptions.ts#L3057
export const EDITOR_MODEL_DEFAULTS = {
tabSize: 4,
indentSize: 4,
Expand All @@ -62,11 +62,11 @@ export const EDITOR_MODEL_DEFAULTS = {

/* eslint-disable max-len */
// should be in sync with:
// 1. https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L442
// 2. https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L526
// 1. https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L441
// 2. https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L530

// 1. Copy from https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L526
// 2. Align first items with https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/config/commonEditorConfig.ts#L442
// 1. Copy from https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L530
// 2. Align first items with https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/editor/common/config/commonEditorConfig.ts#L441
// 3. Find -> Use Regular Expressions to clean up data and replace " by ', for example -> nls\.localize\(.*, "(.*)"\) -> "$1"
// 4. Apply `quotemark` quick fixes
// 5. Fix the rest manually
Expand Down Expand Up @@ -102,6 +102,11 @@ const codeEditorPreferenceProperties = {
'default': true,
'description': 'Controls whether completions should be computed based on words in the document.'
},
'editor.semanticHighlighting.enabled': {
'type': 'boolean',
'default': false,
'description': 'Controls whether the semanticHighlighting is shown for the languages that support it.'
},
'editor.stablePeek': {
'type': 'boolean',
'default': false,
Expand Down Expand Up @@ -269,6 +274,11 @@ const codeEditorPreferenceProperties = {
'type': 'boolean',
'default': true
},
'editor.comments.insertSpace': {
'type': 'boolean',
'default': true,
'description': 'Controls whether a space character is inserted when commenting.'
},
'editor.copyWithSyntaxHighlighting': {
'description': 'Controls whether syntax highlighting should be copied into the clipboard.',
'type': 'boolean',
Expand Down Expand Up @@ -391,6 +401,11 @@ const codeEditorPreferenceProperties = {
],
'default': 'auto'
},
'editor.foldingHighlight': {
'description': 'Controls whether the editor should highlight folded ranges.',
'type': 'boolean',
'default': true
},
'editor.fontFamily': {
'description': 'Controls the font family.',
'type': 'string',
Expand Down Expand Up @@ -730,6 +745,19 @@ const codeEditorPreferenceProperties = {
'default': false,
'description': 'Controls whether the parameter hints menu cycles or closes when reaching the end of the list.'
},
'editor.peekWidgetDefaultFocus': {
'enumDescriptions': [
'Focus the tree when opening peek',
'Focus the editor when opening peek'
],
'description': 'Controls whether to focus the inline editor or the tree in the peek widget.',
'type': 'string',
'enum': [
'tree',
'editor'
],
'default': 'tree'
},
'editor.quickSuggestions': {
'anyOf': [
{
Expand Down Expand Up @@ -927,7 +955,7 @@ const codeEditorPreferenceProperties = {
'editor.suggest.snippetsPreventQuickSuggestions': {
'type': 'boolean',
'default': true,
'description': 'Control whether an active snippet prevents quick suggestions.'
'description': 'Controls whether an active snippet prevents quick suggestions.'
},
'editor.suggest.showIcons': {
'type': 'boolean',
Expand Down Expand Up @@ -1076,6 +1104,11 @@ const codeEditorPreferenceProperties = {
'default': true,
'markdownDescription': 'When enabled IntelliSense shows `snippet`-suggestions.'
},
'editor.suggest.hideStatusBar': {
'type': 'boolean',
'default': true,
'markdownDescription': 'Controls the visibility of the status bar at the bottom of the suggest widget.'
},
'editor.suggestFontSize': {
'markdownDescription': 'Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.',
'type': 'integer',
Expand Down Expand Up @@ -1175,6 +1208,19 @@ const codeEditorPreferenceProperties = {
'deepIndent'
],
'default': 'same'
},
'editor.wrappingStrategy': {
'enumDescriptions': [
'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.',
'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': 'Controls the algorithm that computes wrapping points.',
'type': 'string',
'enum': [
'simple',
'advanced'
],
'default': 'simple'
}
};
/* eslint-enable max-len */
Expand Down
2 changes: 1 addition & 1 deletion packages/keymaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@types/lodash.debounce": "4.0.3",
"ajv": "^6.5.3",
"fuzzy": "^0.1.3",
"jsonc-parser": "^2.0.2",
"jsonc-parser": "^2.2.0",
"lodash.debounce": "^4.0.8"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"@theia/core": "^1.4.0",
"@theia/editor": "^1.4.0",
"@theia/filesystem": "^1.4.0",
"@theia/monaco-editor-core": "^0.19.3",
"@theia/monaco-editor-core": "^0.20.0",
"@theia/markers": "^1.4.0",
"@theia/outline-view": "^1.4.0",
"@theia/workspace": "^1.4.0",
"deepmerge": "2.0.1",
"fast-plist": "^0.1.2",
"idb": "^4.0.5",
"jsonc-parser": "^2.0.2",
"jsonc-parser": "^2.2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check with yarn why jsonc-parser that we don't have duplicates and bump up all places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, squashed to 6703948

"onigasm": "^2.2.0",
"vscode-textmate": "^4.0.1"
"vscode-textmate": "^4.4.0"
},
"publishConfig": {
"access": "public"
Expand Down
21 changes: 21 additions & 0 deletions packages/monaco/src/browser/monaco-bulk-edit-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,29 @@ export class MonacoBulkEditService implements monaco.editor.IBulkEditService {
@inject(MonacoWorkspace)
protected readonly workspace: MonacoWorkspace;

private _previewHandler?: monaco.editor.IBulkEditPreviewHandler;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know what is for and how to test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see #8010 (comment)


apply(edit: monaco.languages.WorkspaceEdit): Promise<monaco.editor.IBulkEditResult & { success: boolean }> {
return this.workspace.applyBulkEdit(edit);
}

hasPreviewHandler(): boolean {
return Boolean(this._previewHandler);
}

setPreviewHandler(handler: monaco.editor.IBulkEditPreviewHandler): monaco.IDisposable {
this._previewHandler = handler;

const disposePreviewHandler = () => {
if (this._previewHandler === handler) {
this._previewHandler = undefined;
}
};

return {
dispose(): void {
disposePreviewHandler();
}
};
}
}
Loading