Skip to content

Commit

Permalink
update monaco to v0.12.0
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Tugarev <[email protected]>
  • Loading branch information
AlexTugarev committed Apr 19, 2018
1 parent c808c84 commit 04b983a
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const { mode } = yargs.option('mode', {
const development = mode === 'development';${this.ifMonaco(() => `
const monacoEditorPath = development ? '${this.resolve('monaco-editor-core', 'dev/vs')}' : '${this.resolve('monaco-editor-core', 'min/vs')}';
const monacoLanguagesPath = '${this.resolve('monaco-languages', 'release')}';
const monacoLanguagesPath = '${this.resolve('monaco-languages', 'release/min')}';
const monacoCssLanguagePath = '${this.resolve('monaco-css', 'release/min')}';
const monacoJsonLanguagePath = '${this.resolve('monaco-json', 'release/min')}';
const monacoHtmlLanguagePath = '${this.resolve('monaco-html', 'release/min')}';`)}
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/browser/editor-decorations-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export namespace EditorDecorationStyle {
const index = styleSheet.insertRule('.' + selector + '{}', 0);
const rules = styleSheet.cssRules || styleSheet.rules;
const rule = rules.item(index);
if (rule.type === CSSRule.STYLE_RULE) {
if (rule && rule.type === CSSRule.STYLE_RULE) {
const styleRule = rule as CSSStyleRule;
styleProvider(styleRule.style);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/languages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@theia/core": "^0.3.8",
"@theia/output": "^0.3.8",
"@theia/process": "^0.3.8",
"vscode-base-languageclient": "^0.0.1-alpha.3",
"vscode-base-languageclient": "^0.0.1-alpha.4",
"vscode-languageserver-protocol": "^3.6.0"
},
"publishConfig": {
Expand Down
10 changes: 5 additions & 5 deletions packages/monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"@theia/markers": "^0.3.8",
"@theia/outline-view": "^0.3.8",
"@theia/workspace": "^0.3.8",
"monaco-css": "^1.3.3",
"monaco-html": "^1.3.2",
"monaco-json": "^1.3.2",
"monaco-languageclient": "^0.4.0",
"monaco-languages": "^0.9.0"
"monaco-css": "^2.0.1",
"monaco-html": "^2.0.2",
"monaco-json": "^2.0.1",
"monaco-languageclient": "0.6.0",
"monaco-languages": "^1.0.4"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export namespace MonacoCommands {
iconClasses.set(menuItem.command.id, menuItem.command.iconClass);
}
}
for (const command of monaco.editorCommonExtensions.CommonEditorRegistry.getEditorActions()) {
for (const command of monaco.editorExtensions.EditorExtensionsRegistry.getEditorActions()) {
const id = command.id;
if (!EXCLUDE_ACTIONS.has(id)) {
const label = command.label;
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-diff-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MonacoDiffEditor extends MonacoEditor {
}

isActionSupported(id: string): boolean {
const action = this._diffEditor.getActions().find(a => a.id === id);
const action = this._diffEditor.getSupportedActions().find(a => a.id === id);
return !!action && action.isSupported() && super.isActionSupported(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class MonacoDiffNavigatorFactory {
const navigator = monaco.editor.createDiffNavigator(editor, options);
const ensureInitialized = (fwd: boolean) => {
if (navigator.nextIdx < -1) {
navigator.initIdx(fwd);
navigator._initIdx(fwd);
}
};
return <DiffNavigator>{
Expand Down
6 changes: 3 additions & 3 deletions packages/monaco/src/browser/monaco-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ export class MonacoEditor implements TextEditor, IEditorReference {
return this.onSelectionChangedEmitter.event;
}

revealPosition(raw: Position, options: RevealPositionOptions = { vertical: 'center', horizontal: true }): void {
revealPosition(raw: Position, options: RevealPositionOptions = { vertical: 'center' }): void {
const position = this.p2m.asPosition(raw);
switch (options.vertical) {
case 'auto':
this.editor.revealPosition(position, false, options.horizontal);
this.editor.revealPosition(position);
break;
case 'center':
this.editor.revealPosition(position, true, options.horizontal);
this.editor.revealPositionInCenter(position);
break;
case 'centerIfOutsideViewport':
this.editor.revealPositionInCenterIfOutsideViewport(position);
Expand Down
14 changes: 7 additions & 7 deletions packages/monaco/src/browser/monaco-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function loadMonaco(vsRequire: any): Promise<void> {
return new Promise<void>(resolve => {
vsRequire(["vs/editor/editor.main"], () => {
vsRequire([
'vs/basic-languages/src/monaco.contribution',
'vs/basic-languages/monaco.contribution',
'vs/language/css/monaco.contribution',
'vs/language/html/monaco.contribution',
'vs/language/json/monaco.contribution',
Expand All @@ -45,7 +45,7 @@ export function loadMonaco(vsRequire: any): Promise<void> {
'vs/platform/keybinding/common/keybindingResolver',
'vs/platform/keybinding/common/usLayoutResolvedKeybinding',
'vs/base/common/keyCodes',
'vs/editor/common/editorCommonExtensions',
'vs/editor/browser/editorExtensions',
'vs/editor/standalone/browser/simpleServices',
'vs/editor/standalone/browser/standaloneServices',
'vs/base/parts/quickopen/common/quickOpen',
Expand All @@ -56,11 +56,11 @@ export function loadMonaco(vsRequire: any): Promise<void> {
'vs/base/common/platform',
'vs/editor/common/modes',
'vs/base/common/cancellation',
'vs/editor/contrib/suggest/browser/suggestController',
'vs/editor/contrib/find/common/findController',
'vs/editor/contrib/rename/browser/rename',
'vs/editor/contrib/suggest/suggestController',
'vs/editor/contrib/find/findController',
'vs/editor/contrib/rename/rename',
], (basic: any, css: any, html: any, json: any, commands: any, actions: any, registry: any, resolver: any, resolvedKeybinding: any,
keyCodes: any, editorCommonExtensions: any, simpleServices: any, standaloneServices: any, quickOpen: any, quickOpenWidget: any, quickOpenModel: any,
keyCodes: any, editorExtensions: any, simpleServices: any, standaloneServices: any, quickOpen: any, quickOpenWidget: any, quickOpenModel: any,
filters: any, styler: any, platform: any, modes: any, cancellation: any, suggestController: any, findController: any, rename: any) => {
const global: any = self;
global.monaco.commands = commands;
Expand All @@ -71,7 +71,7 @@ export function loadMonaco(vsRequire: any): Promise<void> {
global.monaco.filters = filters;
global.monaco.theme = styler;
global.monaco.platform = platform;
global.monaco.editorCommonExtensions = editorCommonExtensions;
global.monaco.editorExtensions = editorExtensions;
global.monaco.modes = modes;
global.monaco.cancellation = cancellation;
global.monaco.suggestController = suggestController;
Expand Down
9 changes: 5 additions & 4 deletions packages/monaco/src/browser/monaco-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class MonacoWorkspace implements lang.Workspace {
identifier: undefined!,
forceMoveMarkers: false,
range: new monaco.Range(edit.range.startLineNumber, edit.range.startColumn, edit.range.endLineNumber, edit.range.endColumn),
text: edit.newText
text: edit.text
}));
// start a fresh operation
model.pushStackElement();
Expand All @@ -226,11 +226,12 @@ export class MonacoWorkspace implements lang.Workspace {
}

protected groupEdits(workspaceEdit: monaco.languages.WorkspaceEdit) {
const result = new Map<string, monaco.languages.IResourceEdit[]>();
const result = new Map<string, monaco.languages.TextEdit[]>();
for (const edit of workspaceEdit.edits) {
const uri = edit.resource.toString();
const resourceTextEdit = edit as monaco.languages.ResourceTextEdit;
const uri = resourceTextEdit.resource.toString();
const edits = result.get(uri) || [];
edits.push(edit);
edits.push(...resourceTextEdit.edits);
result.set(uri, edits);
}
return result;
Expand Down
16 changes: 10 additions & 6 deletions packages/monaco/src/typings/monaco/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ declare module monaco.instantiation {
}
}

declare module monaco.editor {
declare namespace monaco.editor {

export interface IDiffNavigator {
readonly ranges: IDiffRange[];
readonly nextIdx: number;
initIdx(fwd: boolean): void;
readonly revealFirst: boolean;
_initIdx(fwd: boolean): void;
}

export interface IDiffRange {
readonly range: Range;
}

export interface ICommonCodeEditor {
export interface IStandaloneCodeEditor extends CommonCodeEditor {
}

export interface CommonCodeEditor {
readonly _commandService: monaco.commands.ICommandService;
readonly _instantiationService: monaco.instantiation.IInstantiationService;
readonly _contributions: {
Expand Down Expand Up @@ -62,7 +66,7 @@ declare module monaco.editor {
}

export interface IEditorReference {
getControl(): monaco.editor.ICommonCodeEditor;
getControl(): monaco.editor.CommonCodeEditor;
}

export interface IEditorInput {
Expand Down Expand Up @@ -547,15 +551,15 @@ declare module monaco.filters {
export function matchesFuzzy(word: string, wordToMatchAgainst: string, enableSeparateSubstringMatching?: boolean): IMatch[] | undefined;
}

declare module monaco.editorCommonExtensions {
declare module monaco.editorExtensions {

export interface EditorAction {
id: string;
label: string;
alias: string;
}

export module CommonEditorRegistry {
export module EditorExtensionsRegistry {
export function getEditorActions(): EditorAction[];
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@theia/core": "^0.3.8",
"@theia/languages": "^0.3.8",
"@theia/monaco": "^0.3.8",
"monaco-typescript": "^2.3.0",
"monaco-typescript": "^3.0.2",
"typescript-language-server": "^0.1.9"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit 04b983a

Please sign in to comment.