44 *--------------------------------------------------------------------------------------------*/
55
66import * as vscode from 'vscode' ;
7- import { noopLogDirectoryProvider } from './tsServer/logDirectoryProvider' ;
87import { Api , getExtensionApi } from './api' ;
9- import { registerCommands } from './commands/index' ;
10- import { LanguageConfigurationManager } from './features /languageConfiguration' ;
8+ import { registerBaseCommands } from './commands/index' ;
9+ import { LanguageConfigurationManager } from './languageFeatures /languageConfiguration' ;
1110import { createLazyClientHost , lazilyActivateClient } from './lazyClientHost' ;
11+ import { noopRequestCancellerFactory } from './tsServer/cancellation' ;
12+ import { noopLogDirectoryProvider } from './tsServer/logDirectoryProvider' ;
13+ import { ITypeScriptVersionProvider , TypeScriptVersion , TypeScriptVersionSource } from './tsServer/versionProvider' ;
14+ import { WorkerServerProcess } from './tsServer/workerServerProcess' ;
15+ import API from './utils/api' ;
1216import { CommandManager } from './utils/commandManager' ;
17+ import { TypeScriptServiceConfiguration } from './utils/configuration' ;
1318import { PluginManager } from './utils/plugins' ;
14- import { noopRequestCancellerFactory } from './tsServer/cancellation' ;
19+
20+ class StaticVersionProvider implements ITypeScriptVersionProvider {
21+
22+ constructor (
23+ private readonly _version : TypeScriptVersion
24+ ) { }
25+
26+ updateConfiguration ( _configuration : TypeScriptServiceConfiguration ) : void {
27+ // noop
28+ }
29+
30+ get defaultVersion ( ) { return this . _version ; }
31+ get bundledVersion ( ) { return this . _version ; }
32+
33+ readonly globalVersion = undefined ;
34+ readonly localVersion = undefined ;
35+ readonly localVersions = [ ] ;
36+ }
1537
1638export function activate (
1739 context : vscode . ExtensionContext
@@ -22,18 +44,33 @@ export function activate(
2244 const commandManager = new CommandManager ( ) ;
2345 context . subscriptions . push ( commandManager ) ;
2446
47+ context . subscriptions . push ( new LanguageConfigurationManager ( ) ) ;
48+
2549 const onCompletionAccepted = new vscode . EventEmitter < vscode . CompletionItem > ( ) ;
2650 context . subscriptions . push ( onCompletionAccepted ) ;
2751
28- const lazyClientHost = createLazyClientHost ( context , pluginManager , commandManager , noopLogDirectoryProvider , noopRequestCancellerFactory , item => {
52+ const versionProvider = new StaticVersionProvider (
53+ new TypeScriptVersion (
54+ TypeScriptVersionSource . Bundled ,
55+ '/builtin-extension/typescript-language-features/dist/browser/typescript-web/tsserver.js' ,
56+ API . v400 ) ) ;
57+
58+ const lazyClientHost = createLazyClientHost ( context , false , {
59+ pluginManager,
60+ commandManager,
61+ logDirectoryProvider : noopLogDirectoryProvider ,
62+ cancellerFactory : noopRequestCancellerFactory ,
63+ versionProvider,
64+ processFactory : WorkerServerProcess
65+ } , item => {
2966 onCompletionAccepted . fire ( item ) ;
3067 } ) ;
3168
32- registerCommands ( commandManager , lazyClientHost , pluginManager ) ;
69+ registerBaseCommands ( commandManager , lazyClientHost , pluginManager ) ;
70+
3371 // context.subscriptions.push(task.register(lazyClientHost.map(x => x.serviceClient)));
34- context . subscriptions . push ( new LanguageConfigurationManager ( ) ) ;
3572
36- import ( './features /tsconfig' ) . then ( module => {
73+ import ( './languageFeatures /tsconfig' ) . then ( module => {
3774 context . subscriptions . push ( module . register ( ) ) ;
3875 } ) ;
3976
0 commit comments