提交 867bd281 编写于 作者: J Johannes Rieken

wait for extensions to be ready before loading snippets, #18407

上级 108a117b
...@@ -16,6 +16,7 @@ import lifecycle = require('vs/base/common/lifecycle'); ...@@ -16,6 +16,7 @@ import lifecycle = require('vs/base/common/lifecycle');
import { readAndRegisterSnippets } from 'vs/editor/node/textMate/TMSnippets'; import { readAndRegisterSnippets } from 'vs/editor/node/textMate/TMSnippets';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { watch, FSWatcher } from 'fs'; import { watch, FSWatcher } from 'fs';
import { IModeService } from 'vs/editor/common/services/modeService'; import { IModeService } from 'vs/editor/common/services/modeService';
...@@ -30,14 +31,16 @@ export class SnippetsTracker implements workbenchExt.IWorkbenchContribution { ...@@ -30,14 +31,16 @@ export class SnippetsTracker implements workbenchExt.IWorkbenchContribution {
constructor( constructor(
@ILifecycleService private lifecycleService: ILifecycleService, @ILifecycleService private lifecycleService: ILifecycleService,
@IModeService private modeService: IModeService, @IModeService private modeService: IModeService,
@IEnvironmentService environmentService: IEnvironmentService @IEnvironmentService environmentService: IEnvironmentService,
@IExtensionService extensionService: IExtensionService
) { ) {
this.snippetFolder = paths.join(environmentService.appSettingsHome, 'snippets'); this.snippetFolder = paths.join(environmentService.appSettingsHome, 'snippets');
this.toDispose = []; this.toDispose = [];
this.fileWatchDelayer = new async.ThrottledDelayer<void>(SnippetsTracker.FILE_WATCH_DELAY); this.fileWatchDelayer = new async.ThrottledDelayer<void>(SnippetsTracker.FILE_WATCH_DELAY);
mkdirp(this.snippetFolder) extensionService.onReady()
.then(() => mkdirp(this.snippetFolder))
.then(() => this.scanUserSnippets()) .then(() => this.scanUserSnippets())
.then(() => this.registerListeners()) .then(() => this.registerListeners())
.done(undefined, onUnexpectedError); .done(undefined, onUnexpectedError);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册