diff --git a/src/errors.ts b/src/errors.ts index 9ca4e283..139da6a1 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -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'); } } diff --git a/src/extension.ts b/src/extension.ts index 16b2f75b..eb483881 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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'; @@ -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);