|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
2 | 2 | // Licensed under the MIT License.
|
3 | 3 |
|
4 |
| -import { Disposable, EventEmitter, Event, Uri } from 'vscode'; |
| 4 | +import { Disposable, EventEmitter, Event, Uri, workspace } from 'vscode'; |
5 | 5 | import * as ch from 'child_process';
|
6 | 6 | import * as path from 'path';
|
7 | 7 | import * as rpc from 'vscode-jsonrpc/node';
|
@@ -113,20 +113,9 @@ class NativeGlobalPythonFinderImpl extends DisposableBase implements NativeGloba
|
113 | 113 | connection.onNotification('environment', (data: NativeEnvInfo) => {
|
114 | 114 | discovered.fire(data);
|
115 | 115 | }),
|
116 |
| - // eslint-disable-next-line @typescript-eslint/no-explicit-any |
117 |
| - connection.onNotification((method: string, data: any) => { |
118 |
| - console.log(method, data); |
119 |
| - }), |
120 |
| - connection.onNotification('exit', (time: number) => { |
121 |
| - traceInfo(`Native Python Finder completed after ${time}ms`); |
122 |
| - disposeStreams.dispose(); |
123 |
| - completed.resolve(); |
124 |
| - }), |
125 |
| - // eslint-disable-next-line @typescript-eslint/no-explicit-any |
126 |
| - connection.onRequest((method: string, args: any) => { |
127 |
| - console.error(method, args); |
128 |
| - return 'HELLO THERE'; |
129 |
| - }), |
| 116 | + // connection.onNotification((method: string, data: any) => { |
| 117 | + // console.log(method, data); |
| 118 | + // }), |
130 | 119 | connection.onNotification('log', (data: NativeLog) => {
|
131 | 120 | switch (data.level) {
|
132 | 121 | case 'info':
|
@@ -163,10 +152,17 @@ class NativeGlobalPythonFinderImpl extends DisposableBase implements NativeGloba
|
163 | 152 | );
|
164 | 153 |
|
165 | 154 | connection.listen();
|
166 |
| - connection.sendRequest('initialize', { body: ['This is id', 'Another'], supported: true }).then((r) => { |
167 |
| - console.error(r); |
168 |
| - void connection.sendNotification('initialized'); |
169 |
| - }); |
| 155 | + connection |
| 156 | + .sendRequest<number>('refresh', { |
| 157 | + // Send configuration information to the Python finder. |
| 158 | + search_paths: (workspace.workspaceFolders || []).map((w) => w.uri.fsPath), |
| 159 | + conda_executable: undefined, |
| 160 | + }) |
| 161 | + .then((durationInMilliSeconds: number) => { |
| 162 | + completed.resolve(); |
| 163 | + traceInfo(`Native Python Finder took ${durationInMilliSeconds}ms to complete.`); |
| 164 | + }) |
| 165 | + .catch((ex) => traceError('Error in Native Python Finder', ex)); |
170 | 166 |
|
171 | 167 | return { completed: completed.promise, discovered: discovered.event };
|
172 | 168 | }
|
|
0 commit comments