Skip to content

Commit

Permalink
monaco-editor-core-publish: downgrading from es6 to es5 compilation
Browse files Browse the repository at this point in the history
Changes that were done to successfully compile to es5:
1. change in tsconfig.monaco.json
2. Replacing private identifiers as are not available for es5 and lower.
3. Replacing function declaration as is not allowed inside block in strict mode es5

Signed-off-by: Dan Arad <dan.arad@sap.com>
  • Loading branch information
danarad05 committed Mar 31, 2021
1 parent 5848012 commit 07fb6e1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/tsconfig.monaco.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"moduleResolution": "classic",
"removeComments": false,
"preserveConstEnums": true,
"target": "es6",
"target": "es5",
"downlevelIteration": true,
"sourceMap": false,
"declaration": true
},
Expand Down
10 changes: 5 additions & 5 deletions src/vs/editor/contrib/codeAction/codeActionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class CodeActionModel extends Disposable {
private readonly _onDidChangeState = this._register(new Emitter<CodeActionsState.State>());
public readonly onDidChangeState = this._onDidChangeState.event;

#isDisposed = false;
private isDisposed = false;

constructor(
private readonly _editor: ICodeEditor,
Expand All @@ -208,17 +208,17 @@ export class CodeActionModel extends Disposable {
}

dispose(): void {
if (this.#isDisposed) {
if (this.isDisposed) {
return;
}
this.#isDisposed = true;
this.isDisposed = true;

super.dispose();
this.setState(CodeActionsState.Empty, true);
}

private _update(): void {
if (this.#isDisposed) {
if (this.isDisposed) {
return;
}

Expand Down Expand Up @@ -278,7 +278,7 @@ export class CodeActionModel extends Disposable {

this._state = newState;

if (!skipNotify && !this.#isDisposed) {
if (!skipNotify && !this.isDisposed) {
this._onDidChangeState.fire(newState);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/codeAction/codeActionUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CodeActionUi extends Disposable {
private readonly _lightBulbWidget: Lazy<LightBulbWidget>;
private readonly _activeCodeActions = this._register(new MutableDisposable<CodeActionSet>());

#disposed = false;
private disposed = false;

constructor(
private readonly _editor: ICodeEditor,
Expand Down Expand Up @@ -53,7 +53,7 @@ export class CodeActionUi extends Disposable {
}

dispose() {
this.#disposed = true;
this.disposed = true;
super.dispose();
}

Expand All @@ -71,7 +71,7 @@ export class CodeActionUi extends Disposable {
return;
}

if (this.#disposed) {
if (this.disposed) {
return;
}

Expand Down
19 changes: 11 additions & 8 deletions src/vs/editor/contrib/quickAccess/gotoSymbolQuickAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,13 @@ export abstract class AbstractGotoSymbolQuickAccessProvider extends AbstractEdit
let lastSeparator: IQuickPickSeparator | undefined = undefined;
let lastSymbolKindCounter = 0;

function updateLastSeparatorLabel(): void {
if (lastSeparator && typeof lastSymbolKind === 'number' && lastSymbolKindCounter > 0) {
lastSeparator.label = format(NLS_SYMBOL_KIND_CACHE[lastSymbolKind] || FALLBACK_NLS_SYMBOL_KIND, lastSymbolKindCounter);
}
}

for (const symbolPick of sortedFilteredSymbolPicks) {

// Found new kind
if (lastSymbolKind !== symbolPick.kind) {

// Update last separator with number of symbols we found for kind
updateLastSeparatorLabel();
this.updateLastSeparatorLabel(lastSeparator, lastSymbolKind, lastSymbolKindCounter);

lastSymbolKind = symbolPick.kind;
lastSymbolKindCounter = 1;
Expand All @@ -369,7 +363,8 @@ export abstract class AbstractGotoSymbolQuickAccessProvider extends AbstractEdit
}

// Update last separator with number of symbols we found for kind
updateLastSeparatorLabel();
this.updateLastSeparatorLabel(lastSeparator, lastSymbolKind, lastSymbolKindCounter);

} else if (sortedFilteredSymbolPicks.length > 0) {
symbolPicks = [
{ label: localize('symbols', "symbols ({0})", filteredSymbolPicks.length), type: 'separator' },
Expand All @@ -380,6 +375,14 @@ export abstract class AbstractGotoSymbolQuickAccessProvider extends AbstractEdit
return symbolPicks;
}

private updateLastSeparatorLabel(lastSeparator: IQuickPickSeparator | undefined = undefined,
lastSymbolKind: SymbolKind | undefined = undefined,
lastSymbolKindCounter = 0): void {
if (lastSeparator && typeof lastSymbolKind === 'number' && lastSymbolKindCounter > 0) {
lastSeparator.label = format(NLS_SYMBOL_KIND_CACHE[lastSymbolKind] || FALLBACK_NLS_SYMBOL_KIND, lastSymbolKindCounter);
}
}

private compareByScore(symbolA: IGotoSymbolQuickPickItem, symbolB: IGotoSymbolQuickPickItem): number {
if (typeof symbolA.score !== 'number' && typeof symbolB.score === 'number') {
return 1;
Expand Down

0 comments on commit 07fb6e1

Please sign in to comment.