Skip to content

Commit

Permalink
Javascript mode instantiated twice, issue microsoft#34
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Nov 17, 2015
1 parent a4bfcb8 commit df35236
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/vs/editor/common/services/modeServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,17 @@ export class ModeServiceImpl implements IModeService {
if (this._activationPromises.hasOwnProperty(modeId)) {
return this._activationPromises[modeId];
}

this._activationPromises[modeId] = this._createMode(modeId).then((mode) => {
var c, e;
var promise = new TPromise((cc,ee,pp) => { c = cc; e = ee; });
this._activationPromises[modeId] = promise;

this._createMode(modeId).then((mode) => {
this._instantiatedModes[modeId] = mode;
delete this._activationPromises[modeId];
return this._instantiatedModes[modeId];
});
return this._activationPromises[modeId];
}).then(c, e);

return promise;
}

protected _createMode(modeId:string): TPromise<Modes.IMode> {
Expand Down

0 comments on commit df35236

Please sign in to comment.