mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Further reduce usage of IThreadService
This commit is contained in:
@@ -9,7 +9,6 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { sequence } from 'vs/base/common/async';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService';
|
||||
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
|
||||
import { ISaveParticipant, ITextFileEditorModel, SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -22,8 +21,9 @@ import { getDocumentFormattingEdits } from 'vs/editor/contrib/format/common/form
|
||||
import { EditOperationsCommand } from 'vs/editor/contrib/format/common/formatCommand';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { ExtHostContext, ExtHostDocumentSaveParticipantShape } from '../node/extHost.protocol';
|
||||
import { ExtHostContext, ExtHostDocumentSaveParticipantShape, IExtHostContext } from '../node/extHost.protocol';
|
||||
import { EditOperation } from 'vs/editor/common/core/editOperation';
|
||||
import { extHostCustomer } from "vs/workbench/api/electron-browser/extHostCustomers";
|
||||
|
||||
export interface INamedSaveParticpant extends ISaveParticipant {
|
||||
readonly name: string;
|
||||
@@ -200,8 +200,8 @@ class ExtHostSaveParticipant implements INamedSaveParticpant {
|
||||
|
||||
readonly name = 'ExtHostSaveParticipant';
|
||||
|
||||
constructor( @IThreadService threadService: IThreadService) {
|
||||
this._proxy = threadService.get(ExtHostContext.ExtHostDocumentSaveParticipant);
|
||||
constructor(extHostContext: IExtHostContext) {
|
||||
this._proxy = extHostContext.get(ExtHostContext.ExtHostDocumentSaveParticipant);
|
||||
}
|
||||
|
||||
participate(editorModel: ITextFileEditorModel, env: { reason: SaveReason }): TPromise<void> {
|
||||
@@ -220,21 +220,24 @@ class ExtHostSaveParticipant implements INamedSaveParticpant {
|
||||
}
|
||||
|
||||
// The save participant can change a model before its saved to support various scenarios like trimming trailing whitespace
|
||||
@extHostCustomer
|
||||
export class SaveParticipant implements ISaveParticipant {
|
||||
|
||||
private _saveParticipants: INamedSaveParticpant[];
|
||||
|
||||
constructor(
|
||||
@IThreadService threadService: IThreadService,
|
||||
extHostContext: IExtHostContext,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService
|
||||
) {
|
||||
|
||||
this._saveParticipants = [
|
||||
instantiationService.createInstance(TrimWhitespaceParticipant),
|
||||
instantiationService.createInstance(FormatOnSaveParticipant),
|
||||
instantiationService.createInstance(FinalNewLineParticipant),
|
||||
instantiationService.createInstance(ExtHostSaveParticipant)
|
||||
new TrimWhitespaceParticipant(configurationService, codeEditorService),
|
||||
new FormatOnSaveParticipant(codeEditorService, configurationService),
|
||||
new FinalNewLineParticipant(configurationService, codeEditorService),
|
||||
new ExtHostSaveParticipant(extHostContext)
|
||||
];
|
||||
|
||||
// Hook into model
|
||||
|
||||
Reference in New Issue
Block a user