| 52 | private _initializeTask: Promise<void> | undefined; |
| 53 | |
| 54 | public async start(cwd: string, args: string[], launchTarget: LaunchTarget, launchPath: string): Promise<void> { |
| 55 | const configuration = await configure( |
| 56 | cwd, |
| 57 | ['-lsp', '--encoding', 'ascii'].concat(args), |
| 58 | launchPath, |
| 59 | this.platformInfo, |
| 60 | this.monoResolver, |
| 61 | this.dotnetResolver |
| 62 | ); |
| 63 | const serverOptions: ServerOptions = { |
| 64 | run: { |
| 65 | command: configuration.path, |
| 66 | args: configuration.args, |
| 67 | options: { |
| 68 | cwd: configuration.cwd, |
| 69 | env: configuration.env, |
| 70 | }, |
| 71 | }, |
| 72 | debug: { |
| 73 | command: configuration.path, |
| 74 | args: configuration.args, //.concat('-d'), |
| 75 | options: { |
| 76 | cwd, |
| 77 | env: configuration.env, |
| 78 | }, |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | const languageMiddlewareFeature = this.languageMiddlewareFeature; |
| 83 | |
| 84 | const clientOptions: LanguageClientOptions = { |
| 85 | // errorHandler: { |
| 86 | // error(error, message, count) { |
| 87 | // return ErrorAction.Continue; |
| 88 | // }, |
| 89 | // closed() { |
| 90 | // return CloseAction.Restart; |
| 91 | // } |
| 92 | // }, |
| 93 | diagnosticCollectionName: 'csharp', |
| 94 | progressOnInitialization: true, |
| 95 | outputChannel: this.outputChannel, |
| 96 | synchronize: { |
| 97 | configurationSection: 'csharp', |
| 98 | }, |
| 99 | middleware: { |
| 100 | async provideDefinition(document, position, token, next) { |
| 101 | const result = await next(document, position, token); |
| 102 | if (!result) { |
| 103 | return result; |
| 104 | } |
| 105 | |
| 106 | // Needs Metadata document support |
| 107 | return languageMiddlewareFeature.remap( |
| 108 | 'remapLocations', |
| 109 | !Array.isArray(result) ? [result] : result, |
| 110 | token |
| 111 | ); |