mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from master
This commit is contained in:
@@ -3,35 +3,24 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IRawSearchService, IRawSearch, ISerializedSearchComplete, ISerializedSearchProgressItem, ITelemetryEvent } from './search';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IRawFileQuery, IRawTextQuery } from 'vs/platform/search/common/search';
|
||||
import { IRawSearchService, ISerializedSearchComplete, ISerializedSearchProgressItem } from './search';
|
||||
|
||||
export interface ISearchChannel extends IChannel {
|
||||
listen(event: 'telemetry'): Event<ITelemetryEvent>;
|
||||
listen(event: 'fileSearch', search: IRawSearch): Event<ISerializedSearchProgressItem | ISerializedSearchComplete>;
|
||||
listen(event: 'textSearch', search: IRawSearch): Event<ISerializedSearchProgressItem | ISerializedSearchComplete>;
|
||||
call(command: 'clearCache', cacheKey: string): TPromise<void>;
|
||||
call(command: string, arg: any): TPromise<any>;
|
||||
}
|
||||
|
||||
export class SearchChannel implements ISearchChannel {
|
||||
export class SearchChannel implements IServerChannel {
|
||||
|
||||
constructor(private service: IRawSearchService) { }
|
||||
|
||||
listen<T>(event: string, arg?: any): Event<any> {
|
||||
listen<T>(_, event: string, arg?: any): Event<any> {
|
||||
switch (event) {
|
||||
case 'telemetry': return this.service.onTelemetry;
|
||||
case 'fileSearch': return this.service.fileSearch(arg);
|
||||
case 'textSearch': return this.service.textSearch(arg);
|
||||
}
|
||||
throw new Error('Event not found');
|
||||
}
|
||||
|
||||
call(command: string, arg?: any): TPromise<any> {
|
||||
call(_, command: string, arg?: any): Thenable<any> {
|
||||
switch (command) {
|
||||
case 'clearCache': return this.service.clearCache(arg);
|
||||
}
|
||||
@@ -41,19 +30,17 @@ export class SearchChannel implements ISearchChannel {
|
||||
|
||||
export class SearchChannelClient implements IRawSearchService {
|
||||
|
||||
get onTelemetry(): Event<ITelemetryEvent> { return this.channel.listen('telemetry'); }
|
||||
constructor(private channel: IChannel) { }
|
||||
|
||||
constructor(private channel: ISearchChannel) { }
|
||||
|
||||
fileSearch(search: IRawSearch): Event<ISerializedSearchProgressItem | ISerializedSearchComplete> {
|
||||
fileSearch(search: IRawFileQuery): Event<ISerializedSearchProgressItem | ISerializedSearchComplete> {
|
||||
return this.channel.listen('fileSearch', search);
|
||||
}
|
||||
|
||||
textSearch(search: IRawSearch): Event<ISerializedSearchProgressItem | ISerializedSearchComplete> {
|
||||
textSearch(search: IRawTextQuery): Event<ISerializedSearchProgressItem | ISerializedSearchComplete> {
|
||||
return this.channel.listen('textSearch', search);
|
||||
}
|
||||
|
||||
clearCache(cacheKey: string): TPromise<void> {
|
||||
clearCache(cacheKey: string): Thenable<void> {
|
||||
return this.channel.call('clearCache', cacheKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user