diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cef36ae2..4242c3ea 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,16 +1,15 @@ version: 2 updates: - # NOTE: Dependabot official configuration documentation: # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#package-ecosystem # Maintain dependencies for internal GitHub Actions CI for pull requests - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f07bc1f9..b25349a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,12 @@ jobs: run: ghcup upgrade -i -f shell: bash # Setup the environment for the tests - - name: Ensure there is a supported ghc versions - uses: haskell/actions/setup@v2 - with: - ghc-version: ${{ matrix.ghc }} + - name: Install stack + run: ghcup install stack recommended + - name: Install cabal + run: ghcup install cabal recommended + - name: Install GHC + run: ghcup install ghc ${{matrix.ghc}} - name: 'Install `tree` for MacOs' run: | brew update diff --git a/README.md b/README.md index 9edf52bd..097362c6 100644 --- a/README.md +++ b/README.md @@ -7,28 +7,28 @@ As almost all features are provided by the server you might find interesting rea ## Table of Contents -* [Setup](#setup) -* [Features](#features) -* [Requirements](#requirements) -* [Configuration options](#configuration-options) - * [Path to server executable](#path-to-server-executable) - * [Security warning](#security-warning) - * [Set additional environment variables for the server](#set-additional-environment-variables-for-the-server) - * [Downloaded binaries](#downloaded-binaries) - * [Setting a specific toolchain](#setting-a-specific-toolchain) - * [Supported GHC versions](#supported-ghc-versions) -* [Using multi-root workspaces](#using-multi-root-workspaces) -* [Investigating and reporting problems](#investigating-and-reporting-problems) -* [FAQ](#faq) - * [Troubleshooting](#troubleshooting) - * [Check issues and tips in the haskell-language-server project](#check-issues-and-tips-in-the-haskell-language-server-project) - * [Restarting the language server](#restarting-the-language-server) - * [Failed to get project GHC version on darwin M1 with stack](#failed-to-get-project-ghc-version-on-darwin-m1-with-stack) - * [GHC ABIs don't match](#ghc-abis-dont-match) - * [Using an old configuration](#using-an-old-configuration) - * [Stack/Cabal/GHC can not be found](#stackcabalghc-can-not-be-found) -* [Contributing](#contributing) -* [Release Notes](#release-notes) +- [Setup](#setup) +- [Features](#features) +- [Requirements](#requirements) +- [Configuration options](#configuration-options) + - [Path to server executable](#path-to-server-executable) + - [Security warning](#security-warning) + - [Set additional environment variables for the server](#set-additional-environment-variables-for-the-server) + - [Downloaded binaries](#downloaded-binaries) + - [Setting a specific toolchain](#setting-a-specific-toolchain) + - [Supported GHC versions](#supported-ghc-versions) +- [Using multi-root workspaces](#using-multi-root-workspaces) +- [Investigating and reporting problems](#investigating-and-reporting-problems) +- [FAQ](#faq) + - [Troubleshooting](#troubleshooting) + - [Check issues and tips in the haskell-language-server project](#check-issues-and-tips-in-the-haskell-language-server-project) + - [Restarting the language server](#restarting-the-language-server) + - [Failed to get project GHC version on darwin M1 with stack](#failed-to-get-project-ghc-version-on-darwin-m1-with-stack) + - [GHC ABIs don't match](#ghc-abis-dont-match) + - [Using an old configuration](#using-an-old-configuration) + - [Stack/Cabal/GHC can not be found](#stackcabalghc-can-not-be-found) +- [Contributing](#contributing) +- [Release Notes](#release-notes) ## Setup @@ -267,7 +267,7 @@ setup-info: ghc: linux64-tinfo6: 9.0.2: - url: "https://downloads.haskell.org/ghc/9.0.2/ghc-9.0.2a-x86_64-fedora27-linux.tar.xz" + url: 'https://downloads.haskell.org/ghc/9.0.2/ghc-9.0.2a-x86_64-fedora27-linux.tar.xz' ``` Alternatively let GHCup install the correct bindist and then set `system-ghc: true` in your `stack.yaml`. diff --git a/src/extension.ts b/src/extension.ts index e52480a5..7acb7e0c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -179,7 +179,7 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold } else if (e instanceof NoMatchingHls) { const link = e.docLink(); logger.error(`${e.message}`); - if (await window.showErrorMessage(e.message, `Open documentation`)) { + if (await window.showErrorMessage(e.message, 'Open documentation')) { env.openExternal(link); } } else if (e instanceof Error) { diff --git a/src/hlsBinaries.ts b/src/hlsBinaries.ts index ee80ebe4..da408971 100644 --- a/src/hlsBinaries.ts +++ b/src/hlsBinaries.ts @@ -133,10 +133,7 @@ async function callAsync( /** Gets serverExecutablePath and fails if it's not set. */ -async function findServerExecutable( - logger: Logger, - folder?: WorkspaceFolder -): Promise { +async function findServerExecutable(logger: Logger, folder?: WorkspaceFolder): Promise { let exePath = workspace.getConfiguration('haskell').get('serverExecutablePath') as string; logger.info(`Trying to find the server executable in: ${exePath}`); exePath = resolvePathPlaceHolders(exePath, folder); @@ -200,7 +197,7 @@ export async function findHaskellLanguageServer( // first plugin initialization if (manageHLS !== 'GHCup' && (!context.globalState.get('pluginInitialized') as boolean | null)) { const promptMessage = `How do you want the extension to manage/discover HLS and the relevant toolchain? - + Choose "Automatically" if you're in doubt. `; diff --git a/test/suite/extension.test.ts b/test/suite/extension.test.ts index 87a88a9b..7d85dd8b 100644 --- a/test/suite/extension.test.ts +++ b/test/suite/extension.test.ts @@ -125,7 +125,6 @@ suite('Extension Test Suite', () => { vscode.window.showInformationMessage('Start all tests.'); suiteSetup(async () => { - const tmpdir = path.join(getWorkspaceRoot().uri.fsPath, 'tmp'); await deleteWorkspaceFiles([ joinUri(getWorkspaceRoot().uri, '.vscode'), joinUri(getWorkspaceRoot().uri, 'bin', process.platform === 'win32' ? 'ghcup' : '.ghcup', 'cache'), @@ -137,17 +136,10 @@ suite('Extension Test Suite', () => { await getHaskellConfig().update('releasesDownloadStoragePath', path.normalize(getWorkspaceFile('bin').fsPath)); await getHaskellConfig().update('serverEnvironment', { XDG_CACHE_HOME: path.normalize(getWorkspaceFile('cache-test').fsPath), - TMPDIR: tmpdir, - TMP: tmpdir, }); - fs.mkdirSync(tmpdir, { recursive: true }); const contents = new TextEncoder().encode('main = putStrLn "hi vscode tests"'); await vscode.workspace.fs.writeFile(getWorkspaceFile('Main.hs'), contents); - const pred = (uri: vscode.Uri) => !['download', 'gz', 'zip'].includes(path.extname(uri.fsPath)); - // Setting up watchers before actual tests start, to ensure we will got the created event - filesCreated.set('wrapper', existsWorkspaceFile(`tmp/ghcup-*/haskell-language-server-wrapper*`, pred)); - filesCreated.set('server', existsWorkspaceFile(`tmp/ghcup-*/haskell-language-server-[1-9]*`, pred)); filesCreated.set('log', existsWorkspaceFile('hls.log')); filesCreated.set('cache', existsWorkspaceFile('cache-test')); }); @@ -166,20 +158,6 @@ suite('Extension Test Suite', () => { assert.ok(await withTimeout(90, filesCreated.get('log')!), 'Extension log not created in 30 seconds'); }); - test('HLS executables should be downloaded', async () => { - await vscode.workspace.openTextDocument(getWorkspaceFile('Main.hs')); - console.log('Testing wrapper'); - assert.ok( - await withTimeout(90, filesCreated.get('wrapper')!), - 'The wrapper executable was not downloaded in 90 seconds' - ); - console.log('Testing server'); - assert.ok( - await withTimeout(90, filesCreated.get('server')!), - 'The server executable was not downloaded in 90 seconds' - ); - }); - test('Extension log should have server output', async () => { await vscode.workspace.openTextDocument(getWorkspaceFile('Main.hs')); await delay(20);