@@ -18,10 +18,12 @@ import assert from 'assert';
1818import { platform } from 'os' ;
1919import * as path from 'path' ;
2020import * as vscode from 'vscode' ;
21- import { ExecuteCommandRequest , LanguageClient } from 'vscode-languageclient/node' ;
21+ import { CancellationError , CancellationToken , DocumentSymbol , SymbolKind } from 'vscode' ;
22+ import { LanguageClient } from 'vscode-languageclient/node' ;
2223import winston from 'winston' ;
24+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25+ import { ExtensionState } from './ExtensionState' ;
2326import { adaExtState , logger } from './extension' ;
24- import { DocumentSymbol , SymbolKind , CancellationToken , CancellationError } from 'vscode' ;
2527
2628/**
2729 * Substitue any variable reference present in the given string. VS Code
@@ -244,21 +246,16 @@ export function logErrorAndThrow(msg: string, logger: winston.Logger) {
244246*/
245247
246248/**
247- * Get the project file from the workspace configuration if available, or from
248- * the ALS if not.
249+ * Get the project file from the ALS.
249250 *
250- * @param client - the client to send the request to. If not provided, the main
251+ * @param _client - the client to send the request to. If not provided, the main
251252 * Ada client of the extension is used.
252253 * @returns the full path of the currently loaded project file
254+ * @deprecated in favor of {@link ExtensionState.getProjectFile}
253255 */
254- export async function getProjectFile ( client ?: LanguageClient ) : Promise < string > {
255- if ( ! client ) {
256- client = adaExtState . adaClient ;
257- }
258- const result : string = ( await client . sendRequest ( ExecuteCommandRequest . type , {
259- command : 'als-project-file' ,
260- } ) ) as string ;
261- return result ;
256+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
257+ export async function getProjectFile ( _client ?: LanguageClient ) : Promise < string > {
258+ return adaExtState . getProjectFile ( ) ;
262259}
263260
264261/**
@@ -273,39 +270,33 @@ export async function getProjectFileRelPath(): Promise<string> {
273270 * Get the Object Directory path
274271 * @param client - the client to send the request to
275272 * @returns a string path
273+ * @deprecated in favor of {@link ExtensionState.getObjectDir}
276274 */
277- export async function getObjectDir ( client : LanguageClient ) : Promise < string > {
278- const result : string = ( await client . sendRequest ( ExecuteCommandRequest . type , {
279- command : 'als-object-dir' ,
280- } ) ) as string ;
281- return result ;
275+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
276+ export async function getObjectDir ( _client ?: LanguageClient ) : Promise < string > {
277+ return adaExtState . getObjectDir ( ) ;
282278}
283279
284280/**
285281 * Get the mains in the project
286282 * @param client - the client to send the request to
287283 * @returns an array of full paths to the main sources
284+ * @deprecated in favor of {@link ExtensionState.getMains}
288285 */
289- export async function getMains ( client ?: LanguageClient ) : Promise < string [ ] > {
290- if ( ! client ) {
291- client = adaExtState . adaClient ;
292- }
293- const result : string [ ] = ( await client . sendRequest ( ExecuteCommandRequest . type , {
294- command : 'als-mains' ,
295- } ) ) as string [ ] ;
296- return result ;
286+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
287+ export async function getMains ( _client ?: LanguageClient ) : Promise < string [ ] > {
288+ return adaExtState . getMains ( ) ;
297289}
298290
299291/**
300292 * Get the executables in the project
301293 * @param client - the client to send the request to
302294 * @returns a vector of string paths
295+ * @deprecated in favor of {@link ExtensionState.getExecutables}
303296 */
304- export async function getExecutables ( client : LanguageClient ) : Promise < string [ ] > {
305- const result : string [ ] = ( await client . sendRequest ( ExecuteCommandRequest . type , {
306- command : 'als-executables' ,
307- } ) ) as string [ ] ;
308- return result ;
297+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
298+ export async function getExecutables ( _client : LanguageClient ) : Promise < string [ ] > {
299+ return adaExtState . getExecutables ( ) ;
309300}
310301
311302/**
0 commit comments