Skip to content

Commit 3483750

Browse files
committed
debt - More precise typings
1 parent 6cb2531 commit 3483750

19 files changed

Lines changed: 67 additions & 68 deletions

src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
3636
this._configurationListener.dispose();
3737
}
3838

39-
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resourceUriComponenets: UriComponents): TPromise<void> {
39+
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resourceUriComponenets: UriComponents): Thenable<void> {
4040
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
4141
return this.writeConfiguration(target, key, value, resource);
4242
}
4343

44-
$removeConfigurationOption(target: ConfigurationTarget, key: string, resourceUriComponenets: UriComponents): TPromise<void> {
44+
$removeConfigurationOption(target: ConfigurationTarget, key: string, resourceUriComponenets: UriComponents): Thenable<void> {
4545
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
4646
return this.writeConfiguration(target, key, undefined, resource);
4747
}

src/vs/workbench/api/electron-browser/mainThreadDebugService.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
7979
this._toDispose = dispose(this._toDispose);
8080
}
8181

82-
public $startBreakpointEvents(): TPromise<any> {
82+
public $startBreakpointEvents(): Thenable<void> {
8383

8484
if (!this._breakpointEventsActive) {
8585
this._breakpointEventsActive = true;
@@ -118,7 +118,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
118118
return TPromise.wrap<void>(undefined);
119119
}
120120

121-
public $registerBreakpoints(DTOs: (ISourceMultiBreakpointDto | IFunctionBreakpointDto)[]): TPromise<void> {
121+
public $registerBreakpoints(DTOs: (ISourceMultiBreakpointDto | IFunctionBreakpointDto)[]): Thenable<void> {
122122

123123
for (let dto of DTOs) {
124124
if (dto.type === 'sourceMulti') {
@@ -141,7 +141,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
141141
return void 0;
142142
}
143143

144-
public $unregisterBreakpoints(breakpointIds: string[], functionBreakpointIds: string[]): TPromise<void> {
144+
public $unregisterBreakpoints(breakpointIds: string[], functionBreakpointIds: string[]): Thenable<void> {
145145
breakpointIds.forEach(id => this.debugService.removeBreakpoints(id));
146146
functionBreakpointIds.forEach(id => this.debugService.removeFunctionBreakpoints(id));
147147
return void 0;
@@ -177,7 +177,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
177177
});
178178
}
179179

180-
public $registerDebugConfigurationProvider(debugType: string, hasProvide: boolean, hasResolve: boolean, hasDebugAdapterExecutable: boolean, handle: number): TPromise<void> {
180+
public $registerDebugConfigurationProvider(debugType: string, hasProvide: boolean, hasResolve: boolean, hasDebugAdapterExecutable: boolean, handle: number): Thenable<void> {
181181

182182
const provider = <IDebugConfigurationProvider>{
183183
type: debugType
@@ -202,12 +202,12 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
202202
return TPromise.wrap<void>(undefined);
203203
}
204204

205-
public $unregisterDebugConfigurationProvider(handle: number): TPromise<any> {
205+
public $unregisterDebugConfigurationProvider(handle: number): Thenable<void> {
206206
this.debugService.getConfigurationManager().unregisterDebugConfigurationProvider(handle);
207207
return TPromise.wrap<void>(undefined);
208208
}
209209

210-
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig): TPromise<boolean> {
210+
public $startDebugging(_folderUri: uri | undefined, nameOrConfiguration: string | IConfig): Thenable<boolean> {
211211
const folderUri = _folderUri ? uri.revive(_folderUri) : undefined;
212212
const launch = this.debugService.getConfigurationManager().getLaunch(folderUri);
213213
return this.debugService.startDebugging(launch, nameOrConfiguration).then(x => {
@@ -217,7 +217,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
217217
});
218218
}
219219

220-
public $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: any): TPromise<any> {
220+
public $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: any): Thenable<any> {
221221
const session = this.debugService.getSession(sessionId);
222222
if (session) {
223223
return session.raw.custom(request, args).then(response => {
@@ -231,7 +231,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
231231
return TPromise.wrapError(new Error('debug session not found'));
232232
}
233233

234-
public $appendDebugConsole(value: string): TPromise<any> {
234+
public $appendDebugConsole(value: string): Thenable<void> {
235235
// Use warning as severity to get the orange color for messages coming from the debug extension
236236
this.debugService.logToRepl(value, severity.Warning);
237237
return TPromise.wrap<void>(undefined);

src/vs/workbench/api/electron-browser/mainThreadDocuments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
169169

170170
// --- from extension host process
171171

172-
$trySaveDocument(uri: UriComponents): TPromise<boolean> {
172+
$trySaveDocument(uri: UriComponents): Thenable<boolean> {
173173
return this._textFileService.save(URI.revive(uri));
174174
}
175175

176-
$tryOpenDocument(_uri: UriComponents): TPromise<any> {
176+
$tryOpenDocument(_uri: UriComponents): Thenable<any> {
177177
const uri = URI.revive(_uri);
178178
if (!uri.scheme || !(uri.fsPath || uri.authority)) {
179179
return TPromise.wrapError(new Error(`Invalid uri. Scheme and authority or path must be set.`));
@@ -203,7 +203,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
203203
});
204204
}
205205

206-
$tryCreateDocument(options?: { language?: string, content?: string }): TPromise<URI> {
206+
$tryCreateDocument(options?: { language?: string, content?: string }): Thenable<URI> {
207207
return this._doCreateUntitled(void 0, options ? options.language : void 0, options ? options.content : void 0);
208208
}
209209

src/vs/workbench/api/electron-browser/mainThreadEditors.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
115115

116116
// --- from extension host process
117117

118-
$tryShowTextDocument(resource: UriComponents, options: ITextDocumentShowOptions): TPromise<string> {
118+
$tryShowTextDocument(resource: UriComponents, options: ITextDocumentShowOptions): Thenable<string> {
119119
const uri = URI.revive(resource);
120120

121121
const editorOptions: ITextEditorOptions = {
@@ -137,7 +137,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
137137
});
138138
}
139139

140-
$tryShowEditor(id: string, position?: EditorViewColumn): TPromise<void> {
140+
$tryShowEditor(id: string, position?: EditorViewColumn): Thenable<void> {
141141
let mainThreadEditor = this._documentsAndEditors.getEditor(id);
142142
if (mainThreadEditor) {
143143
let model = mainThreadEditor.getModel();
@@ -149,7 +149,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
149149
return undefined;
150150
}
151151

152-
$tryHideEditor(id: string): TPromise<void> {
152+
$tryHideEditor(id: string): Thenable<void> {
153153
let mainThreadEditor = this._documentsAndEditors.getEditor(id);
154154
if (mainThreadEditor) {
155155
let editors = this._editorService.visibleControls;
@@ -162,15 +162,15 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
162162
return undefined;
163163
}
164164

165-
$trySetSelections(id: string, selections: ISelection[]): TPromise<void> {
165+
$trySetSelections(id: string, selections: ISelection[]): Thenable<void> {
166166
if (!this._documentsAndEditors.getEditor(id)) {
167167
return TPromise.wrapError(disposed(`TextEditor(${id})`));
168168
}
169169
this._documentsAndEditors.getEditor(id).setSelections(selections);
170170
return TPromise.as(null);
171171
}
172172

173-
$trySetDecorations(id: string, key: string, ranges: IDecorationOptions[]): TPromise<void> {
173+
$trySetDecorations(id: string, key: string, ranges: IDecorationOptions[]): Thenable<void> {
174174
key = `${this._instanceId}-${key}`;
175175
if (!this._documentsAndEditors.getEditor(id)) {
176176
return TPromise.wrapError(disposed(`TextEditor(${id})`));
@@ -179,7 +179,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
179179
return TPromise.as(null);
180180
}
181181

182-
$trySetDecorationsFast(id: string, key: string, ranges: number[]): TPromise<void> {
182+
$trySetDecorationsFast(id: string, key: string, ranges: number[]): Thenable<void> {
183183
key = `${this._instanceId}-${key}`;
184184
if (!this._documentsAndEditors.getEditor(id)) {
185185
return TPromise.wrapError(disposed(`TextEditor(${id})`));
@@ -188,35 +188,35 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
188188
return TPromise.as(null);
189189
}
190190

191-
$tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): TPromise<void> {
191+
$tryRevealRange(id: string, range: IRange, revealType: TextEditorRevealType): Thenable<void> {
192192
if (!this._documentsAndEditors.getEditor(id)) {
193193
return TPromise.wrapError(disposed(`TextEditor(${id})`));
194194
}
195195
this._documentsAndEditors.getEditor(id).revealRange(range, revealType);
196196
return undefined;
197197
}
198198

199-
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<void> {
199+
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): Thenable<void> {
200200
if (!this._documentsAndEditors.getEditor(id)) {
201201
return TPromise.wrapError(disposed(`TextEditor(${id})`));
202202
}
203203
this._documentsAndEditors.getEditor(id).setConfiguration(options);
204204
return TPromise.as(null);
205205
}
206206

207-
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): TPromise<boolean> {
207+
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleEditOperation[], opts: IApplyEditsOptions): Thenable<boolean> {
208208
if (!this._documentsAndEditors.getEditor(id)) {
209209
return TPromise.wrapError<boolean>(disposed(`TextEditor(${id})`));
210210
}
211211
return TPromise.as(this._documentsAndEditors.getEditor(id).applyEdits(modelVersionId, edits, opts));
212212
}
213213

214-
$tryApplyWorkspaceEdit(dto: WorkspaceEditDto): TPromise<boolean> {
214+
$tryApplyWorkspaceEdit(dto: WorkspaceEditDto): Thenable<boolean> {
215215
const { edits } = reviveWorkspaceEditDto(dto);
216216
return this._bulkEditService.apply({ edits }, undefined).then(() => true, err => false);
217217
}
218218

219-
$tryInsertSnippet(id: string, template: string, ranges: IRange[], opts: IUndoStopOptions): TPromise<boolean> {
219+
$tryInsertSnippet(id: string, template: string, ranges: IRange[], opts: IUndoStopOptions): Thenable<boolean> {
220220
if (!this._documentsAndEditors.getEditor(id)) {
221221
return TPromise.wrapError<boolean>(disposed(`TextEditor(${id})`));
222222
}
@@ -235,7 +235,7 @@ export class MainThreadTextEditors implements MainThreadTextEditorsShape {
235235
this._codeEditorService.removeDecorationType(key);
236236
}
237237

238-
$getDiffInformation(id: string): TPromise<ILineChange[]> {
238+
$getDiffInformation(id: string): Thenable<ILineChange[]> {
239239
const editor = this._documentsAndEditors.getEditor(id);
240240

241241
if (!editor) {

src/vs/workbench/api/electron-browser/mainThreadLanguages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export class MainThreadLanguages implements MainThreadLanguagesShape {
2929
public dispose(): void {
3030
}
3131

32-
$getLanguages(): TPromise<string[]> {
32+
$getLanguages(): Thenable<string[]> {
3333
return TPromise.as(this._modeService.getRegisteredModes());
3434
}
3535

36-
$changeLanguage(resource: UriComponents, languageId: string): TPromise<void> {
36+
$changeLanguage(resource: UriComponents, languageId: string): Thenable<void> {
3737
const uri = URI.revive(resource);
3838
let model = this._modelService.getModel(uri);
3939
if (!model) {

src/vs/workbench/api/electron-browser/mainThreadOutputService.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,37 @@ export class MainThreadOutputService implements MainThreadOutputServiceShape {
3737
// Leave all the existing channels intact (e.g. might help with troubleshooting)
3838
}
3939

40-
public $register(label: string, file?: UriComponents): TPromise<string> {
40+
public $register(label: string, file?: UriComponents): Thenable<string> {
4141
const id = 'extension-output-#' + (MainThreadOutputService._idPool++);
4242
Registry.as<IOutputChannelRegistry>(Extensions.OutputChannels).registerChannel({ id, label, file: file ? URI.revive(file) : null, log: false });
4343
return TPromise.as(id);
4444
}
4545

46-
public $append(channelId: string, value: string): TPromise<void> {
46+
public $append(channelId: string, value: string): Thenable<void> {
4747
const channel = this._getChannel(channelId);
4848
if (channel) {
4949
channel.append(value);
5050
}
5151
return undefined;
5252
}
5353

54-
public $clear(channelId: string): TPromise<void> {
54+
public $clear(channelId: string): Thenable<void> {
5555
const channel = this._getChannel(channelId);
5656
if (channel) {
5757
channel.clear();
5858
}
5959
return undefined;
6060
}
6161

62-
public $reveal(channelId: string, preserveFocus: boolean): TPromise<void> {
62+
public $reveal(channelId: string, preserveFocus: boolean): Thenable<void> {
6363
const channel = this._getChannel(channelId);
6464
if (channel) {
6565
this._outputService.showChannel(channel.id, preserveFocus);
6666
}
6767
return undefined;
6868
}
6969

70-
public $close(channelId: string): TPromise<void> {
70+
public $close(channelId: string): Thenable<void> {
7171
const panel = this._panelService.getActivePanel();
7272
if (panel && panel.getId() === OUTPUT_PANEL_ID && channelId === this._outputService.getActiveChannel().id) {
7373
return this._partService.setPanelHidden(true);
@@ -76,7 +76,7 @@ export class MainThreadOutputService implements MainThreadOutputServiceShape {
7676
return undefined;
7777
}
7878

79-
public $dispose(channelId: string): TPromise<void> {
79+
public $dispose(channelId: string): Thenable<void> {
8080
const channel = this._getChannel(channelId);
8181
if (channel) {
8282
channel.dispose();

src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
3939
public dispose(): void {
4040
}
4141

42-
$show(options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): TPromise<number | number[]> {
42+
$show(options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): Thenable<number | number[]> {
4343
const myToken = ++this._token;
4444

4545
this._contents = new TPromise<TransferQuickPickItems[]>((c, e) => {
@@ -82,14 +82,14 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
8282
}
8383
}
8484

85-
$setItems(items: TransferQuickPickItems[]): TPromise<any> {
85+
$setItems(items: TransferQuickPickItems[]): Thenable<void> {
8686
if (this._doSetItems) {
8787
this._doSetItems(items);
8888
}
8989
return undefined;
9090
}
9191

92-
$setError(error: Error): TPromise<any> {
92+
$setError(error: Error): Thenable<void> {
9393
if (this._doSetError) {
9494
this._doSetError(error);
9595
}
@@ -123,7 +123,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
123123

124124
private sessions = new Map<number, QuickInputSession>();
125125

126-
$createOrUpdate(params: TransferQuickInput): TPromise<void> {
126+
$createOrUpdate(params: TransferQuickInput): Thenable<void> {
127127
const sessionId = params.id;
128128
let session = this.sessions.get(sessionId);
129129
if (!session) {
@@ -215,7 +215,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
215215
return TPromise.as(undefined);
216216
}
217217

218-
$dispose(sessionId: number): TPromise<void> {
218+
$dispose(sessionId: number): Thenable<void> {
219219
const session = this.sessions.get(sessionId);
220220
if (session) {
221221
session.input.dispose();

src/vs/workbench/api/electron-browser/mainThreadStorage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class MainThreadStorage implements MainThreadStorageShape {
2424
dispose(): void {
2525
}
2626

27-
$getValue<T>(shared: boolean, key: string): TPromise<T> {
27+
$getValue<T>(shared: boolean, key: string): Thenable<T> {
2828
let jsonValue = this._storageService.get(key, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
2929
if (!jsonValue) {
3030
return TPromise.as(undefined);
@@ -38,7 +38,7 @@ export class MainThreadStorage implements MainThreadStorageShape {
3838
}
3939
}
4040

41-
$setValue(shared: boolean, key: string, value: any): TPromise<void> {
41+
$setValue(shared: boolean, key: string, value: any): Thenable<void> {
4242
let jsonValue: any;
4343
try {
4444
jsonValue = JSON.stringify(value);

src/vs/workbench/api/electron-browser/mainThreadTask.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export class MainThreadTask implements MainThreadTaskShape {
393393
this._activeHandles = Object.create(null);
394394
}
395395

396-
public $registerTaskProvider(handle: number): TPromise<void> {
396+
public $registerTaskProvider(handle: number): Thenable<void> {
397397
this._taskService.registerTaskProvider(handle, {
398398
provideTasks: (validTypes: IStringDictionary<boolean>) => {
399399
return this._proxy.$provideTasks(handle, validTypes).then((value) => {
@@ -423,13 +423,13 @@ export class MainThreadTask implements MainThreadTaskShape {
423423
return TPromise.wrap<void>(undefined);
424424
}
425425

426-
public $unregisterTaskProvider(handle: number): TPromise<void> {
426+
public $unregisterTaskProvider(handle: number): Thenable<void> {
427427
this._taskService.unregisterTaskProvider(handle);
428428
delete this._activeHandles[handle];
429429
return TPromise.wrap<void>(undefined);
430430
}
431431

432-
public $fetchTasks(filter?: TaskFilterDTO): TPromise<TaskDTO[]> {
432+
public $fetchTasks(filter?: TaskFilterDTO): Thenable<TaskDTO[]> {
433433
return this._taskService.tasks(TaskFilterDTO.to(filter)).then((tasks) => {
434434
let result: TaskDTO[] = [];
435435
for (let task of tasks) {
@@ -442,7 +442,7 @@ export class MainThreadTask implements MainThreadTaskShape {
442442
});
443443
}
444444

445-
public $executeTask(value: TaskHandleDTO | TaskDTO): TPromise<TaskExecutionDTO> {
445+
public $executeTask(value: TaskHandleDTO | TaskDTO): Thenable<TaskExecutionDTO> {
446446
return new TPromise<TaskExecutionDTO>((resolve, reject) => {
447447
if (TaskHandleDTO.is(value)) {
448448
let workspaceFolder = this._workspaceContextServer.getWorkspaceFolder(URI.revive(value.workspaceFolder));
@@ -468,7 +468,7 @@ export class MainThreadTask implements MainThreadTaskShape {
468468
});
469469
}
470470

471-
public $terminateTask(id: string): TPromise<void> {
471+
public $terminateTask(id: string): Thenable<void> {
472472
return new TPromise<void>((resolve, reject) => {
473473
this._taskService.getActiveTasks().then((tasks) => {
474474
for (let task of tasks) {

src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
5454
// when the extension host process goes down ?
5555
}
5656

57-
public $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string, env?: { [key: string]: string }, waitOnExit?: boolean): TPromise<number> {
57+
public $createTerminal(name?: string, shellPath?: string, shellArgs?: string[], cwd?: string, env?: { [key: string]: string }, waitOnExit?: boolean): Thenable<number> {
5858
const shellLaunchConfig: IShellLaunchConfig = {
5959
name,
6060
executable: shellPath,
@@ -67,7 +67,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
6767
return TPromise.as(this.terminalService.createTerminal(shellLaunchConfig).id);
6868
}
6969

70-
public $createTerminalRenderer(name: string): TPromise<number> {
70+
public $createTerminalRenderer(name: string): Thenable<number> {
7171
const instance = this.terminalService.createTerminalRenderer(name);
7272
return TPromise.as(instance.id);
7373
}

0 commit comments

Comments
 (0)