Skip to content

Commit 14d2fed

Browse files
committed
Add progress message that the GHC version is being calculated
1 parent c96c1ce commit 14d2fed

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/hlsBinaries.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as fs from 'fs';
55
import * as https from 'https';
66
import * as path from 'path';
77
import * as url from 'url';
8-
import { ExtensionContext, Uri, window, workspace, WorkspaceFolder } from 'vscode';
8+
import { ExtensionContext, ProgressLocation, Uri, window, workspace, WorkspaceFolder } from 'vscode';
99
import { downloadFile, executableExists, userAgentHeader } from './utils';
1010

1111
/** GitHub API release */
@@ -29,9 +29,17 @@ const exeExtension = process.platform === 'win32' ? '.exe' : '';
2929
*/
3030
async function getProjectGhcVersion(context: ExtensionContext, dir: string, release: IRelease): Promise<string | null> {
3131
const callWrapper = (wrapper: string) => {
32-
// Need to set the encoding to 'utf8' in order to get back a string
33-
const out = child_process.spawnSync(wrapper, ['--project-ghc-version'], { encoding: 'utf8', cwd: dir });
34-
return !out.error ? out.stdout.trim() : null;
32+
return window.withProgress(
33+
{
34+
location: ProgressLocation.Window,
35+
title: 'Working out the project GHC version',
36+
},
37+
async () => {
38+
// Need to set the encoding to 'utf8' in order to get back a string
39+
const out = child_process.spawnSync(wrapper, ['--project-ghc-version'], { encoding: 'utf8', cwd: dir });
40+
return !out.error ? out.stdout.trim() : null;
41+
}
42+
);
3543
};
3644

3745
const localWrapper = ['haskell-language-server-wrapper'].find(executableExists);

0 commit comments

Comments
 (0)