Export RequestCancellerFactory implementations as constants
This commit is contained in:
parent
538ff07c71
commit
8bf2ae16a0
4 changed files with 19 additions and 11 deletions
|
@ -11,7 +11,7 @@ import { LanguageConfigurationManager } from './features/languageConfiguration';
|
||||||
import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost';
|
import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost';
|
||||||
import { CommandManager } from './utils/commandManager';
|
import { CommandManager } from './utils/commandManager';
|
||||||
import { PluginManager } from './utils/plugins';
|
import { PluginManager } from './utils/plugins';
|
||||||
import { noopRequestCanceller } from './tsServer/cancellation';
|
import { noopRequestCancellerFactory } from './tsServer/cancellation';
|
||||||
|
|
||||||
export function activate(
|
export function activate(
|
||||||
context: vscode.ExtensionContext
|
context: vscode.ExtensionContext
|
||||||
|
@ -25,10 +25,7 @@ export function activate(
|
||||||
const onCompletionAccepted = new vscode.EventEmitter<vscode.CompletionItem>();
|
const onCompletionAccepted = new vscode.EventEmitter<vscode.CompletionItem>();
|
||||||
context.subscriptions.push(onCompletionAccepted);
|
context.subscriptions.push(onCompletionAccepted);
|
||||||
|
|
||||||
const lazyClientHost = createLazyClientHost(context, pluginManager, commandManager, noopLogDirectoryProvider, {
|
const lazyClientHost = createLazyClientHost(context, pluginManager, commandManager, noopLogDirectoryProvider, noopRequestCancellerFactory, item => {
|
||||||
create: () => noopRequestCanceller
|
|
||||||
|
|
||||||
}, item => {
|
|
||||||
onCompletionAccepted.fire(item);
|
onCompletionAccepted.fire(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { registerCommands } from './commands/index';
|
||||||
import { LanguageConfigurationManager } from './features/languageConfiguration';
|
import { LanguageConfigurationManager } from './features/languageConfiguration';
|
||||||
import * as task from './features/task';
|
import * as task from './features/task';
|
||||||
import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost';
|
import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost';
|
||||||
import { NodeRequestCanceller } from './tsServer/cancellation.electron';
|
import { nodeRequestCancellerFactory } from './tsServer/cancellation.electron';
|
||||||
import { CommandManager } from './utils/commandManager';
|
import { CommandManager } from './utils/commandManager';
|
||||||
import * as electron from './utils/electron';
|
import * as electron from './utils/electron';
|
||||||
import { PluginManager } from './utils/plugins';
|
import { PluginManager } from './utils/plugins';
|
||||||
|
@ -30,9 +30,7 @@ export function activate(
|
||||||
|
|
||||||
const logDirectoryProvider = new NodeLogDirectoryProvider(context);
|
const logDirectoryProvider = new NodeLogDirectoryProvider(context);
|
||||||
|
|
||||||
const lazyClientHost = createLazyClientHost(context, pluginManager, commandManager, logDirectoryProvider, {
|
const lazyClientHost = createLazyClientHost(context, pluginManager, commandManager, logDirectoryProvider, nodeRequestCancellerFactory, item => {
|
||||||
create: (kind, tracer) => new NodeRequestCanceller(kind, tracer)
|
|
||||||
}, item => {
|
|
||||||
onCompletionAccepted.fire(item);
|
onCompletionAccepted.fire(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { OngoingRequestCanceller } from './cancellation';
|
import { OngoingRequestCanceller, OngoingRequestCancellerFactory } from './cancellation';
|
||||||
import { getTempFile } from '../utils/electron';
|
import { getTempFile } from '../utils/electron';
|
||||||
import Tracer from '../utils/tracer';
|
import Tracer from '../utils/tracer';
|
||||||
|
|
||||||
|
@ -31,3 +31,10 @@ export class NodeRequestCanceller implements OngoingRequestCanceller {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const nodeRequestCancellerFactory = new class implements OngoingRequestCancellerFactory {
|
||||||
|
create(serverId: string, tracer: Tracer): OngoingRequestCanceller {
|
||||||
|
return new NodeRequestCanceller(serverId, tracer);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -14,10 +14,16 @@ export interface OngoingRequestCancellerFactory {
|
||||||
create(serverId: string, tracer: Tracer): OngoingRequestCanceller;
|
create(serverId: string, tracer: Tracer): OngoingRequestCanceller;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const noopRequestCanceller = new class implements OngoingRequestCanceller {
|
const noopRequestCanceller = new class implements OngoingRequestCanceller {
|
||||||
public readonly cancellationPipeName = undefined;
|
public readonly cancellationPipeName = undefined;
|
||||||
|
|
||||||
public tryCancelOngoingRequest(_seq: number): boolean {
|
public tryCancelOngoingRequest(_seq: number): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const noopRequestCancellerFactory = new class implements OngoingRequestCancellerFactory {
|
||||||
|
create(_serverId: string, _tracer: Tracer): OngoingRequestCanceller {
|
||||||
|
return noopRequestCanceller;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue