Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export class MissingToolError extends HlsError {

export class NoMatchingHls extends Error {
constructor(readonly ghcProjVersion: string) {
const noMatchingHLS = `No HLS version was found for supporting GHC ${ghcProjVersion}.`;
super(noMatchingHLS);
super(`HLS does not support GHC ${ghcProjVersion} yet.`);
}
public docLink(): Uri {
return Uri.parse('https://haskell-language-server.readthedocs.io/en/latest/supported-versions.html');
}
}
8 changes: 7 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { CommandNames } from './commands/constants';
import { ImportIdentifier } from './commands/importIdentifier';
import { DocsBrowser } from './docsBrowser';
import { HlsError, MissingToolError } from './errors';
import { HlsError, MissingToolError, NoMatchingHls } from './errors';
import { findHaskellLanguageServer, IEnvVars } from './hlsBinaries';
import { addPathToProcessPath, expandHomeDir, ExtensionLogger } from './utils';

Expand Down Expand Up @@ -176,6 +176,12 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
} else if (e instanceof HlsError) {
logger.error(`General HlsError: ${e.message}`);
window.showErrorMessage(e.message);
} else if (e instanceof NoMatchingHls) {
const link = e.docLink();
logger.error(`${e.message}`);
if (await window.showErrorMessage(e.message, `Open documentation`)) {
env.openExternal(link);
}
} else if (e instanceof Error) {
logger.error(`Internal Error: ${e.message}`);
window.showErrorMessage(e.message);
Expand Down