diff --git a/.github/scripts/env.sh b/.github/scripts/env.sh index 2486869453..90e7219661 100644 --- a/.github/scripts/env.sh +++ b/.github/scripts/env.sh @@ -11,7 +11,7 @@ fi export PATH="$HOME/.local/bin:$PATH" export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 -export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-3.10.2.0}" +export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-3.10.3.0}" export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=no export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes export BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh index 04cf680779..dfcfc4b4ef 100644 --- a/.github/scripts/test.sh +++ b/.github/scripts/test.sh @@ -8,14 +8,25 @@ set -eux . .github/scripts/env.sh . .github/scripts/common.sh -test_package="bytestring-0.11.1.0" -test_module="Data/ByteString.hs" +test_package="text-2.1.1" +test_module="src/Data/Text.hs" create_cradle() { echo "cradle:" > hie.yaml echo " cabal:" >> hie.yaml } +# Tests and benchmarks can't be built on some GHC versions, such as GHC 9.10.1 on Windows. +# Disable these packages for now, building bytestring-0.12.1.0 works completely fine. +create_cabal_project() { + echo "packages: ./" > cabal.project + echo "" >> cabal.project + echo "tests: False" >> cabal.project + echo "benchmarks: False" >> cabal.project + + echo "flags: -simdutf -pure-haskell" >> cabal.project +} + enter_test_package() { local tmp_dir tmp_dir=$(mktempdir) @@ -38,7 +49,7 @@ test_all_hls() { bin_noexe=${bin/.exe/} if ! [[ "${bin_noexe}" =~ "haskell-language-server-wrapper" ]] && ! [[ "${bin_noexe}" =~ "~" ]] ; then if ghcup install ghc --set "${bin_noexe/haskell-language-server-/}" ; then - "${hls}" typecheck "${test_module}" || fail "failed to typecheck with HLS for GHC ${bin_noexe/haskell-language-server-/}" + "${hls}" --debug typecheck "${test_module}" || fail "failed to typecheck with HLS for GHC ${bin_noexe/haskell-language-server-/}" # After running the test, free up disk space by deleting the unneeded GHC version. # Helps us staying beneath the 14GB SSD disk limit. @@ -60,7 +71,7 @@ env # ensure ghcup install_ghcup -ghcup install ghc --set 9.4.5 +ghcup install ghc --set 9.4.8 (cd .. && ecabal update) # run cabal update outside project dir @@ -77,6 +88,7 @@ case "${TARBALL_EXT}" in enter_test_package create_cradle + create_cabal_project test_all_hls "$GHCUP_BIN" ;; @@ -106,6 +118,7 @@ case "${TARBALL_EXT}" in enter_test_package create_cradle + create_cabal_project test_all_hls "$(ghcup whereis bindir)" ;; diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml index b9e25eee4f..569d380951 100644 --- a/.github/workflows/caching.yml +++ b/.github/workflows/caching.yml @@ -89,10 +89,6 @@ jobs: - ubuntu-latest - macOS-latest - windows-latest - exclude: - # We disable this this combo in test.yml due to long path issues, so we also need to disable it here - - os: windows-latest - ghc: "9.2" steps: - uses: actions/checkout@v3 @@ -105,7 +101,7 @@ jobs: # Fetching from github cache is faster than doing it from hackage # Sources does not change per ghc and ghc version son only doing it # for one matrix job (it is arbitrary) - - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '9.2' + - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '9.6' name: Download sources run: | cabal $cabalBuild --only-download --enable-benchmarks --enable-tests @@ -120,7 +116,7 @@ jobs: # We build ghcide with benchs and test enabled to include its dependencies in the cache # (including shake-bench) # Only for the same ghc and os used in the bench workflow, so we save cache space - - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '9.2' + - if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '9.6' name: Build ghcide benchmark run: | cabal $cabalBuild ghcide --enable-benchmarks --enable-tests diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 2775ca37ad..a9469851d3 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -27,7 +27,7 @@ jobs: - uses: ./.github/actions/setup-build with: # select a stable GHC version - ghc: 9.2 + ghc: 9.6 os: ${{ runner.os }} shorten-hls: false diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5dffaaa915..243fc3e2f7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.8.2", "9.6.5", "9.4.8", "9.2.8"] + ghc: ["9.10.1", "9.8.2", "9.6.5", "9.4.8"] platform: [ { image: "debian:9" , installCmd: "sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list && sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list && sed -i /-updates/d /etc/apt/sources.list && apt-get update && apt-get install -y" , toolRequirements: "libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl ghc gzip libffi-dev libncurses-dev libncurses5 libtinfo5 patchelf" @@ -118,25 +118,25 @@ jobs: # Perhaps we can migrate *all* unknown linux builds to a uniform # image. include: - - ghc: 9.2.8 + - ghc: 9.4.8 platform: - { image: "rockylinux:8" - , installCmd: "yum -y install epel-release && yum install -y --allowerasing" + { image: "fedora:27" + , installCmd: "dnf install -y" , toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" , DISTRO: "Unknown" , ARTIFACT: "x86_64-linux-unknown" , ADD_CABAL_ARGS: "--enable-split-sections" } - - ghc: 9.4.8 + - ghc: 9.6.5 platform: - { image: "fedora:27" - , installCmd: "dnf install -y" + { image: "rockylinux:8" + , installCmd: "yum -y install epel-release && yum install -y --allowerasing" , toolRequirements: "autoconf automake binutils bzip2 coreutils curl elfutils-devel elfutils-libs findutils gcc gcc-c++ git gmp gmp-devel jq lbzip2 make ncurses ncurses-compat-libs ncurses-devel openssh-clients patch perl pxz python3 sqlite sudo wget which xz zlib-devel patchelf" , DISTRO: "Unknown" , ARTIFACT: "x86_64-linux-unknown" , ADD_CABAL_ARGS: "--enable-split-sections" } - - ghc: 9.6.5 + - ghc: 9.8.2 platform: { image: "rockylinux:8" , installCmd: "yum -y install epel-release && yum install -y --allowerasing" @@ -145,7 +145,7 @@ jobs: , ARTIFACT: "x86_64-linux-unknown" , ADD_CABAL_ARGS: "--enable-split-sections" } - - ghc: 9.8.2 + - ghc: 9.10.1 platform: { image: "rockylinux:8" , installCmd: "yum -y install epel-release && yum install -y --allowerasing" @@ -213,7 +213,7 @@ jobs: strategy: fail-fast: true matrix: - ghc: ["9.8.2", "9.6.5", "9.4.8", "9.2.8" ] + ghc: ["9.10.1", "9.8.2", "9.6.5", "9.4.8"] steps: - uses: docker://arm64v8/ubuntu:focal name: Cleanup (aarch64 linux) @@ -273,7 +273,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.8.2", "9.6.5", "9.4.8", "9.2.8"] + ghc: ["9.10.1", "9.8.2", "9.6.5", "9.4.8"] steps: - name: Checkout code uses: actions/checkout@v3 @@ -318,7 +318,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.8.2", "9.6.5", "9.4.8", "9.2.8"] + ghc: ["9.10.1", "9.8.2", "9.6.5", "9.4.8"] steps: - name: Checkout code uses: actions/checkout@v3 @@ -363,7 +363,7 @@ jobs: strategy: fail-fast: false matrix: - ghc: ["9.8.2", "9.6.5", "9.4.8", "9.2.8"] + ghc: ["9.10.1", "9.8.2", "9.6.5", "9.4.8"] steps: - name: install windows deps shell: pwsh diff --git a/.github/workflows/supported-ghc-versions.json b/.github/workflows/supported-ghc-versions.json index 387811c11b..b530e284e0 100644 --- a/.github/workflows/supported-ghc-versions.json +++ b/.github/workflows/supported-ghc-versions.json @@ -1 +1 @@ -["9.10", "9.8", "9.6", "9.4" , "9.2" ] +["9.10", "9.8", "9.6", "9.4"] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84e75963d6..50039becbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,9 +78,6 @@ jobs: - true - false exclude: - # Don't do anything for windows on 9.2, it has particularly bad long-path issues - - os: windows-latest - ghc: "9.2" # Exclude the test configuration on macos, it's sufficiently similar to other OSs # that it mostly just burns CI time. Buiding is still useful since it catches # solver issues. @@ -164,7 +161,7 @@ jobs: run: cabal test hls-splice-plugin-tests || cabal test hls-splice-plugin-tests # TODO enable when it supports 9.10 - - if: matrix.test && matrix.ghc != '9.2' && matrix.ghc != '9.10' + - if: matrix.test && matrix.ghc != '9.10' name: Test hls-stan-plugin run: cabal test hls-stan-plugin-tests || cabal test hls-stan-plugin-tests @@ -230,8 +227,8 @@ jobs: name: Test hls-explicit-record-fields-plugin test suite run: cabal test hls-explicit-record-fields-plugin-tests || cabal test hls-explicit-record-fields-plugin-tests - ## version needs to be limited since the tests depend on cabal-fmt which only builds using specific ghc versions - - if: matrix.test && matrix.ghc == '9.2' + # versions need to be limited since the tests depend on cabal-fmt which only builds with ghc <9.10 + - if: matrix.test && matrix.ghc != '9.10' name: Test hls-cabal-fmt-plugin test suite run: cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests || cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests diff --git a/ChangeLog.md b/ChangeLog.md index 34465b5910..c98fbb651f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,117 @@ # Changelog for haskell-language-server +## 2.9.0.0 + +- Bindists for GHC 9.10.1 by @wz1000, @jhrcek, @michaelpj +- More hls-graph reliability improvements by @soulomoon +- Refactoring of test suite runners by @soulomoon +- Fixes in multiple home units support by @wz1000 + +### Pull Requests + +- Fix quadratic memory usage in GetLocatedImports + ([#4318](https://github.com/haskell/haskell-language-server/pull/4318)) by @mpickering +- Bump stack configs + CI to 9.6.5 and 9.8.2 + ([#4316](https://github.com/haskell/haskell-language-server/pull/4316)) by @jhrcek +- Add support for Fourmolu 0.16 + ([#4314](https://github.com/haskell/haskell-language-server/pull/4314)) by @ brandonchinn178 +- Code action to remove redundant record field import (fixes #4220) + ([#4308](https://github.com/haskell/haskell-language-server/pull/4308)) by @battermann +- Use restricted monad for plugins (#4057) + ([#4304](https://github.com/haskell/haskell-language-server/pull/4304)) by @awjchen +- 4301 we need to implement utility to wait for all runnning keys in hls graph done + ([#4302](https://github.com/haskell/haskell-language-server/pull/4302)) by @soulomoon +- Call useWithStale instead of useWithStaleFast when calling ParseCabalFields + ([#4294](https://github.com/haskell/haskell-language-server/pull/4294)) by @VeryMilkyJoe +- test: add test documenting #806 + ([#4292](https://github.com/haskell/haskell-language-server/pull/4292)) by @develop7 +- ghcide: drop ghc-check and ghc-paths dependency + ([#4291](https://github.com/haskell/haskell-language-server/pull/4291)) by @wz1000 +- Limit number of valid hole fits to 10 + ([#4288](https://github.com/haskell/haskell-language-server/pull/4288)) by @akshaymankar +- Add common stanza to completion data + ([#4286](https://github.com/haskell/haskell-language-server/pull/4286)) by @VeryMilkyJoe +- FindImports: ThisPkg means some home unit, not "this" unit + ([#4284](https://github.com/haskell/haskell-language-server/pull/4284)) by @wz1000 +- Remove redudant absolutization in session loader + ([#4280](https://github.com/haskell/haskell-language-server/pull/4280)) by @soulomoon +- Bump to new lsp versions + ([#4279](https://github.com/haskell/haskell-language-server/pull/4279)) by @michaelpj +- Put more test code into pre-commit + ([#4275](https://github.com/haskell/haskell-language-server/pull/4275)) by @soulomoon +- Delete library ghcide test utils + ([#4274](https://github.com/haskell/haskell-language-server/pull/4274)) by @soulomoon +- Delete testUtil from ghcide-tests + ([#4272](https://github.com/haskell/haskell-language-server/pull/4272)) by @soulomoon +- CI change, only run bench on performance label + ([#4271](https://github.com/haskell/haskell-language-server/pull/4271)) by @soulomoon +- Migrate WatchedFileTests + ([#4269](https://github.com/haskell/haskell-language-server/pull/4269)) by @soulomoon +- Migrate UnitTests + ([#4268](https://github.com/haskell/haskell-language-server/pull/4268)) by @soulomoon +- Migrate SafeTests + ([#4267](https://github.com/haskell/haskell-language-server/pull/4267)) by @soulomoon +- Migrate SymlinkTests + ([#4266](https://github.com/haskell/haskell-language-server/pull/4266)) by @soulomoon +- Remove unused and outdated CHANGELOG files + ([#4264](https://github.com/haskell/haskell-language-server/pull/4264)) by @fendor +- Enable cabal flaky test + ([#4263](https://github.com/haskell/haskell-language-server/pull/4263)) by @soulomoon +- Migrate RootUriTests + ([#4261](https://github.com/haskell/haskell-language-server/pull/4261)) by @soulomoon +- Migrate PreprocessorTests + ([#4260](https://github.com/haskell/haskell-language-server/pull/4260)) by @soulomoon +- Migrate PluginSimpleTests + ([#4259](https://github.com/haskell/haskell-language-server/pull/4259)) by @soulomoon +- Migrate ClientSettingsTests + ([#4258](https://github.com/haskell/haskell-language-server/pull/4258)) by @soulomoon +- Unify critical session running in hls + ([#4256](https://github.com/haskell/haskell-language-server/pull/4256)) by @soulomoon +- Bump cachix/cachix-action from 14 to 15 + ([#4255](https://github.com/haskell/haskell-language-server/pull/4255)) by @dependabot[bot] +- Bump haskell-actions/setup from 2.7.2 to 2.7.3 + ([#4254](https://github.com/haskell/haskell-language-server/pull/4254)) by @dependabot[bot] +- Bump haskell-actions/setup from 2.7.2 to 2.7.3 in /.github/actions/setup-build + ([#4253](https://github.com/haskell/haskell-language-server/pull/4253)) by @dependabot[bot] +- Shorter file names completion + ([#4252](https://github.com/haskell/haskell-language-server/pull/4252)) by @VenInf +- Fix progress start delay + ([#4249](https://github.com/haskell/haskell-language-server/pull/4249)) by @michaelpj +- Bump cachix/install-nix-action from 26 to 27 + ([#4245](https://github.com/haskell/haskell-language-server/pull/4245)) by @dependabot[bot] +- Bump haskell-actions/setup from 2.7.1 to 2.7.2 + ([#4244](https://github.com/haskell/haskell-language-server/pull/4244)) by @dependabot[bot] +- Bump haskell-actions/setup from 2.7.1 to 2.7.2 in /.github/actions/setup-build + ([#4243](https://github.com/haskell/haskell-language-server/pull/4243)) by @dependabot[bot] +- Enable test for #717 + ([#4241](https://github.com/haskell/haskell-language-server/pull/4241)) by @soulomoon +- Remove Pepe from CODEOWNERS + ([#4239](https://github.com/haskell/haskell-language-server/pull/4239)) by @michaelpj +- Fix resultBuilt(dirty mechanism) in hls-graph + ([#4238](https://github.com/haskell/haskell-language-server/pull/4238)) by @soulomoon +- Support for 9.10 + ([#4233](https://github.com/haskell/haskell-language-server/pull/4233)) by @wz1000 +- Refactor hls-test-util and reduce getCurrentDirectory after initilization + ([#4231](https://github.com/haskell/haskell-language-server/pull/4231)) by @soulomoon +- [Migrate BootTests] part of #4173 Migrate ghcide tests to hls test utils + ([#4227](https://github.com/haskell/haskell-language-server/pull/4227)) by @soulomoon +- Actually enable pedantic flag in ci flags job + ([#4224](https://github.com/haskell/haskell-language-server/pull/4224)) by @jhrcek +- Cleanup cabal files, ghc compat code, fix ghc warnings + ([#4222](https://github.com/haskell/haskell-language-server/pull/4222)) by @jhrcek +- Another attempt at using the lsp API for some progress reporting + ([#4218](https://github.com/haskell/haskell-language-server/pull/4218)) by @michaelpj +- [Migrate diagnosticTests] part of #4173 Migrate ghcide tests to hls test utils + ([#4207](https://github.com/haskell/haskell-language-server/pull/4207)) by @soulomoon +- Prepare release 2.8.0.0 + ([#4191](https://github.com/haskell/haskell-language-server/pull/4191)) by @wz1000 +- Stabilize the build system by correctly house keeping the dirtykeys and rule values [flaky test #4185 #4093] + ([#4190](https://github.com/haskell/haskell-language-server/pull/4190)) by @soulomoon +- hls-cabal-plugin: refactor context search to use `readFields` + ([#4186](https://github.com/haskell/haskell-language-server/pull/4186)) by @fendor +- 3944 extend the properties api to better support nested configuration + ([#3952](https://github.com/haskell/haskell-language-server/pull/3952)) by @soulomoon + ## 2.8.0.0 - Bindists for GHC 9.6.5 diff --git a/RELEASING.md b/RELEASING.md index 73f887b9fc..42ba158ac2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -21,6 +21,7 @@ - Generate a ChangeLog via `./GenChangelogs.hs ` - `` is the git tag you want to generate the ChangeLog from. - `` is a github access key: https://github.com/settings/tokens +- [ ] update https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html#current-ghc-version-support-status - [ ] create release branch as `wip/` - `git switch -c wip/` - [ ] create release tag as `` @@ -50,7 +51,6 @@ - [ ] publish release on github - [ ] upload hackage packages - requires credentials -- [ ] update https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html#current-ghc-version-support-status - [ ] Supported tools table needs to be updated: - https://www.haskell.org/ghcup/install/#supported-platforms - https://github.com/haskell/ghcup-hs/blob/master/docs/install.md#supported-platforms diff --git a/cabal.project b/cabal.project index 18ce3e76f5..e430c76dee 100644 --- a/cabal.project +++ b/cabal.project @@ -7,11 +7,13 @@ packages: ./hls-plugin-api ./hls-test-utils -index-state: 2024-06-13T17:12:34Z +index-state: 2024-07-20T00:00:00Z tests: True test-show-details: direct +benchmarks: True + write-ghc-environment-files: never -- Many of our tests only work single-threaded, and the only way to @@ -40,18 +42,6 @@ constraints: -- in the future, thus: TODO: remove this flag. bitvec -simd, - if impl(ghc >= 9.9) + -- https://github.com/haskell/haskell-language-server/issues/4324 benchmarks: False - constraints: - lens >= 5.3.2, - -- See - -- https://github.com/haskell/stylish-haskell/issues/479 - -- https://github.com/ennocramer/floskell/pull/82 - -- https://github.com/ndmitchell/hlint/pull/1594 - haskell-language-server -stylishHaskell -hlint -retrie -splice -floskell, - allow-newer: - haddock-library:base, - haddock-library:containers, -else - benchmarks: True diff --git a/docs/support/ghc-version-support.md b/docs/support/ghc-version-support.md index 46eece5a34..a9d3074775 100644 --- a/docs/support/ghc-version-support.md +++ b/docs/support/ghc-version-support.md @@ -17,6 +17,7 @@ Support status (see the support policy below for more details): | GHC version | Last supporting HLS version | Support status | |--------------|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------| +| 9.10.1 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | full support | | 9.8.2 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | full support | | 9.8.1 | [2.6.0.0](https://github.com/haskell/haskell-language-server/releases/tag/2.6.0.0) | full support | | 9.6.5 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | full support | @@ -31,7 +32,7 @@ Support status (see the support policy below for more details): | 9.4.4 | [1.10.0.0](https://github.com/haskell/haskell-language-server/releases/tag/1.10.0.0) | deprecated | | 9.4.3 | [1.9.1.0](https://github.com/haskell/haskell-language-server/releases/tag/1.9.1.0) | deprecated | | 9.4.(1,2) | [1.8.0.0](https://github.com/haskell/haskell-language-server/releases/tag/1.8.0.0) | deprecated | -| 9.2.8 | [latest](https://github.com/haskell/haskell-language-server/releases/latest) | full support | +| 9.2.8 | [2.9.0.0](https://github.com/haskell/haskell-language-server/releases/tag/2.9.0.0) | deprecated | | 9.2.7 | [2.0.0.1](https://github.com/haskell/haskell-language-server/releases/tag/2.0.0.1) | deprecated | | 9.2.(5,6) | [1.9.1.0](https://github.com/haskell/haskell-language-server/releases/tag/1.9.1.0) | deprecated | | 9.2.(3,4) | [1.8.0.0](https://github.com/haskell/haskell-language-server/releases/tag/1.8.0.0) | deprecated | diff --git a/docs/support/plugin-support.md b/docs/support/plugin-support.md index 70c6472c1f..895cfda25b 100644 --- a/docs/support/plugin-support.md +++ b/docs/support/plugin-support.md @@ -38,7 +38,7 @@ For example, a plugin to provide a formatter which has itself been abandoned has ## Current plugin support tiers | Plugin | Tier | Unsupported GHC versions | -|-------------------------------------|------|--------------------------| +| ----------------------------------- | ---- | ------------------------ | | ghcide core plugins | 1 | | | `hls-call-hierarchy-plugin` | 1 | | | `hls-code-range-plugin` | 1 | | @@ -47,6 +47,7 @@ For example, a plugin to provide a formatter which has itself been abandoned has | `hls-refactor-plugin` | 1 | | | `hls-alternate-number-plugin` | 2 | | | `hls-cabal-fmt-plugin` | 2 | | +| `hls-cabal-gild-plugin` | 2 | | | `hls-class-plugin` | 2 | | | `hls-change-type-signature-plugin` | 2 | | | `hls-eval-plugin` | 2 | | @@ -54,16 +55,16 @@ For example, a plugin to provide a formatter which has itself been abandoned has | `hls-explicit-record-fields-plugin` | 2 | | | `hls-fourmolu-plugin` | 2 | | | `hls-gadt-plugin` | 2 | | -| `hls-hlint-plugin` | 2 | | +| `hls-hlint-plugin` | 2 | 9.10.1 | | `hls-module-name-plugin` | 2 | | | `hls-notes-plugin` | 2 | | | `hls-qualify-imported-names-plugin` | 2 | | | `hls-ormolu-plugin` | 2 | | | `hls-rename-plugin` | 2 | | -| `hls-stylish-haskell-plugin` | 2 | | +| `hls-stylish-haskell-plugin` | 2 | 9.10.1 | | `hls-overloaded-record-dot-plugin` | 2 | | | `hls-semantic-tokens-plugin` | 2 | | -| `hls-floskell-plugin` | 3 | | -| `hls-stan-plugin` | 3 | 9.2.(4-8) | -| `hls-retrie-plugin` | 3 | | -| `hls-splice-plugin` | 3 | | +| `hls-floskell-plugin` | 3 | 9.10.1 | +| `hls-stan-plugin` | 3 | 9.10.1 | +| `hls-retrie-plugin` | 3 | 9.10.1 | +| `hls-splice-plugin` | 3 | 9.10.1 | diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 8a60854ccb..428fbe32f2 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -189,7 +189,7 @@ stack install haskell-language-server You also can leverage `ghcup compile hls`: ```bash -ghcup compile hls -v 1.9.0.0 --ghc 9.2.5 +ghcup compile hls -v 2.9.0.0 --ghc 9.6.5 ``` ### Preprocessors diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 87db32c2bc..03934f6d56 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -2,7 +2,7 @@ cabal-version: 3.4 build-type: Simple category: Development name: ghcide -version: 2.8.0.0 +version: 2.9.0.0 license: Apache-2.0 license-file: LICENSE author: Digital Asset and Ghcide contributors @@ -14,7 +14,7 @@ homepage: https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme bug-reports: https://github.com/haskell/haskell-language-server/issues -tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 || ==9.2.8 +tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 extra-source-files: CHANGELOG.md README.md @@ -81,8 +81,8 @@ library , hie-bios ^>=0.14.0 , hie-compat ^>=0.3.0.0 , hiedb ^>= 0.6.0.0 - , hls-graph == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , hls-graph == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , implicit-hie >= 0.1.4.0 && < 0.1.5 , lens , list-t diff --git a/ghcide/session-loader/Development/IDE/Session.hs b/ghcide/session-loader/Development/IDE/Session.hs index 136a630d06..0828381c7a 100644 --- a/ghcide/session-loader/Development/IDE/Session.hs +++ b/ghcide/session-loader/Development/IDE/Session.hs @@ -62,8 +62,7 @@ import Development.IDE.Graph (Action) import qualified Development.IDE.Session.Implicit as GhcIde import Development.IDE.Types.Diagnostics import Development.IDE.Types.Exports -import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq, - newHscEnvEqPreserveImportPaths) +import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq) import Development.IDE.Types.Location import Development.IDE.Types.Options import GHC.ResponseFile @@ -120,7 +119,6 @@ import Text.ParserCombinators.ReadP (readP_to_S) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,3,0) import qualified Data.Set as OS import qualified Development.IDE.GHC.Compat.Util as Compat import GHC.Data.Graph.Directed @@ -131,7 +129,6 @@ import GHC.Driver.Errors.Types import GHC.Types.Error (errMsgDiagnostic, singleMessage) import GHC.Unit.State -#endif data Log = LogSettingInitialDynFlags @@ -245,13 +242,6 @@ data SessionLoadingOptions = SessionLoadingOptions , getCacheDirs :: String -> [String] -> IO CacheDirs -- | Return the GHC lib dir to use for the 'unsafeGlobalDynFlags' , getInitialGhcLibDir :: Recorder (WithPriority Log) -> FilePath -> IO (Maybe LibDir) -#if !MIN_VERSION_ghc(9,3,0) - , fakeUid :: UnitId - -- ^ unit id used to tag the internal component built by ghcide - -- To reuse external interface files the unit ids must match, - -- thus make sure to build them with `--this-unit-id` set to the - -- same value as the ghcide fake uid -#endif } instance Default SessionLoadingOptions where @@ -260,9 +250,6 @@ instance Default SessionLoadingOptions where ,loadCradle = loadWithImplicitCradle ,getCacheDirs = getCacheDirsDefault ,getInitialGhcLibDir = getInitialGhcLibDirDefault -#if !MIN_VERSION_ghc(9,3,0) - ,fakeUid = Compat.toUnitId (Compat.stringToUnit "main") -#endif } -- | Find the cradle for a given 'hie.yaml' configuration. @@ -542,11 +529,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do all_deps' <- forM all_deps $ \RawComponentInfo{..} -> do -- Remove all inplace dependencies from package flags for -- components in this HscEnv -#if MIN_VERSION_ghc(9,3,0) let (df2, uids) = (rawComponentDynFlags, []) -#else - let (df2, uids) = _removeInplacePackages fakeUid _inplace rawComponentDynFlags -#endif let prefix = show rawComponentUnitId -- See Note [Avoiding bad interface files] let hscComponents = sort $ map show uids @@ -585,8 +568,8 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do -- For GHC's supporting multi component sessions, we create a shared -- HscEnv but set the active component accordingly hscEnv <- emptyHscEnv ideNc _libDir - let new_cache = newComponentCache recorder optExtensions hieYaml _cfp hscEnv - all_target_details <- new_cache old_deps new_deps rootDir + let new_cache = newComponentCache recorder optExtensions _cfp hscEnv + all_target_details <- new_cache old_deps new_deps this_dep_info <- getDependencyInfo $ maybeToList hieYaml let (all_targets, this_flags_map, this_options) @@ -771,24 +754,13 @@ cradleToOptsAndLibDir recorder loadConfig cradle file old_fps = do PreferSingleComponentLoading -> LoadFile PreferMultiComponentLoading -> LoadWithContext old_fps -#if MIN_VERSION_ghc(9,3,0) emptyHscEnv :: NameCache -> FilePath -> IO HscEnv -#else -emptyHscEnv :: IORef NameCache -> FilePath -> IO HscEnv -#endif emptyHscEnv nc libDir = do -- We call setSessionDynFlags so that the loader is initialised -- We need to do this before we call initUnits. env <- runGhc (Just libDir) $ getSessionDynFlags >>= setSessionDynFlags >> getSession - -- On GHC 9.2 calling setSessionDynFlags caches the unit databases - -- for an empty environment. This prevents us from reading the - -- package database subsequently. So clear the unit db cache in - -- hsc_unit_dbs pure $ setNameCache nc (hscSetFlags ((hsc_dflags env){useUnicode = True }) env) -#if !MIN_VERSION_ghc(9,3,0) - {hsc_unit_dbs = Nothing} -#endif data TargetDetails = TargetDetails { @@ -826,14 +798,9 @@ toFlagsMap TargetDetails{..} = [ (l, (targetEnv, targetDepends)) | l <- targetLocations] -#if MIN_VERSION_ghc(9,3,0) setNameCache :: NameCache -> HscEnv -> HscEnv -#else -setNameCache :: IORef NameCache -> HscEnv -> HscEnv -#endif setNameCache nc hsc = hsc { hsc_NC = nc } -#if MIN_VERSION_ghc(9,3,0) -- This function checks the important property that if both p and q are home units -- then any dependency of p, which transitively depends on q is also a home unit. -- GHC had an implementation of this function, but it was horribly inefficient @@ -890,7 +857,6 @@ checkHomeUnitsClosed' ue home_id_set Just depends -> let todo'' = (depends OS.\\ done) `OS.union` todo' in DigraphNode uid uid (OS.toList depends) : go (OS.insert uid done) todo'' -#endif -- | Create a mapping from FilePaths to HscEnvEqs -- This combines all the components we know about into @@ -899,14 +865,12 @@ checkHomeUnitsClosed' ue home_id_set newComponentCache :: Recorder (WithPriority Log) -> [String] -- ^ File extensions to consider - -> Maybe FilePath -- ^ Path to cradle -> NormalizedFilePath -- ^ Path to file that caused the creation of this component -> HscEnv -- ^ An empty HscEnv -> [ComponentInfo] -- ^ New components to be loaded -> [ComponentInfo] -- ^ old, already existing components - -> FilePath -- ^ root dir, see Note [Root Directory] -> IO [ [TargetDetails] ] -newComponentCache recorder exts cradlePath _cfp hsc_env old_cis new_cis dir = do +newComponentCache recorder exts _cfp hsc_env old_cis new_cis = do let cis = Map.unionWith unionCIs (mkMap new_cis) (mkMap old_cis) -- When we have multiple components with the same uid, -- prefer the new one over the old. @@ -920,7 +884,6 @@ newComponentCache recorder exts cradlePath _cfp hsc_env old_cis new_cis dir = do hscEnv' <- -- Set up a multi component session with the other units on GHC 9.4 Compat.initUnits dfs hsc_env -#if MIN_VERSION_ghc(9,3,0) let closure_errs = checkHomeUnitsClosed' (hsc_unit_env hscEnv') (hsc_all_home_unit_ids hscEnv') multi_errs = map (ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Warning) _cfp . T.pack . Compat.printWithoutUniques) closure_errs bad_units = OS.fromList $ concat $ do @@ -928,10 +891,6 @@ newComponentCache recorder exts cradlePath _cfp hsc_env old_cis new_cis dir = do DriverHomePackagesNotClosed us <- pure x pure us isBad ci = (homeUnitId_ (componentDynFlags ci)) `OS.member` bad_units -#else - let isBad = const False - multi_errs = [] -#endif -- Whenever we spin up a session on Linux, dynamically load libm.so.6 -- in. We need this in case the binary is statically linked, in which -- case the interactive session will fail when trying to load @@ -951,26 +910,12 @@ newComponentCache recorder exts cradlePath _cfp hsc_env old_cis new_cis dir = do forM (Map.elems cis) $ \ci -> do let df = componentDynFlags ci - let createHscEnvEq = maybe newHscEnvEqPreserveImportPaths (newHscEnvEq dir) cradlePath thisEnv <- do -#if MIN_VERSION_ghc(9,3,0) -- In GHC 9.4 we have multi component support, and we have initialised all the units -- above. -- We just need to set the current unit here pure $ hscSetActiveUnitId (homeUnitId_ df) hscEnv' -#else - -- This initializes the units for GHC 9.2 - -- Add the options for the current component to the HscEnv - -- We want to call `setSessionDynFlags` instead of `hscSetFlags` - -- because `setSessionDynFlags` also initializes the package database, - -- which we need for any changes to the package flags in the dynflags - -- to be visible. - -- See #2693 - evalGhcEnv hscEnv' $ do - _ <- setSessionDynFlags df - getSession -#endif - henv <- createHscEnvEq thisEnv (zip uids dfs) + henv <- newHscEnvEq thisEnv let targetEnv = (if isBad ci then multi_errs else [], Just henv) targetDepends = componentDependencyInfo ci logWith recorder Debug $ LogNewComponentCache (targetEnv, targetDepends) @@ -1201,7 +1146,6 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do initOne this_opts = do (dflags', targets') <- addCmdOpts this_opts dflags let dflags'' = -#if MIN_VERSION_ghc(9,3,0) case unitIdString (homeUnitId_ dflags') of -- cabal uses main for the unit id of all executable packages -- This makes multi-component sessions confused about what @@ -1214,9 +1158,6 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do hashed_uid = Compat.toUnitId (Compat.stringToUnit ("main-"++hash)) in setHomeUnitId_ hashed_uid dflags' _ -> dflags' -#else - dflags' -#endif let targets = makeTargetsAbsolute root targets' root = case workingDirectory dflags'' of @@ -1236,14 +1177,7 @@ setOptions cfp (ComponentOptions theOpts compRoot _) dflags rootDir = do Compat.setUpTypedHoles $ makeDynFlagsAbsolute compRoot -- makeDynFlagsAbsolute already accounts for workingDirectory dflags'' - -- initPackages parses the -package flags and - -- sets up the visibility for each component. - -- Throws if a -package flag cannot be satisfied. - -- This only works for GHC <9.2 - -- For GHC >= 9.2, we need to modify the unit env in the hsc_dflags, which - -- is done later in newComponentCache - final_flags <- liftIO $ wrapPackageSetupException $ Compat.oldInitUnits dflags''' - return (final_flags, targets) + return (dflags''', targets) setIgnoreInterfacePragmas :: DynFlags -> DynFlags setIgnoreInterfacePragmas df = @@ -1289,12 +1223,6 @@ data PackageSetupException instance Exception PackageSetupException --- | Wrap any exception as a 'PackageSetupException' -wrapPackageSetupException :: IO a -> IO a -wrapPackageSetupException = handleAny $ \case - e | Just (pkgE :: PackageSetupException) <- fromException e -> throwIO pkgE - e -> (throwIO . PackageSetupException . show) e - showPackageSetupException :: PackageSetupException -> String showPackageSetupException GhcVersionMismatch{..} = unwords ["ghcide compiled against GHC" diff --git a/ghcide/src/Development/IDE.hs b/ghcide/src/Development/IDE.hs index 547ac9a115..7ec68bc8af 100644 --- a/ghcide/src/Development/IDE.hs +++ b/ghcide/src/Development/IDE.hs @@ -50,7 +50,6 @@ import Development.IDE.Graph as X (Action, RuleResult, import Development.IDE.Plugin as X import Development.IDE.Types.Diagnostics as X import Development.IDE.Types.HscEnvEq as X (HscEnvEq (..), - hscEnv, - hscEnvWithImportPaths) + hscEnv) import Development.IDE.Types.Location as X import Ide.Logger as X diff --git a/ghcide/src/Development/IDE/Core/Compile.hs b/ghcide/src/Development/IDE/Core/Compile.hs index f320e36c1e..4f689290fd 100644 --- a/ghcide/src/Development/IDE/Core/Compile.hs +++ b/ghcide/src/Development/IDE/Core/Compile.hs @@ -67,7 +67,6 @@ import Data.Proxy (Proxy (Proxy)) import qualified Data.Text as T import Data.Time (UTCTime (..)) import Data.Tuple.Extra (dupe) -import Data.Unique as Unique import Debug.Trace import Development.IDE.Core.FileStore (resetInterfaceStore) import Development.IDE.Core.Preprocessor @@ -75,12 +74,14 @@ import Development.IDE.Core.RuleTypes import Development.IDE.Core.Shake import Development.IDE.Core.Tracing (withTrace) import Development.IDE.Core.WorkerThread (writeWorkerQueue) -import Development.IDE.GHC.Compat hiding (loadInterface, - parseHeader, parseModule, - tcRnModule, writeHieFile, assert) +import Development.IDE.GHC.Compat hiding (assert, + loadInterface, parseHeader, + parseModule, tcRnModule, + writeHieFile) import qualified Development.IDE.GHC.Compat as Compat import qualified Development.IDE.GHC.Compat as GHC import qualified Development.IDE.GHC.Compat.Util as Util +import Development.IDE.Core.ProgressReporting (ProgressReporting (..), progressReportingOutsideState) import Development.IDE.GHC.CoreFile import Development.IDE.GHC.Error import Development.IDE.GHC.Orphans () @@ -97,7 +98,6 @@ import GHC.Serialized import HieDb hiding (withHieDb) import qualified Language.LSP.Protocol.Message as LSP import Language.LSP.Protocol.Types (DiagnosticTag (..)) -import qualified Language.LSP.Protocol.Types as LSP import qualified Language.LSP.Server as LSP import Prelude hiding (mod) import System.Directory @@ -112,15 +112,8 @@ import GHC.Types.TypeEnv -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import Data.Map (Map) -import GHC.Unit.Module.Graph (ModuleGraph) -import Unsafe.Coerce -#endif -#if MIN_VERSION_ghc(9,3,0) import qualified Data.Set as Set -#endif #if MIN_VERSION_ghc(9,5,0) import GHC.Core.Lint.Interactive @@ -224,11 +217,7 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do -- come from in the IORef,, as these are the modules on whose implementation -- we depend. compile_bco_hook :: IORef (ModuleEnv BS.ByteString) -> HscEnv -> SrcSpan -> CoreExpr -#if MIN_VERSION_ghc(9,3,0) -> IO (ForeignHValue, [Linkable], PkgsLoaded) -#else - -> IO ForeignHValue -#endif compile_bco_hook var hsc_env srcspan ds_expr = do { let dflags = hsc_dflags hsc_env @@ -248,10 +237,8 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do ; let iNTERACTIVELoc = G.ModLocation{ ml_hs_file = Nothing, ml_hi_file = panic "hscCompileCoreExpr':ml_hi_file", ml_obj_file = panic "hscCompileCoreExpr':ml_obj_file", -#if MIN_VERSION_ghc(9,3,0) ml_dyn_obj_file = panic "hscCompileCoreExpr':ml_dyn_obj_file", ml_dyn_hi_file = panic "hscCompileCoreExpr':ml_dyn_hi_file", -#endif ml_hie_file = panic "hscCompileCoreExpr':ml_hie_file" } ; let ictxt = hsc_IC hsc_env @@ -260,9 +247,7 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do myCoreToStgExpr (hsc_logger hsc_env) (hsc_dflags hsc_env) ictxt -#if MIN_VERSION_ghc(9,3,0) True -- for bytecode -#endif (icInteractiveModule ictxt) iNTERACTIVELoc prepd_expr @@ -280,11 +265,7 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do -- Find the linkables for the modules we need ; let needed_mods = mkUniqSet [ -#if MIN_VERSION_ghc(9,3,0) mod -- We need the whole module for 9.4 because of multiple home units modules may have different unit ids -#else - moduleName mod -- On <= 9.2, just the name is enough because all unit ids will be the same -#endif | n <- concatMap (uniqDSetToList . bcoFreeNames) $ bc_bcos bcos , not (isWiredInName n) -- Exclude wired-in names @@ -292,27 +273,14 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do , moduleUnitId mod `elem` home_unit_ids -- Only care about stuff from the home package set ] home_unit_ids = -#if MIN_VERSION_ghc(9,3,0) map fst (hugElts $ hsc_HUG hsc_env) -#else - [homeUnitId_ dflags] -#endif mods_transitive = getTransitiveMods hsc_env needed_mods -- If we don't support multiple home units, ModuleNames are sufficient because all the units will be the same mods_transitive_list = -#if MIN_VERSION_ghc(9,3,0) mapMaybe nodeKeyToInstalledModule $ Set.toList mods_transitive -#else - -- Non det OK as we will put it into maps later anyway - map (Compat.installedModule (homeUnitId_ dflags)) $ nonDetEltsUniqSet mods_transitive -#endif -#if MIN_VERSION_ghc(9,3,0) ; moduleLocs <- readIORef (fcModuleCache $ hsc_FC hsc_env) -#else - ; moduleLocs <- readIORef (hsc_FC hsc_env) -#endif ; lbs <- getLinkables [toNormalizedFilePath' file | installedMod <- mods_transitive_list , let ifr = fromJust $ lookupInstalledModuleEnv moduleLocs installedMod @@ -323,20 +291,13 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do ] ; let hsc_env' = loadModulesHome (map linkableHomeMod lbs) hsc_env -#if MIN_VERSION_ghc(9,3,0) {- load it -} ; (fv_hvs, lbss, pkgs) <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos ; let hval = ((expectJust "hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs), lbss, pkgs) -#else - {- load it -} - ; fv_hvs <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos - ; let hval = expectJust "hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs -#endif ; modifyIORef' var (flip extendModuleEnvList [(mi_module $ hm_iface hm, linkableHash lb) | lb <- lbs, let hm = linkableHomeMod lb]) ; return hval } -#if MIN_VERSION_ghc(9,3,0) -- TODO: support backpack nodeKeyToInstalledModule :: NodeKey -> Maybe InstalledModule -- We shouldn't get boot files here, but to be safe, never map them to an installed module @@ -347,28 +308,13 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do nodeKeyToInstalledModule _ = Nothing moduleToNodeKey :: Module -> NodeKey moduleToNodeKey mod = NodeKey_Module $ ModNodeKeyWithUid (GWIB (moduleName mod) NotBoot) (moduleUnitId mod) -#endif -- Compute the transitive set of linkables required getTransitiveMods hsc_env needed_mods -#if MIN_VERSION_ghc(9,3,0) = Set.unions (Set.fromList (map moduleToNodeKey mods) : [ dep | m <- mods , Just dep <- [Map.lookup (moduleToNodeKey m) (mgTransDeps (hsc_mod_graph hsc_env))] ]) where mods = nonDetEltsUniqSet needed_mods -- OK because we put them into a set immediately after -#else - = go emptyUniqSet needed_mods - where - hpt = hsc_HPT hsc_env - go seen new - | isEmptyUniqSet new = seen - | otherwise = go seen' new' - where - seen' = seen `unionUniqSets` new - new' = new_deps `minusUniqSet` seen' - new_deps = unionManyUniqSets [ mkUniqSet $ getDependentMods $ hm_iface mod_info - | mod_info <- eltsUDFM $ udfmIntersectUFM hpt (getUniqSet new)] -#endif -- | Add a Hook to the DynFlags which captures and returns the -- typechecked splices before they are run. This information @@ -412,9 +358,9 @@ tcRnModule hsc_env tc_helpers pmod = do ((tc_gbl_env', mrn_info), splices, mod_env) <- captureSplicesAndDeps tc_helpers hsc_env_tmp $ \hscEnvTmp -> do hscTypecheckRename hscEnvTmp ms $ - HsParsedModule { hpm_module = parsedSource pmod, - hpm_src_files = pm_extra_src_files pmod, - hpm_annotations = pm_annotations pmod } + HsParsedModule { hpm_module = parsedSource pmod + , hpm_src_files = pm_extra_src_files pmod + } let rn_info = case mrn_info of Just x -> x Nothing -> error "no renamed info tcRnModule" @@ -443,12 +389,8 @@ tcRnModule hsc_env tc_helpers pmod = do -- HLS. To avoid GHC from pessimising HLS, we filter out certain dependency information -- that we track ourselves. See also Note [Recompilation avoidance in the presence of TH] filterUsages :: [Usage] -> [Usage] -#if MIN_VERSION_ghc(9,3,0) filterUsages = filter $ \case UsageHomeModuleInterface{} -> False _ -> True -#else -filterUsages = id -#endif -- | Mitigation for https://gitlab.haskell.org/ghc/ghc/-/issues/22744 -- Important to do this immediately after reading the unit before @@ -499,9 +441,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do (cg_binds guts) #endif details -#if MIN_VERSION_ghc(9,3,0) ms -#endif simplified_guts final_iface' <- mkFullIface session partial_iface Nothing @@ -553,17 +493,9 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do -- Run corePrep first as we want to test the final version of the program that will -- get translated to STG/Bytecode -#if MIN_VERSION_ghc(9,3,0) prepd_binds -#else - (prepd_binds , _) -#endif <- corePrep unprep_binds data_tycons -#if MIN_VERSION_ghc(9,3,0) prepd_binds' -#else - (prepd_binds', _) -#endif <- corePrep unprep_binds' data_tycons let binds = noUnfoldings $ (map flattenBinds . (:[])) prepd_binds binds' = noUnfoldings $ (map flattenBinds . (:[])) prepd_binds' @@ -660,11 +592,7 @@ generateObjectCode session summary guts = do let env' = tweak (hscSetFlags (ms_hspp_opts summary) session) target = platformDefaultBackend (hsc_dflags env') newFlags = setBackend target $ updOptLevel 0 $ setOutputFile -#if MIN_VERSION_ghc(9,3,0) (Just dot_o) -#else - dot_o -#endif $ hsc_dflags env' session' = hscSetFlags newFlags session #if MIN_VERSION_ghc(9,4,2) @@ -675,13 +603,9 @@ generateObjectCode session summary guts = do (ms_location summary) fp obj <- compileFile session' driverNoStop (outputFilename, Just (As False)) -#if MIN_VERSION_ghc(9,3,0) case obj of Nothing -> throwGhcExceptionIO $ Panic "compileFile didn't generate object code" Just x -> pure x -#else - return obj -#endif let unlinked = DotO dot_o_fp -- Need time to be the modification time for recompilation checking t <- liftIO $ getModificationTime dot_o_fp @@ -726,17 +650,10 @@ update_pm_mod_summary :: (ModSummary -> ModSummary) -> ParsedModule -> ParsedMod update_pm_mod_summary up pm = pm{pm_mod_summary = up $ pm_mod_summary pm} -#if MIN_VERSION_ghc(9,3,0) unDefer :: (Maybe DiagnosticReason, FileDiagnostic) -> (Bool, FileDiagnostic) unDefer (Just (WarningWithFlag Opt_WarnDeferredTypeErrors) , fd) = (True, upgradeWarningToError fd) unDefer (Just (WarningWithFlag Opt_WarnTypedHoles) , fd) = (True, upgradeWarningToError fd) unDefer (Just (WarningWithFlag Opt_WarnDeferredOutOfScopeVariables), fd) = (True, upgradeWarningToError fd) -#else -unDefer :: (WarnReason, FileDiagnostic) -> (Bool, FileDiagnostic) -unDefer (Reason Opt_WarnDeferredTypeErrors , fd) = (True, upgradeWarningToError fd) -unDefer (Reason Opt_WarnTypedHoles , fd) = (True, upgradeWarningToError fd) -unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = (True, upgradeWarningToError fd) -#endif unDefer ( _ , fd) = (False, fd) upgradeWarningToError :: FileDiagnostic -> FileDiagnostic @@ -745,13 +662,8 @@ upgradeWarningToError (nfp, sh, fd) = warn2err :: T.Text -> T.Text warn2err = T.intercalate ": error:" . T.splitOn ": warning:" -#if MIN_VERSION_ghc(9,3,0) hideDiag :: DynFlags -> (Maybe DiagnosticReason, FileDiagnostic) -> (Maybe DiagnosticReason, FileDiagnostic) hideDiag originalFlags (w@(Just (WarningWithFlag warning)), (nfp, _sh, fd)) -#else -hideDiag :: DynFlags -> (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic) -hideDiag originalFlags (w@(Reason warning), (nfp, _sh, fd)) -#endif | not (wopt warning originalFlags) = (w, (nfp, HideDiag, fd)) hideDiag _originalFlags t = t @@ -774,11 +686,7 @@ unnecessaryDeprecationWarningFlags ] -- | Add a unnecessary/deprecated tag to the required diagnostics. -#if MIN_VERSION_ghc(9,3,0) tagDiag :: (Maybe DiagnosticReason, FileDiagnostic) -> (Maybe DiagnosticReason, FileDiagnostic) -#else -tagDiag :: (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic) -#endif #if MIN_VERSION_ghc(9,7,0) tagDiag (w@(Just (WarningWithCategory cat)), (nfp, sh, fd)) @@ -787,12 +695,8 @@ tagDiag (w@(Just (WarningWithCategory cat)), (nfp, sh, fd)) tagDiag (w@(Just (WarningWithFlags warnings)), (nfp, sh, fd)) | tags <- mapMaybe requiresTag (toList warnings) = (w, (nfp, sh, fd { _tags = Just $ tags ++ concat (_tags fd) })) -#elif MIN_VERSION_ghc(9,3,0) -tagDiag (w@(Just (WarningWithFlag warning)), (nfp, sh, fd)) - | Just tag <- requiresTag warning - = (w, (nfp, sh, fd { _tags = Just $ tag : concat (_tags fd) })) #else -tagDiag (w@(Reason warning), (nfp, sh, fd)) +tagDiag (w@(Just (WarningWithFlag warning)), (nfp, sh, fd)) | Just tag <- requiresTag warning = (w, (nfp, sh, fd { _tags = Just $ tag : concat (_tags fd) })) #endif @@ -835,21 +739,11 @@ generateHieAsts hscEnv tcm = top_ev_binds = tcg_ev_binds ts :: Util.Bag EvBind insts = tcg_insts ts :: [ClsInst] tcs = tcg_tcs ts :: [TyCon] - run ts $ -#if MIN_VERSION_ghc(9,3,0) - pure $ Just $ -#else - Just <$> -#endif - GHC.enrichHie (fake_splice_binds `Util.unionBags` real_binds) (tmrRenamed tcm) top_ev_binds insts tcs + + pure $ Just $ + GHC.enrichHie (fake_splice_binds `Util.unionBags` real_binds) (tmrRenamed tcm) top_ev_binds insts tcs where dflags = hsc_dflags hscEnv - run _ts = -- ts is only used in GHC 9.2 -#if !MIN_VERSION_ghc(9,3,0) - fmap (join . snd) . liftIO . initDs hscEnv _ts -#else - id -#endif spliceExpressions :: Splices -> [LHsExpr GhcTc] spliceExpressions Splices{..} = @@ -891,7 +785,6 @@ spliceExpressions Splices{..} = -- indexHieFile :: ShakeExtras -> ModSummary -> NormalizedFilePath -> Util.Fingerprint -> Compat.HieFile -> IO () indexHieFile se mod_summary srcPath !hash hf = do - IdeOptions{optProgressStyle} <- getIdeOptionsIO se atomically $ do pending <- readTVar indexPending case HashMap.lookup srcPath pending of @@ -912,69 +805,14 @@ indexHieFile se mod_summary srcPath !hash hf = do unless newerScheduled $ do -- Using bracket, so even if an exception happen during withHieDb call, -- the `post` (which clean the progress indicator) will still be called. - bracket_ (pre optProgressStyle) post $ + bracket_ pre post $ withHieDb (\db -> HieDb.addRefsFromLoaded db targetPath (HieDb.RealFile $ fromNormalizedFilePath srcPath) hash hf') where mod_location = ms_location mod_summary targetPath = Compat.ml_hie_file mod_location HieDbWriter{..} = hiedbWriter se - -- Get a progress token to report progress and update it for the current file - pre style = do - tok <- modifyVar indexProgressToken $ fmap dupe . \case - x@(Just _) -> pure x - -- Create a token if we don't already have one - Nothing -> do - case lspEnv se of - Nothing -> pure Nothing - Just env -> LSP.runLspT env $ do - u <- LSP.ProgressToken . LSP.InR . T.pack . show . hashUnique <$> liftIO Unique.newUnique - -- TODO: Wait for the progress create response to use the token - _ <- LSP.sendRequest LSP.SMethod_WindowWorkDoneProgressCreate (LSP.WorkDoneProgressCreateParams u) (const $ pure ()) - LSP.sendNotification LSP.SMethod_Progress $ LSP.ProgressParams u $ - toJSON $ LSP.WorkDoneProgressBegin - { _kind = LSP.AString @"begin" - , _title = "Indexing" - , _cancellable = Nothing - , _message = Nothing - , _percentage = Nothing - } - pure (Just u) - - (!done, !remaining) <- atomically $ do - done <- readTVar indexCompleted - remaining <- HashMap.size <$> readTVar indexPending - pure (done, remaining) - let - progressFrac :: Double - progressFrac = fromIntegral done / fromIntegral (done + remaining) - progressPct :: LSP.UInt - progressPct = floor $ 100 * progressFrac - - whenJust (lspEnv se) $ \env -> whenJust tok $ \token -> LSP.runLspT env $ - LSP.sendNotification LSP.SMethod_Progress $ LSP.ProgressParams token $ - toJSON $ - case style of - Percentage -> LSP.WorkDoneProgressReport - { _kind = LSP.AString @"report" - , _cancellable = Nothing - , _message = Nothing - , _percentage = Just progressPct - } - Explicit -> LSP.WorkDoneProgressReport - { _kind = LSP.AString @"report" - , _cancellable = Nothing - , _message = Just $ - T.pack " (" <> T.pack (show done) <> "/" <> T.pack (show $ done + remaining) <> ")..." - , _percentage = Nothing - } - NoProgress -> LSP.WorkDoneProgressReport - { _kind = LSP.AString @"report" - , _cancellable = Nothing - , _message = Nothing - , _percentage = Nothing - } - + pre = progressUpdate indexProgressReporting ProgressStarted -- Report the progress once we are done indexing this file post = do mdone <- atomically $ do @@ -989,18 +827,7 @@ indexHieFile se mod_summary srcPath !hash hf = do when (coerce $ ideTesting se) $ LSP.sendNotification (LSP.SMethod_CustomMethod (Proxy @"ghcide/reference/ready")) $ toJSON $ fromNormalizedFilePath srcPath - whenJust mdone $ \done -> - modifyVar_ indexProgressToken $ \tok -> do - whenJust (lspEnv se) $ \env -> LSP.runLspT env $ - whenJust tok $ \token -> - LSP.sendNotification LSP.SMethod_Progress $ LSP.ProgressParams token $ - toJSON $ - LSP.WorkDoneProgressEnd - { _kind = LSP.AString @"end" - , _message = Just $ "Finished indexing " <> T.pack (show done) <> " files" - } - -- We are done with the current indexing cycle, so destroy the token - pure Nothing + whenJust mdone $ \_ -> progressUpdate indexProgressReporting ProgressCompleted writeAndIndexHieFile :: HscEnv -> ShakeExtras -> ModSummary -> NormalizedFilePath -> [GHC.AvailInfo] -> HieASTs Type -> BS.ByteString -> IO [FileDiagnostic] writeAndIndexHieFile hscEnv se mod_summary srcPath exports ast source = @@ -1049,7 +876,6 @@ handleGenerationErrors' dflags source action = -- transitive dependencies will be contained in envs) mergeEnvs :: HscEnv -> ModuleGraph -> ModSummary -> [HomeModInfo] -> [HscEnv] -> IO HscEnv mergeEnvs env mg ms extraMods envs = do -#if MIN_VERSION_ghc(9,3,0) let im = Compat.installedModule (toUnitId $ moduleUnit $ ms_mod ms) (moduleName (ms_mod ms)) ifr = InstalledFound (ms_location ms) im curFinderCache = Compat.extendInstalledModuleEnv Compat.emptyInstalledModuleEnv im ifr @@ -1084,31 +910,6 @@ mergeEnvs env mg ms extraMods envs = do fcFiles' <- newIORef $! Map.unions fcFiles pure $ FinderCache fcModules' fcFiles' -#else - prevFinderCache <- concatFC <$> mapM (readIORef . hsc_FC) envs - let im = Compat.installedModule (toUnitId $ moduleUnit $ ms_mod ms) (moduleName (ms_mod ms)) - ifr = InstalledFound (ms_location ms) im - newFinderCache <- newIORef $! Compat.extendInstalledModuleEnv prevFinderCache im ifr - return $! loadModulesHome extraMods $ - env{ - hsc_HPT = foldMapBy mergeUDFM emptyUDFM hsc_HPT envs, - hsc_FC = newFinderCache, - hsc_mod_graph = mg - } - - where - mergeUDFM = plusUDFM_C combineModules - combineModules a b - | HsSrcFile <- mi_hsc_src (hm_iface a) = a - | otherwise = b - -- required because 'FinderCache': - -- 1) doesn't have a 'Monoid' instance, - -- 2) is abstract and doesn't export constructors - -- To work around this, we coerce to the underlying type - -- To remove this, I plan to upstream the missing Monoid instance - concatFC :: [FinderCache] -> FinderCache - concatFC = unsafeCoerce (mconcat @(Map InstalledModule InstalledFindResult)) -#endif withBootSuffix :: HscSource -> ModLocation -> ModLocation withBootSuffix HsBootFile = addBootSuffixLocnOut @@ -1153,24 +954,16 @@ getModSummaryFromImports env fp _modTime mContents = do convImport (L _ i) = ( -#if !MIN_VERSION_ghc(9,3,0) - fmap sl_fs -#endif (ideclPkgQual i) , reLoc $ ideclName i) msrImports = implicit_imports ++ imps -#if MIN_VERSION_ghc(9,3,0) rn_pkg_qual = renameRawPkgQual (hsc_unit_env ppEnv) rn_imps = fmap (\(pk, lmn@(L _ mn)) -> (rn_pkg_qual mn pk, lmn)) srcImports = rn_imps $ map convImport src_idecls textualImports = rn_imps $ map convImport (implicit_imports ++ ordinary_imps) ghc_prim_import = not (null _ghc_prim_imports) -#else - srcImports = map convImport src_idecls - textualImports = map convImport (implicit_imports ++ ordinary_imps) -#endif -- Force bits that might keep the string buffer and DynFlags alive unnecessarily @@ -1190,14 +983,10 @@ getModSummaryFromImports env fp _modTime mContents = do ModSummary { ms_mod = modl , ms_hie_date = Nothing -#if MIN_VERSION_ghc(9,3,0) , ms_dyn_obj_date = Nothing , ms_ghc_prim_import = ghc_prim_import , ms_hs_hash = _src_hash -#else - , ms_hs_date = _modTime -#endif , ms_hsc_src = sourceType -- The contents are used by the GetModSummary rule , ms_hspp_buf = Just contents @@ -1222,14 +1011,10 @@ getModSummaryFromImports env fp _modTime mContents = do put $ Util.uniq $ moduleNameFS $ moduleName ms_mod forM_ (ms_srcimps ++ ms_textual_imps) $ \(mb_p, m) -> do put $ Util.uniq $ moduleNameFS $ unLoc m -#if MIN_VERSION_ghc(9,3,0) case mb_p of - G.NoPkgQual -> pure () + G.NoPkgQual -> pure () G.ThisPkg uid -> put $ getKey $ getUnique uid G.OtherPkg uid -> put $ getKey $ getUnique uid -#else - whenJust mb_p $ put . Util.uniq -#endif return $! Util.fingerprintFingerprints $ [ Util.fingerprintString fp , fingerPrintImports @@ -1287,7 +1072,6 @@ parseFileContents env customPreprocessor filename ms = do PFailedWithErrorMessages msgs -> throwE $ diagFromErrMsgs sourceParser dflags $ msgs dflags POk pst rdr_module -> let - hpm_annotations = mkApiAnns pst psMessages = getPsMessages pst in do @@ -1297,7 +1081,7 @@ parseFileContents env customPreprocessor filename ms = do throwE $ diagFromStrings sourceParser DiagnosticSeverity_Error errs let preproc_warnings = diagFromStrings sourceParser DiagnosticSeverity_Warning preproc_warns - (parsed', msgs) <- liftIO $ applyPluginsParsedResultAction env ms hpm_annotations parsed psMessages + (parsed', msgs) <- liftIO $ applyPluginsParsedResultAction env ms parsed psMessages let (warns, errors) = renderMessages msgs -- Just because we got a `POk`, it doesn't mean there @@ -1324,11 +1108,7 @@ parseFileContents env customPreprocessor filename ms = do -- - filter out the .hs/.lhs source filename if we have one -- let n_hspp = normalise filename -#if MIN_VERSION_ghc(9,3,0) TempDir tmp_dir = tmpDir dflags -#else - tmp_dir = tmpDir dflags -#endif srcs0 = nubOrd $ filter (not . (tmp_dir `isPrefixOf`)) $ filter (/= n_hspp) $ map normalise @@ -1344,7 +1124,7 @@ parseFileContents env customPreprocessor filename ms = do -- filter them out: srcs2 <- liftIO $ filterM doesFileExist srcs1 - let pm = ParsedModule ms parsed' srcs2 hpm_annotations + let pm = ParsedModule ms parsed' srcs2 warnings = diagFromErrMsgs sourceParser dflags warns pure (warnings ++ preproc_warnings, pm) @@ -1475,14 +1255,9 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do -- ncu and read_dflags are only used in GHC >= 9.4 let _ncu = hsc_NC sessionWithMsDynFlags _read_dflags = hsc_dflags sessionWithMsDynFlags -#if MIN_VERSION_ghc(9,3,0) read_result <- liftIO $ readIface _read_dflags _ncu mod iface_file -#else - read_result <- liftIO $ initIfaceCheck (text "readIface") sessionWithMsDynFlags - $ readIface mod iface_file -#endif case read_result of - Util.Failed{} -> return Nothing + Util.Failed{} -> return Nothing -- important to call `shareUsages` here before checkOldIface -- consults `mi_usages` Util.Succeeded iface -> return $ Just (shareUsages iface) @@ -1490,13 +1265,9 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do -- If mb_old_iface is nothing then checkOldIface will load it for us -- given that the source is unmodified (recomp_iface_reqd, mb_checked_iface) -#if MIN_VERSION_ghc(9,3,0) <- liftIO $ checkOldIface sessionWithMsDynFlags ms _old_iface >>= \case UpToDateItem x -> pure (UpToDate, Just x) OutOfDateItem reason x -> pure (NeedsRecompile reason, x) -#else - <- liftIO $ checkOldIface sessionWithMsDynFlags ms _sourceMod mb_old_iface -#endif let do_regenerate _reason = withTrace "regenerate interface" $ \setTag -> do setTag "Module" $ moduleNameString $ moduleName mod @@ -1551,11 +1322,7 @@ parseRuntimeDeps anns = mkModuleEnv $ mapMaybe go anns -- See Note [Recompilation avoidance in the presence of TH] checkLinkableDependencies :: MonadIO m => HscEnv -> ([NormalizedFilePath] -> m [BS.ByteString]) -> ModuleEnv BS.ByteString -> m (Maybe RecompileRequired) checkLinkableDependencies hsc_env get_linkable_hashes runtime_deps = do -#if MIN_VERSION_ghc(9,3,0) moduleLocs <- liftIO $ readIORef (fcModuleCache $ hsc_FC hsc_env) -#else - moduleLocs <- liftIO $ readIORef (hsc_FC hsc_env) -#endif let go (mod, hash) = do ifr <- lookupInstalledModuleEnv moduleLocs $ Compat.installedModule (toUnitId $ moduleUnit mod) (moduleName mod) case ifr of @@ -1576,27 +1343,16 @@ checkLinkableDependencies hsc_env get_linkable_hashes runtime_deps = do recompBecause :: String -> RecompileRequired recompBecause = -#if MIN_VERSION_ghc(9,3,0) NeedsRecompile . -#endif RecompBecause -#if MIN_VERSION_ghc(9,3,0) . CustomReason -#endif -#if MIN_VERSION_ghc(9,3,0) data SourceModified = SourceModified | SourceUnmodified deriving (Eq, Ord, Show) -#endif showReason :: RecompileRequired -> String -showReason UpToDate = "UpToDate" -#if MIN_VERSION_ghc(9,3,0) -showReason (NeedsRecompile MustCompile) = "MustCompile" -showReason (NeedsRecompile s) = printWithoutUniques s -#else -showReason MustCompile = "MustCompile" -showReason (RecompBecause s) = s -#endif +showReason UpToDate = "UpToDate" +showReason (NeedsRecompile MustCompile) = "MustCompile" +showReason (NeedsRecompile s) = printWithoutUniques s mkDetailsFromIface :: HscEnv -> ModIface -> IO ModDetails mkDetailsFromIface session iface = do @@ -1611,11 +1367,7 @@ coreFileToCgGuts session iface details core_file = do this_mod = mi_module iface types_var <- newIORef (md_types details) let hsc_env' = hscUpdateHPT act (session { -#if MIN_VERSION_ghc(9,3,0) hsc_type_env_vars = knotVarsFromModuleEnv (mkModuleEnv [(this_mod, types_var)]) -#else - hsc_type_env_var = Just (this_mod, types_var) -#endif }) core_binds <- initIfaceCheck (text "l") hsc_env' $ typecheckCoreFile this_mod types_var core_file -- Implicit binds aren't saved, so we need to regenerate them ourselves. @@ -1624,10 +1376,8 @@ coreFileToCgGuts session iface details core_file = do #if MIN_VERSION_ghc(9,5,0) -- In GHC 9.6, the implicit binds are tidied and part of core_binds pure $ CgGuts this_mod tyCons core_binds [] NoStubs [] mempty (emptyHpcInfo False) Nothing [] -#elif MIN_VERSION_ghc(9,3,0) - pure $ CgGuts this_mod tyCons (_implicit_binds ++ core_binds) [] NoStubs [] mempty (emptyHpcInfo False) Nothing [] #else - pure $ CgGuts this_mod tyCons (_implicit_binds ++ core_binds) NoStubs [] [] (emptyHpcInfo False) Nothing [] + pure $ CgGuts this_mod tyCons (_implicit_binds ++ core_binds) [] NoStubs [] mempty (emptyHpcInfo False) Nothing [] #endif coreFileToLinkable :: LinkableType -> HscEnv -> ModSummary -> ModIface -> ModDetails -> CoreFile -> UTCTime -> IO ([FileDiagnostic], Maybe HomeModInfo) @@ -1644,45 +1394,23 @@ coreFileToLinkable linkableType session ms iface details core_file t = do getDocsBatch :: HscEnv -> [Name] -#if MIN_VERSION_ghc(9,3,0) -> IO [Either String (Maybe [HsDoc GhcRn], IntMap (HsDoc GhcRn))] -#else - -> IO [Either String (Maybe HsDocString, IntMap HsDocString)] -#endif getDocsBatch hsc_env _names = do res <- initIfaceLoad hsc_env $ forM _names $ \name -> case nameModule_maybe name of Nothing -> return (Left $ NameHasNoModule name) Just mod -> do ModIface { -#if MIN_VERSION_ghc(9,3,0) mi_docs = Just Docs{ docs_mod_hdr = mb_doc_hdr , docs_decls = dmap , docs_args = amap } -#else - mi_doc_hdr = mb_doc_hdr - , mi_decl_docs = DeclDocMap dmap - , mi_arg_docs = ArgDocMap amap -#endif } <- loadSysInterface (text "getModuleInterface") mod -#if MIN_VERSION_ghc(9,3,0) if isNothing mb_doc_hdr && isNullUniqMap dmap && isNullUniqMap amap -#else - if isNothing mb_doc_hdr && Map.null dmap && null amap -#endif then pure (Left (NoDocsInIface mod $ compiled name)) else pure (Right ( -#if MIN_VERSION_ghc(9,3,0) lookupUniqMap dmap name, -#else - Map.lookup name dmap , -#endif -#if MIN_VERSION_ghc(9,3,0) lookupWithDefaultUniqMap amap mempty name)) -#else - Map.findWithDefault mempty name amap)) -#endif return $ map (first $ T.unpack . printOutputable) res where compiled n = @@ -1712,7 +1440,7 @@ lookupName hsc_env name = exceptionHandle $ do res <- initIfaceLoad hsc_env $ importDecl name case res of Util.Succeeded x -> return (Just x) - _ -> return Nothing + _ -> return Nothing where exceptionHandle x = x `catch` \(_ :: IOEnvFailure) -> pure Nothing diff --git a/ghcide/src/Development/IDE/Core/OfInterest.hs b/ghcide/src/Development/IDE/Core/OfInterest.hs index abcf6342a8..e85bfeaac2 100644 --- a/ghcide/src/Development/IDE/Core/OfInterest.hs +++ b/ghcide/src/Development/IDE/Core/OfInterest.hs @@ -141,7 +141,7 @@ kick = do toJSON $ map fromNormalizedFilePath files signal (Proxy @"kick/start") - liftIO $ progressUpdate progress KickStarted + progressUpdate progress ProgressNewStarted -- Update the exports map results <- uses GenerateCore files @@ -152,7 +152,7 @@ kick = do let mguts = catMaybes results void $ liftIO $ atomically $ modifyTVar' exportsMap (updateExportsMapMg mguts) - liftIO $ progressUpdate progress KickCompleted + progressUpdate progress ProgressCompleted GarbageCollectVar var <- getIdeGlobalAction garbageCollectionScheduled <- liftIO $ readVar var diff --git a/ghcide/src/Development/IDE/Core/Preprocessor.hs b/ghcide/src/Development/IDE/Core/Preprocessor.hs index 24a754870d..188fe39abe 100644 --- a/ghcide/src/Development/IDE/Core/Preprocessor.hs +++ b/ghcide/src/Development/IDE/Core/Preprocessor.hs @@ -33,9 +33,7 @@ import System.IO.Extra -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,3,0) import GHC.Utils.Logger (LogFlags (..)) -#endif -- | Given a file and some contents, apply any necessary preprocessors, -- e.g. unlit/cpp. Return the resulting buffer and the DynFlags it implies. @@ -88,11 +86,7 @@ preprocessor env filename mbContents = do where logAction :: IORef [CPPLog] -> LogActionCompat logAction cppLogs dflags _reason severity srcSpan _style msg = do -#if MIN_VERSION_ghc(9,3,0) let cppLog = CPPLog (fromMaybe SevWarning severity) srcSpan $ T.pack $ renderWithContext (log_default_user_context dflags) msg -#else - let cppLog = CPPLog severity srcSpan $ T.pack $ showSDoc dflags msg -#endif modifyIORef cppLogs (cppLog :) @@ -152,11 +146,7 @@ parsePragmasIntoHscEnv -> Util.StringBuffer -> IO (Either [FileDiagnostic] ([String], HscEnv)) parsePragmasIntoHscEnv env fp contents = catchSrcErrors dflags0 "pragmas" $ do -#if MIN_VERSION_ghc(9,3,0) let (_warns,opts) = getOptions (initParserOpts dflags0) contents fp -#else - let opts = getOptions dflags0 contents fp -#endif -- Force bits that might keep the dflags and stringBuffer alive unnecessarily evaluate $ rnf opts diff --git a/ghcide/src/Development/IDE/Core/ProgressReporting.hs b/ghcide/src/Development/IDE/Core/ProgressReporting.hs index b8c8a34d6f..7815a984ca 100644 --- a/ghcide/src/Development/IDE/Core/ProgressReporting.hs +++ b/ghcide/src/Development/IDE/Core/ProgressReporting.hs @@ -1,17 +1,19 @@ module Development.IDE.Core.ProgressReporting - ( ProgressEvent(..) - , ProgressReporting(..) - , noProgressReporting - , progressReporting - -- utilities, reexported for use in Core.Shake - , mRunLspT - , mRunLspTCallback - -- for tests - , recordProgress - , InProgressState(..) + ( ProgressEvent (..), + ProgressReporting (..), + noProgressReporting, + progressReporting, + progressReportingOutsideState, + -- utilities, reexported for use in Core.Shake + mRunLspT, + mRunLspTCallback, + -- for tests + recordProgress, + InProgressState (..), ) - where +where +import Control.Concurrent.STM (STM) import Control.Concurrent.STM.Stats (TVar, atomically, atomicallyNamed, modifyTVar', newTVarIO, readTVar, retry) @@ -23,7 +25,6 @@ import Control.Monad.Trans.Class (lift) import Data.Functor (($>)) import qualified Data.Text as T import Development.IDE.GHC.Orphans () -import Development.IDE.Graph hiding (ShakeValue) import Development.IDE.Types.Location import Development.IDE.Types.Options import qualified Focus @@ -33,119 +34,197 @@ import Language.LSP.Server (ProgressAmount (..), withProgress) import qualified Language.LSP.Server as LSP import qualified StmContainers.Map as STM -import UnliftIO (Async, async, cancel) +import UnliftIO (Async, MonadUnliftIO, async, + bracket, cancel) data ProgressEvent - = KickStarted - | KickCompleted + = ProgressNewStarted + | ProgressCompleted + | ProgressStarted -data ProgressReporting = ProgressReporting - { progressUpdate :: ProgressEvent -> IO () - , inProgress :: forall a. NormalizedFilePath -> Action a -> Action a - , progressStop :: IO () +data ProgressReporting m = ProgressReporting + { progressUpdate :: ProgressEvent -> m (), + inProgress :: forall a. NormalizedFilePath -> m a -> m a, + -- ^ see Note [ProgressReporting API and InProgressState] + progressStop :: IO () + -- ^ we are using IO here because creating and stopping the `ProgressReporting` + -- is different from how we use it. } -noProgressReporting :: IO ProgressReporting -noProgressReporting = return $ ProgressReporting - { progressUpdate = const $ pure () - , inProgress = const id - , progressStop = pure () - } +{- Note [ProgressReporting API and InProgressState] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The progress of tasks can be tracked in two ways: + +1. `InProgressState`: This is an internal state that actively tracks the progress. + Changes to the progress are made directly to this state. + +2. `InProgressStateOutSide`: This is an external state that tracks the progress. + The external state is converted into an STM Int for the purpose of reporting progress. + +The `inProgress` function is only useful when we are using `InProgressState`. + +An alternative design could involve using GADTs to eliminate this discrepancy between +`InProgressState` and `InProgressStateOutSide`. +-} + +noProgressReporting :: (MonadUnliftIO m) => IO (ProgressReporting m) +noProgressReporting = + return $ + ProgressReporting + { progressUpdate = const $ pure (), + inProgress = const id, + progressStop = pure () + } -- | State used in 'delayedProgressReporting' data State - = NotStarted - | Stopped - | Running (Async ()) + = NotStarted + | Stopped + | Running (Async ()) -- | State transitions used in 'delayedProgressReporting' data Transition = Event ProgressEvent | StopProgress updateState :: IO () -> Transition -> State -> IO State -updateState _ _ Stopped = pure Stopped -updateState start (Event KickStarted) NotStarted = Running <$> async start -updateState start (Event KickStarted) (Running job) = cancel job >> Running <$> async start -updateState _ (Event KickCompleted) (Running job) = cancel job $> NotStarted -updateState _ (Event KickCompleted) st = pure st -updateState _ StopProgress (Running job) = cancel job $> Stopped -updateState _ StopProgress st = pure st +updateState _ _ Stopped = pure Stopped +updateState start (Event ProgressNewStarted) NotStarted = Running <$> async start +updateState start (Event ProgressNewStarted) (Running job) = cancel job >> Running <$> async start +updateState start (Event ProgressStarted) NotStarted = Running <$> async start +updateState _ (Event ProgressStarted) (Running job) = return (Running job) +updateState _ (Event ProgressCompleted) (Running job) = cancel job $> NotStarted +updateState _ (Event ProgressCompleted) st = pure st +updateState _ StopProgress (Running job) = cancel job $> Stopped +updateState _ StopProgress st = pure st -- | Data structure to track progress across the project -data InProgressState = InProgressState - { todoVar :: TVar Int -- ^ Number of files to do - , doneVar :: TVar Int -- ^ Number of files done - , currentVar :: STM.Map NormalizedFilePath Int - } +-- see Note [ProgressReporting API and InProgressState] +data InProgressState + = InProgressState + { -- | Number of files to do + todoVar :: TVar Int, + -- | Number of files done + doneVar :: TVar Int, + currentVar :: STM.Map NormalizedFilePath Int + } + | InProgressStateOutSide + -- we transform the outside state into STM Int for progress reporting purposes + { -- | Number of files to do + todo :: STM Int, + -- | Number of files done + done :: STM Int + } newInProgress :: IO InProgressState newInProgress = InProgressState <$> newTVarIO 0 <*> newTVarIO 0 <*> STM.newIO recordProgress :: InProgressState -> NormalizedFilePath -> (Int -> Int) -> IO () -recordProgress InProgressState{..} file shift = do - (prev, new) <- atomicallyNamed "recordProgress" $ STM.focus alterPrevAndNew file currentVar - atomicallyNamed "recordProgress2" $ do - case (prev,new) of - (Nothing,0) -> modifyTVar' doneVar (+1) >> modifyTVar' todoVar (+1) - (Nothing,_) -> modifyTVar' todoVar (+1) - (Just 0, 0) -> pure () - (Just 0, _) -> modifyTVar' doneVar pred - (Just _, 0) -> modifyTVar' doneVar (+1) - (Just _, _) -> pure () +recordProgress InProgressStateOutSide {} _ _ = return () +recordProgress InProgressState {..} file shift = do + (prev, new) <- atomicallyNamed "recordProgress" $ STM.focus alterPrevAndNew file currentVar + atomicallyNamed "recordProgress2" $ do + case (prev, new) of + (Nothing, 0) -> modifyTVar' doneVar (+ 1) >> modifyTVar' todoVar (+ 1) + (Nothing, _) -> modifyTVar' todoVar (+ 1) + (Just 0, 0) -> pure () + (Just 0, _) -> modifyTVar' doneVar pred + (Just _, 0) -> modifyTVar' doneVar (+ 1) + (Just _, _) -> pure () where alterPrevAndNew = do - prev <- Focus.lookup - Focus.alter alter - new <- Focus.lookupWithDefault 0 - return (prev, new) + prev <- Focus.lookup + Focus.alter alter + new <- Focus.lookupWithDefault 0 + return (prev, new) alter x = let x' = maybe (shift 0) shift x in Just x' -progressReporting - :: Maybe (LSP.LanguageContextEnv c) - -> ProgressReportingStyle - -> IO ProgressReporting -progressReporting Nothing _optProgressStyle = noProgressReporting -progressReporting (Just lspEnv) optProgressStyle = do - inProgressState <- newInProgress - progressState <- newVar NotStarted - let progressUpdate event = updateStateVar $ Event event - progressStop = updateStateVar StopProgress - updateStateVar = modifyVar_ progressState . updateState (lspShakeProgressNew inProgressState) - inProgress = updateStateForFile inProgressState - return ProgressReporting{..} - where - lspShakeProgressNew :: InProgressState -> IO () - lspShakeProgressNew InProgressState{..} = - LSP.runLspT lspEnv $ withProgress "Processing" Nothing NotCancellable $ \update -> loop update 0 - where - loop _ _ | optProgressStyle == NoProgress = forever $ liftIO $ threadDelay maxBound - loop update prevPct = do - (todo, done, nextPct) <- liftIO $ atomically $ do - todo <- readTVar todoVar - done <- readTVar doneVar - let nextFrac :: Double - nextFrac = if todo == 0 then 0 else fromIntegral done / fromIntegral todo - nextPct :: UInt - nextPct = floor $ 100 * nextFrac - when (nextPct == prevPct) retry - pure (todo, done, nextPct) - - _ <- update (ProgressAmount (Just nextPct) (Just $ T.pack $ show done <> "/" <> show todo)) - loop update nextPct - updateStateForFile inProgress file = actionBracket (f succ) (const $ f pred) . const - -- This functions are deliberately eta-expanded to avoid space leaks. - -- Do not remove the eta-expansion without profiling a session with at - -- least 1000 modifications. - where - f shift = recordProgress inProgress file shift - -mRunLspT :: Applicative m => Maybe (LSP.LanguageContextEnv c ) -> LSP.LspT c m () -> m () + +-- | `progressReporting` initiates a new progress reporting session. +-- It necessitates the active tracking of progress using the `inProgress` function. +-- Refer to Note [ProgressReporting API and InProgressState] for more details. +progressReporting :: + (MonadUnliftIO m, MonadIO m) => + Maybe (LSP.LanguageContextEnv c) -> + T.Text -> + ProgressReportingStyle -> + IO (ProgressReporting m) +progressReporting = progressReporting' newInProgress + +-- | `progressReportingOutsideState` initiates a new progress reporting session. +-- It functions similarly to `progressReporting`, but it utilizes an external state for progress tracking. +-- Refer to Note [ProgressReporting API and InProgressState] for more details. +progressReportingOutsideState :: + (MonadUnliftIO m, MonadIO m) => + STM Int -> + STM Int -> + Maybe (LSP.LanguageContextEnv c) -> + T.Text -> + ProgressReportingStyle -> + IO (ProgressReporting m) +progressReportingOutsideState todo done = progressReporting' (pure $ InProgressStateOutSide todo done) + +progressReporting' :: + (MonadUnliftIO m, MonadIO m) => + IO InProgressState -> + Maybe (LSP.LanguageContextEnv c) -> + T.Text -> + ProgressReportingStyle -> + IO (ProgressReporting m) +progressReporting' _newState Nothing _title _optProgressStyle = noProgressReporting +progressReporting' newState (Just lspEnv) title optProgressStyle = do + inProgressState <- newState + progressState <- newVar NotStarted + let progressUpdate event = liftIO $ updateStateVar $ Event event + progressStop = updateStateVar StopProgress + updateStateVar = modifyVar_ progressState . updateState (lspShakeProgressNew inProgressState) + inProgress = updateStateForFile inProgressState + return ProgressReporting {..} + where + lspShakeProgressNew :: InProgressState -> IO () + lspShakeProgressNew InProgressStateOutSide {..} = progressCounter lspEnv title optProgressStyle todo done + lspShakeProgressNew InProgressState {..} = progressCounter lspEnv title optProgressStyle (readTVar todoVar) (readTVar doneVar) + updateStateForFile inProgress file = UnliftIO.bracket (liftIO $ f succ) (const $ liftIO $ f pred) . const + where + -- This functions are deliberately eta-expanded to avoid space leaks. + -- Do not remove the eta-expansion without profiling a session with at + -- least 1000 modifications. + + f shift = recordProgress inProgress file shift + +-- Kill this to complete the progress session +progressCounter :: + LSP.LanguageContextEnv c -> + T.Text -> + ProgressReportingStyle -> + STM Int -> + STM Int -> + IO () +progressCounter lspEnv title optProgressStyle getTodo getDone = + LSP.runLspT lspEnv $ withProgress title Nothing NotCancellable $ \update -> loop update 0 + where + loop _ _ | optProgressStyle == NoProgress = forever $ liftIO $ threadDelay maxBound + loop update prevPct = do + (todo, done, nextPct) <- liftIO $ atomically $ do + todo <- getTodo + done <- getDone + let nextFrac :: Double + nextFrac = if todo == 0 then 0 else fromIntegral done / fromIntegral todo + nextPct :: UInt + nextPct = floor $ 100 * nextFrac + when (nextPct == prevPct) retry + pure (todo, done, nextPct) + + _ <- update (ProgressAmount (Just nextPct) (Just $ T.pack $ show done <> "/" <> show todo)) + loop update nextPct + +mRunLspT :: (Applicative m) => Maybe (LSP.LanguageContextEnv c) -> LSP.LspT c m () -> m () mRunLspT (Just lspEnv) f = LSP.runLspT lspEnv f mRunLspT Nothing _ = pure () -mRunLspTCallback :: Monad m - => Maybe (LSP.LanguageContextEnv c) - -> (LSP.LspT c m a -> LSP.LspT c m a) - -> m a - -> m a +mRunLspTCallback :: + (Monad m) => + Maybe (LSP.LanguageContextEnv c) -> + (LSP.LspT c m a -> LSP.LspT c m a) -> + m a -> + m a mRunLspTCallback (Just lspEnv) f g = LSP.runLspT lspEnv $ f (lift g) mRunLspTCallback Nothing _ g = g diff --git a/ghcide/src/Development/IDE/Core/Rules.hs b/ghcide/src/Development/IDE/Core/Rules.hs index 13f6db6f69..582d3b560c 100644 --- a/ghcide/src/Development/IDE/Core/Rules.hs +++ b/ghcide/src/Development/IDE/Core/Rules.hs @@ -171,13 +171,8 @@ import GHC.Fingerprint -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC (mgModSummaries) -#endif -#if MIN_VERSION_ghc(9,3,0) import qualified Data.IntMap as IM -#endif @@ -324,18 +319,11 @@ getLocatedImportsRule recorder = (KnownTargets targets targetsMap) <- useNoFile_ GetKnownTargets let imports = [(False, imp) | imp <- ms_textual_imps ms] ++ [(True, imp) | imp <- ms_srcimps ms] env_eq <- use_ GhcSession file - let env = hscEnvWithImportPaths env_eq - let import_dirs = deps env_eq + let env = hscEnv env_eq + let import_dirs = map (second homeUnitEnv_dflags) $ hugElts $ hsc_HUG env let dflags = hsc_dflags env - isImplicitCradle = isNothing $ envImportPaths env_eq - let dflags' = if isImplicitCradle - then addRelativeImport file (moduleName $ ms_mod ms) dflags - else dflags opt <- getIdeOptions let getTargetFor modName nfp - | isImplicitCradle = do - itExists <- getFileExists nfp - return $ if itExists then Just nfp else Nothing | Just (TargetFile nfp') <- HM.lookup (TargetFile nfp) targetsMap = do -- reuse the existing NormalizedFilePath in order to maximize sharing itExists <- getFileExists nfp' @@ -346,10 +334,11 @@ getLocatedImportsRule recorder = nfp' = HM.lookupDefault nfp nfp ttmap itExists <- getFileExists nfp' return $ if itExists then Just nfp' else Nothing - | otherwise - = return Nothing + | otherwise = do + itExists <- getFileExists nfp + return $ if itExists then Just nfp else Nothing (diags, imports') <- fmap unzip $ forM imports $ \(isSource, (mbPkgName, modName)) -> do - diagOrImp <- locateModule (hscSetFlags dflags' env) import_dirs (optExtensions opt) getTargetFor modName mbPkgName isSource + diagOrImp <- locateModule (hscSetFlags dflags env) import_dirs (optExtensions opt) getTargetFor modName mbPkgName isSource case diagOrImp of Left diags -> pure (diags, Just (modName, Nothing)) Right (FileImport path) -> pure ([], Just (modName, Just path)) @@ -641,7 +630,6 @@ dependencyInfoForFiles fs = do let (all_fs, _all_ids) = unzip $ HM.toList $ pathToIdMap $ rawPathIdMap rawDepInfo msrs <- uses GetModSummaryWithoutTimestamps all_fs let mss = map (fmap msrModSummary) msrs -#if MIN_VERSION_ghc(9,3,0) let deps = map (\i -> IM.lookup (getFilePathId i) (rawImports rawDepInfo)) _all_ids nodeKeys = IM.fromList $ catMaybes $ zipWith (\fi mms -> (getFilePathId fi,) . NodeKey_Module . msKey <$> mms) _all_ids mss mns = catMaybes $ zipWith go mss deps @@ -651,14 +639,6 @@ dependencyInfoForFiles fs = do go (Just ms) _ = Just $ ModuleNode [] ms go _ _ = Nothing mg = mkModuleGraph mns -#else - let mg = mkModuleGraph $ - -- We don't do any instantiation for backpack at this point of time, so it is OK to use - -- 'extendModSummaryNoDeps'. - -- This may have to change in the future. - map extendModSummaryNoDeps $ - catMaybes mss -#endif pure (fingerprintToBS $ Util.fingerprintFingerprints $ map (maybe fingerprint0 msrFingerprint) msrs, processDependencyInformation rawDepInfo bm mg) -- This is factored out so it can be directly called from the GetModIface @@ -776,7 +756,6 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do then depModuleGraph <$> useNoFile_ GetModuleGraph else do let mgs = map hsc_mod_graph depSessions -#if MIN_VERSION_ghc(9,3,0) -- On GHC 9.4+, the module graph contains not only ModSummary's but each `ModuleNode` in the graph -- also points to all the direct descendants of the current module. To get the keys for the descendants -- we must get their `ModSummary`s @@ -785,14 +764,6 @@ ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do return $!! map (NodeKey_Module . msKey) dep_mss let module_graph_nodes = nubOrdOn mkNodeKey (ModuleNode final_deps ms : concatMap mgModSummaries' mgs) -#else - let module_graph_nodes = - -- We don't do any instantiation for backpack at this point of time, so it is OK to use - -- 'extendModSummaryNoDeps'. - -- This may have to change in the future. - map extendModSummaryNoDeps $ - nubOrdOn ms_mod (ms : concatMap mgModSummaries mgs) -#endif liftIO $ evaluate $ liftRnf rwhnf module_graph_nodes return $ mkModuleGraph module_graph_nodes session' <- liftIO $ mergeEnvs hsc mg ms inLoadOrder depSessions @@ -905,12 +876,7 @@ getModSummaryRule displayTHWarning recorder = do when (uses_th_qq $ msrModSummary res) $ do DisplayTHWarning act <- getIdeGlobalAction liftIO act -#if MIN_VERSION_ghc(9,3,0) let bufFingerPrint = ms_hs_hash (msrModSummary res) -#else - bufFingerPrint <- liftIO $ - fingerprintFromStringBuffer $ fromJust $ ms_hspp_buf $ msrModSummary res -#endif let fingerPrint = Util.fingerprintFingerprints [ msrFingerprint res, bufFingerPrint ] return ( Just (fingerprintToBS fingerPrint) , ([], Just res)) @@ -921,9 +887,6 @@ getModSummaryRule displayTHWarning recorder = do case mbMs of Just res@ModSummaryResult{..} -> do let ms = msrModSummary { -#if !MIN_VERSION_ghc(9,3,0) - ms_hs_date = error "use GetModSummary instead of GetModSummaryWithoutTimestamps", -#endif ms_hspp_buf = error "use GetModSummary instead of GetModSummaryWithoutTimestamps" } fp = fingerprintToBS msrFingerprint diff --git a/ghcide/src/Development/IDE/Core/Shake.hs b/ghcide/src/Development/IDE/Core/Shake.hs index 98be42a8df..9350eb2ee6 100644 --- a/ghcide/src/Development/IDE/Core/Shake.hs +++ b/ghcide/src/Development/IDE/Core/Shake.hs @@ -176,16 +176,8 @@ import System.Time.Extra -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import Data.IORef -import Development.IDE.GHC.Compat (NameCacheUpdater (NCU), - mkSplitUniqSupply, - upNameCache) -#endif - -#if MIN_VERSION_ghc(9,3,0) + import Development.IDE.GHC.Compat (NameCacheUpdater) -#endif data Log = LogCreateHieDbExportsMapStart @@ -252,11 +244,10 @@ instance Pretty Log where -- a worker thread. data HieDbWriter = HieDbWriter - { indexQueue :: IndexQueue - , indexPending :: TVar (HMap.HashMap NormalizedFilePath Fingerprint) -- ^ Avoid unnecessary/out of date indexing - , indexCompleted :: TVar Int -- ^ to report progress - , indexProgressToken :: Var (Maybe LSP.ProgressToken) - -- ^ This is a Var instead of a TVar since we need to do IO to initialise/update, so we need a lock + { indexQueue :: IndexQueue + , indexPending :: TVar (HMap.HashMap NormalizedFilePath Fingerprint) -- ^ Avoid unnecessary/out of date indexing + , indexCompleted :: TVar Int -- ^ to report progress + , indexProgressReporting :: ProgressReporting IO } -- | Actions to queue up on the index worker thread @@ -306,7 +297,7 @@ data ShakeExtras = ShakeExtras -- positions in a version of that document to positions in the latest version -- First mapping is delta from previous version and second one is an -- accumulation to the current version. - ,progress :: ProgressReporting + ,progress :: ProgressReporting Action ,ideTesting :: IdeTesting -- ^ Whether to enable additional lsp messages used by the test suite for checking invariants ,restartShakeSession @@ -315,11 +306,7 @@ data ShakeExtras = ShakeExtras -> [DelayedAction ()] -> IO [Key] -> IO () -#if MIN_VERSION_ghc(9,3,0) ,ideNc :: NameCache -#else - ,ideNc :: IORef NameCache -#endif -- | A mapping of module name to known target (or candidate targets, if missing) ,knownTargetsVar :: TVar (Hashed KnownTargets) -- | A mapping of exported identifiers for local modules. Updated on kick @@ -677,12 +664,7 @@ shakeOpen recorder lspEnv defaultConfig idePlugins debouncer restartQueue = tRestartQueue threadQueue loaderQueue = tLoaderQueue threadQueue -#if MIN_VERSION_ghc(9,3,0) ideNc <- initNameCache 'r' knownKeyNames -#else - us <- mkSplitUniqSupply 'r' - ideNc <- newIORef (initNameCache us knownKeyNames) -#endif shakeExtras <- do globals <- newTVarIO HMap.empty state <- STM.newIO @@ -697,7 +679,10 @@ shakeOpen recorder lspEnv defaultConfig idePlugins debouncer indexPending <- newTVarIO HMap.empty indexCompleted <- newTVarIO 0 semanticTokensId <- newTVarIO 0 - indexProgressToken <- newVar Nothing + indexProgressReporting <- progressReportingOutsideState + (liftM2 (+) (length <$> readTVar indexPending) (readTVar indexCompleted)) + (readTVar indexCompleted) + lspEnv "Indexing" optProgressStyle let hiedbWriter = HieDbWriter{..} exportsMap <- newTVarIO mempty -- lazily initialize the exports map with the contents of the hiedb @@ -710,7 +695,7 @@ shakeOpen recorder lspEnv defaultConfig idePlugins debouncer progress <- if reportProgress - then progressReporting lspEnv optProgressStyle + then progressReporting lspEnv "Processing" optProgressStyle else noProgressReporting actionQueue <- newQueue @@ -775,6 +760,7 @@ shakeShut IdeState{..} = do for_ runner cancelShakeSession void $ shakeDatabaseProfile shakeDb progressStop $ progress shakeExtras + progressStop $ indexProgressReporting $ hiedbWriter shakeExtras stopMonitoring @@ -1080,13 +1066,8 @@ askShake :: IdeAction ShakeExtras askShake = ask -#if MIN_VERSION_ghc(9,3,0) mkUpdater :: NameCache -> NameCacheUpdater mkUpdater = id -#else -mkUpdater :: IORef NameCache -> NameCacheUpdater -mkUpdater ref = NCU (upNameCache ref) -#endif -- | A (maybe) stale result now, and an up to date one later data FastResult a = FastResult { stale :: Maybe (a,PositionMapping), uptoDate :: IO (Maybe a) } diff --git a/ghcide/src/Development/IDE/GHC/CPP.hs b/ghcide/src/Development/IDE/GHC/CPP.hs index b0ec869e24..73e955a40d 100644 --- a/ghcide/src/Development/IDE/GHC/CPP.hs +++ b/ghcide/src/Development/IDE/GHC/CPP.hs @@ -22,11 +22,8 @@ import GHC.Settings -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import qualified GHC.Driver.Pipeline as Pipeline -#endif -#if MIN_VERSION_ghc(9,3,0) && !MIN_VERSION_ghc(9,5,0) +#if !MIN_VERSION_ghc(9,5,0) import qualified GHC.Driver.Pipeline.Execute as Pipeline #endif diff --git a/ghcide/src/Development/IDE/GHC/Compat.hs b/ghcide/src/Development/IDE/GHC/Compat.hs index 8e138ce56b..636755e8c4 100644 --- a/ghcide/src/Development/IDE/GHC/Compat.hs +++ b/ghcide/src/Development/IDE/GHC/Compat.hs @@ -98,20 +98,9 @@ module Development.IDE.GHC.Compat( extract_cons, recDotDot, -#if !MIN_VERSION_ghc(9,3,0) - Dependencies(dep_mods), - NameCacheUpdater(NCU), - extendModSummaryNoDeps, - emsModSummary, - nonDetNameEnvElts, - nonDetOccEnvElts, - upNameCache, -#endif -#if MIN_VERSION_ghc(9,3,0) Dependencies(dep_direct_mods), NameCacheUpdater, -#endif #if MIN_VERSION_ghc(9,5,0) XModulePs(..), @@ -196,19 +185,10 @@ import GHC.Unit.Module.ModIface -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import Data.IORef -import GHC.Runtime.Interpreter -import GHC.Unit.Module.Deps (Dependencies (dep_mods), - Usage (..)) -import GHC.Unit.Module.ModSummary -#endif -#if MIN_VERSION_ghc(9,3,0) import GHC.Driver.Config.Stg.Pipeline import GHC.Unit.Module.Deps (Dependencies (dep_direct_mods), Usage (..)) -#endif #if !MIN_VERSION_ghc(9,5,0) import GHC.Core.Lint (lintInteractiveExpr) @@ -234,35 +214,19 @@ nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b nonDetFoldOccEnv = foldOccEnv #endif -#if !MIN_VERSION_ghc(9,3,0) -nonDetOccEnvElts :: OccEnv a -> [a] -nonDetOccEnvElts = occEnvElts -#endif type ModIfaceAnnotation = Annotation -#if !MIN_VERSION_ghc(9,3,0) -nonDetNameEnvElts :: NameEnv a -> [a] -nonDetNameEnvElts = nameEnvElts -#endif myCoreToStgExpr :: Logger -> DynFlags -> InteractiveContext -#if MIN_VERSION_ghc(9,3,0) -> Bool -#endif -> Module -> ModLocation -> CoreExpr -> IO ( Id -#if MIN_VERSION_ghc(9,3,0) ,[CgStgTopBinding] -- output program -#else - ,[StgTopBinding] -- output program -#endif , InfoTableProvMap , CollectedCCs ) myCoreToStgExpr logger dflags ictxt -#if MIN_VERSION_ghc(9,3,0) for_bytecode -#endif this_mod ml prepd_expr = do {- Create a temporary binding (just because myCoreToStg needs a binding for the stg2stg step) -} @@ -278,30 +242,20 @@ myCoreToStgExpr logger dflags ictxt myCoreToStg logger dflags ictxt -#if MIN_VERSION_ghc(9,3,0) for_bytecode -#endif this_mod ml [NonRec bco_tmp_id prepd_expr] return (bco_tmp_id, stg_binds, prov_map, collected_ccs) myCoreToStg :: Logger -> DynFlags -> InteractiveContext -#if MIN_VERSION_ghc(9,3,0) -> Bool -#endif -> Module -> ModLocation -> CoreProgram -#if MIN_VERSION_ghc(9,3,0) -> IO ( [CgStgTopBinding] -- output program -#else - -> IO ( [StgTopBinding] -- output program -#endif , InfoTableProvMap , CollectedCCs ) -- CAF cost centre info (declared and used) myCoreToStg logger dflags ictxt -#if MIN_VERSION_ghc(9,3,0) for_bytecode -#endif this_mod ml prepd_binds = do let (stg_binds, denv, cost_centre_info) = {-# SCC "Core2Stg" #-} @@ -321,7 +275,6 @@ myCoreToStg logger dflags ictxt stg_binds2 #endif <- {-# SCC "Stg2Stg" #-} -#if MIN_VERSION_ghc(9,3,0) stg2stg logger #if MIN_VERSION_ghc(9,5,0) (interactiveInScope ictxt) @@ -329,9 +282,6 @@ myCoreToStg logger dflags ictxt ictxt #endif (initStgPipelineOpts dflags for_bytecode) this_mod stg_binds -#else - stg2stg logger dflags ictxt this_mod stg_binds -#endif return (stg_binds2, denv, cost_centre_info) @@ -342,11 +292,7 @@ reLocA = reLoc #endif getDependentMods :: ModIface -> [ModuleName] -#if MIN_VERSION_ghc(9,3,0) getDependentMods = map (gwib_mod . snd) . S.toList . dep_direct_mods . mi_deps -#else -getDependentMods = map gwib_mod . dep_mods . mi_deps -#endif simplifyExpr :: DynFlags -> HscEnv -> CoreExpr -> IO CoreExpr #if MIN_VERSION_ghc(9,5,0) @@ -366,50 +312,18 @@ corePrepExpr _ = GHC.corePrepExpr renderMessages :: PsMessages -> (Bag WarnMsg, Bag ErrMsg) renderMessages msgs = -#if MIN_VERSION_ghc(9,3,0) let renderMsgs extractor = (fmap . fmap) renderDiagnosticMessageWithHints . getMessages $ extractor msgs in (renderMsgs psWarnings, renderMsgs psErrors) -#else - msgs -#endif pattern PFailedWithErrorMessages :: forall a b. (b -> Bag (MsgEnvelope DecoratedSDoc)) -> ParseResult a pattern PFailedWithErrorMessages msgs -#if MIN_VERSION_ghc(9,3,0) <- PFailed (const . fmap (fmap renderDiagnosticMessageWithHints) . getMessages . getPsErrorMessages -> msgs) -#else - <- PFailed (const . fmap pprError . getErrorMessages -> msgs) -#endif {-# COMPLETE POk, PFailedWithErrorMessages #-} hieExportNames :: HieFile -> [(SrcSpan, Name)] hieExportNames = nameListFromAvails . hie_exports -#if MIN_VERSION_ghc(9,3,0) type NameCacheUpdater = NameCache -#else - -lookupNameCache :: Module -> OccName -> NameCache -> (NameCache, Name) --- Lookup up the (Module,OccName) in the NameCache --- If you find it, return it; if not, allocate a fresh original name and extend --- the NameCache. --- Reason: this may the first occurrence of (say) Foo.bar we have encountered. --- If we need to explore its value we will load Foo.hi; but meanwhile all we --- need is a Name for it. -lookupNameCache mod occ name_cache = - case lookupOrigNameCache (nsNames name_cache) mod occ of { - Just name -> (name_cache, name); - Nothing -> - case takeUniqFromSupply (nsUniqs name_cache) of { - (uniq, us) -> - let - name = mkExternalName uniq mod occ noSrcSpan - new_cache = extendNameCache (nsNames name_cache) mod occ name - in (name_cache{ nsUniqs = us, nsNames = new_cache }, name) }} - -upNameCache :: IORef NameCache -> (NameCache -> (NameCache, c)) -> IO c -upNameCache = updNameCache -#endif mkHieFile' :: ModSummary -> [Avail.AvailInfo] @@ -515,8 +429,7 @@ generatedNodeInfo :: HieAST a -> Maybe (NodeInfo a) generatedNodeInfo = Map.lookup GeneratedInfo . getSourcedNodeInfo . sourcedNodeInfo data GhcVersion - = GHC92 - | GHC94 + = GHC94 | GHC96 | GHC98 | GHC910 @@ -534,8 +447,6 @@ ghcVersion = GHC98 ghcVersion = GHC96 #elif MIN_VERSION_GLASGOW_HASKELL(9,4,0,0) ghcVersion = GHC94 -#elif MIN_VERSION_GLASGOW_HASKELL(9,2,0,0) -ghcVersion = GHC92 #endif simpleNodeInfoCompat :: FastStringCompat -> FastStringCompat -> NodeInfo a @@ -568,16 +479,7 @@ loadModulesHome -> HscEnv -> HscEnv loadModulesHome mod_infos e = -#if MIN_VERSION_ghc(9,3,0) hscUpdateHUG (\hug -> foldl' (flip addHomeModInfoToHug) hug mod_infos) (e { hsc_type_env_vars = emptyKnotVars }) -#else - let !new_modules = addListToHpt (hsc_HPT e) [(mod_name x, x) | x <- mod_infos] - in e { hsc_HPT = new_modules - , hsc_type_env_var = Nothing - } - where - mod_name = moduleName . mi_module . hm_iface -#endif recDotDot :: HsRecFields (GhcPass p) arg -> Maybe Int recDotDot x = diff --git a/ghcide/src/Development/IDE/GHC/Compat/CmdLine.hs b/ghcide/src/Development/IDE/GHC/Compat/CmdLine.hs index 00db02aa8c..7c9efb37e8 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/CmdLine.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/CmdLine.hs @@ -13,26 +13,7 @@ module Development.IDE.GHC.Compat.CmdLine ( , liftEwM ) where -#if MIN_VERSION_ghc(9,3,0) import GHC.Driver.CmdLine -import GHC.Driver.Session (CmdLineP (..), getCmdLineState, - processCmdLineP, putCmdLineState) -#else -import Control.Monad.IO.Class -import GHC (Located) -import GHC.Driver.CmdLine -#endif +import GHC.Driver.Session (CmdLineP (..), getCmdLineState, + processCmdLineP, putCmdLineState) -#if !MIN_VERSION_ghc(9,3,0) --- | A helper to parse a set of flags from a list of command-line arguments, handling --- response files. -processCmdLineP - :: forall s m. MonadIO m - => [Flag (CmdLineP s)] -- ^ valid flags to match against - -> s -- ^ current state - -> [Located String] -- ^ arguments to parse - -> m (([Located String], [Err], [Warn]), s) - -- ^ (leftovers, errors, warnings) -processCmdLineP activeFlags s0 args = - pure $ runCmdLine (processArgs activeFlags args) s0 -#endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Core.hs b/ghcide/src/Development/IDE/GHC/Compat/Core.hs index 06f798d1ff..8ba1e769c0 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Core.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Core.hs @@ -58,9 +58,6 @@ module Development.IDE.GHC.Compat.Core ( pattern ExposePackage, parseDynamicFlagsCmdLine, parseDynamicFilePragma, -#if !MIN_VERSION_ghc(9,3,0) - WarnReason(..), -#endif wWarningFlags, updOptLevel, -- slightly unsafe @@ -75,9 +72,6 @@ module Development.IDE.GHC.Compat.Core ( HscSource(..), WhereFrom(..), loadInterface, -#if !MIN_VERSION_ghc(9,3,0) - SourceModified(..), -#endif loadModuleInterface, RecompileRequired(..), mkPartialIface, @@ -359,7 +353,6 @@ module Development.IDE.GHC.Compat.Core ( module GHC.Parser.Header, module GHC.Parser.Lexer, module GHC.Utils.Panic, -#if MIN_VERSION_ghc(9,3,0) CompileReason(..), hsc_type_env_vars, hscUpdateHUG, hsc_HUG, @@ -372,7 +365,6 @@ module Development.IDE.GHC.Compat.Core ( module GHC.Unit.Finder.Types, module GHC.Unit.Env, module GHC.Driver.Phases, -#endif #if !MIN_VERSION_ghc(9,4,0) pattern HsFieldBind, hfbAnn, @@ -536,13 +528,7 @@ import Language.Haskell.Syntax hiding (FunDep) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Types.SourceFile (SourceModified (..)) -import qualified GHC.Unit.Finder as GHC -import GHC.Unit.Module.Graph (mkModuleGraph) -#endif -#if MIN_VERSION_ghc(9,3,0) import qualified GHC.Data.Strict as Strict import qualified GHC.Driver.Config.Finder as GHC import qualified GHC.Driver.Config.Tidy as GHC @@ -558,39 +544,22 @@ import GHC.Unit.Module.Graph import GHC.Utils.Error (mkPlainErrorMsgEnvelope) import GHC.Utils.Panic import GHC.Utils.TmpFs -#endif #if !MIN_VERSION_ghc(9,7,0) import GHC.Types.Avail (greNamePrintableName) #endif mkHomeModLocation :: DynFlags -> ModuleName -> FilePath -> IO Module.ModLocation -#if MIN_VERSION_ghc(9,3,0) mkHomeModLocation df mn f = pure $ GHC.mkHomeModLocation (GHC.initFinderOpts df) mn f -#else -mkHomeModLocation = GHC.mkHomeModLocation -#endif -#if MIN_VERSION_ghc(9,3,0) pattern RealSrcSpan :: SrcLoc.RealSrcSpan -> Maybe BufSpan -> SrcLoc.SrcSpan -#else -pattern RealSrcSpan :: SrcLoc.RealSrcSpan -> Maybe BufSpan -> SrcLoc.SrcSpan -#endif -#if MIN_VERSION_ghc(9,3,0) pattern RealSrcSpan x y <- SrcLoc.RealSrcSpan x ((\case Strict.Nothing -> Nothing; Strict.Just a -> Just a) -> y) where RealSrcSpan x y = SrcLoc.RealSrcSpan x (case y of Nothing -> Strict.Nothing; Just a -> Strict.Just a) -#else -pattern RealSrcSpan x y = SrcLoc.RealSrcSpan x y -#endif {-# COMPLETE RealSrcSpan, UnhelpfulSpan #-} -#if MIN_VERSION_ghc(9,3,0) pattern RealSrcLoc :: SrcLoc.RealSrcLoc -> Strict.Maybe BufPos-> SrcLoc.SrcLoc -#else -pattern RealSrcLoc :: SrcLoc.RealSrcLoc -> Maybe BufPos-> SrcLoc.SrcLoc -#endif pattern RealSrcLoc x y = SrcLoc.RealSrcLoc x y {-# COMPLETE RealSrcLoc, UnhelpfulLoc #-} @@ -718,12 +687,6 @@ unload hsc_env linkables = (GHCi.hscInterp hsc_env) hsc_env linkables -#if !MIN_VERSION_ghc(9,3,0) -setOutputFile :: FilePath -> DynFlags -> DynFlags -setOutputFile f d = d { - outputFile_ = Just f - } -#endif isSubspanOfA :: LocatedAn la a -> LocatedAn lb b -> Bool isSubspanOfA a b = SrcLoc.isSubspanOf (GHC.getLocA a) (GHC.getLocA b) @@ -752,54 +715,28 @@ collectHsBindsBinders x = GHC.collectHsBindsBinders CollNoDictBinders x makeSimpleDetails :: HscEnv -> TcGblEnv -> IO ModDetails makeSimpleDetails hsc_env = GHC.makeSimpleDetails -#if MIN_VERSION_ghc(9,3,0) (hsc_logger hsc_env) -#else - hsc_env -#endif mkIfaceTc :: HscEnv -> GHC.SafeHaskellMode -> ModDetails -> ModSummary -> Maybe CoreProgram -> TcGblEnv -> IO ModIface mkIfaceTc hscEnv shm md _ms _mcp = #if MIN_VERSION_ghc(9,5,0) GHC.mkIfaceTc hscEnv shm md _ms _mcp -- mcp::Maybe CoreProgram is only used in GHC >= 9.6 -#elif MIN_VERSION_ghc(9,3,0) - GHC.mkIfaceTc hscEnv shm md _ms -- ms::ModSummary is only used in GHC >= 9.4 #else - GHC.mkIfaceTc hscEnv shm md + GHC.mkIfaceTc hscEnv shm md _ms -- ms::ModSummary is only used in GHC >= 9.4 #endif mkBootModDetailsTc :: HscEnv -> TcGblEnv -> IO ModDetails mkBootModDetailsTc session = GHC.mkBootModDetailsTc -#if MIN_VERSION_ghc(9,3,0) (hsc_logger session) -#else - session -#endif -#if !MIN_VERSION_ghc(9,3,0) -type TidyOpts = HscEnv -#endif initTidyOpts :: HscEnv -> IO TidyOpts initTidyOpts = -#if MIN_VERSION_ghc(9,3,0) GHC.initTidyOpts -#else - pure -#endif -#if MIN_VERSION_ghc(9,3,0) driverNoStop :: StopPhase driverNoStop = NoStop -#else -driverNoStop :: Phase -driverNoStop = StopLn -#endif -#if !MIN_VERSION_ghc(9,3,0) -hscUpdateHPT :: (HomePackageTable -> HomePackageTable) -> HscEnv -> HscEnv -hscUpdateHPT k session = session { hsc_HPT = k (hsc_HPT session) } -#endif #if !MIN_VERSION_ghc(9,4,0) pattern HsFieldBind :: XHsRecField id -> id -> arg -> Bool -> HsRecField' id arg @@ -846,11 +783,7 @@ field_label = id #endif mkSimpleTarget :: DynFlags -> FilePath -> Target -#if MIN_VERSION_ghc(9,3,0) mkSimpleTarget df fp = Target (TargetFile fp Nothing) True (homeUnitId_ df) Nothing -#else -mkSimpleTarget _ fp = Target (TargetFile fp Nothing) True Nothing -#endif #if MIN_VERSION_ghc(9,7,0) lookupGlobalRdrEnv gre_env occ = lookupGRE gre_env (LookupOccName occ AllRelevantGREs) diff --git a/ghcide/src/Development/IDE/GHC/Compat/Env.hs b/ghcide/src/Development/IDE/GHC/Compat/Env.hs index bc963e2104..28f61e76f4 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Env.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Env.hs @@ -4,11 +4,7 @@ -- 'UnitEnv' and some DynFlags compat functions. module Development.IDE.GHC.Compat.Env ( Env.HscEnv(hsc_FC, hsc_NC, hsc_IC, hsc_mod_graph -#if MIN_VERSION_ghc(9,3,0) , hsc_type_env_vars -#else - , hsc_type_env_var -#endif ), Env.hsc_HPT, InteractiveContext(..), @@ -19,9 +15,6 @@ module Development.IDE.GHC.Compat.Env ( Env.hsc_logger, Env.hsc_tmpfs, Env.hsc_unit_env, -#if !MIN_VERSION_ghc(9,3,0) - Env.hsc_unit_dbs, -#endif Env.hsc_hooks, hscSetHooks, TmpFs, @@ -78,39 +71,16 @@ import GHC.Utils.TmpFs -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import qualified Data.Set as S -import GHC.Driver.Env (HscEnv, hsc_EPS) -#endif -#if MIN_VERSION_ghc(9,3,0) import GHC.Driver.Env (HscEnv, hscSetActiveUnitId) -#endif - -#if !MIN_VERSION_ghc(9,3,0) -hscSetActiveUnitId :: UnitId -> HscEnv -> HscEnv -hscSetActiveUnitId _ env = env -reexportedModules :: HscEnv -> S.Set a -reexportedModules _ = S.empty -#endif -#if MIN_VERSION_ghc(9,3,0) hsc_EPS :: HscEnv -> UnitEnv hsc_EPS = Env.hsc_unit_env -#endif - -#if !MIN_VERSION_ghc(9,3,0) -workingDirectory :: a -> Maybe b -workingDirectory _ = Nothing -setWorkingDirectory :: FilePath -> DynFlags -> DynFlags -setWorkingDirectory = const id -#else setWorkingDirectory :: FilePath -> DynFlags -> DynFlags setWorkingDirectory p d = d { workingDirectory = Just p } -#endif setHomeUnitId_ :: UnitId -> DynFlags -> DynFlags setHomeUnitId_ uid df = df { Session.homeUnitId_ = uid } diff --git a/ghcide/src/Development/IDE/GHC/Compat/Iface.hs b/ghcide/src/Development/IDE/GHC/Compat/Iface.hs index 7a5fc10029..750b324507 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Iface.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Iface.hs @@ -14,9 +14,7 @@ import GHC.Unit.Finder.Types (FindResult) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,3,0) import GHC.Driver.Session (targetProfile) -#endif #if MIN_VERSION_ghc(9,7,0) import GHC.Iface.Errors.Ppr (missingInterfaceErrorDiagnostic) @@ -24,11 +22,7 @@ import GHC.Iface.Errors.Types (IfaceMessage) #endif writeIfaceFile :: HscEnv -> FilePath -> ModIface -> IO () -#if MIN_VERSION_ghc(9,3,0) writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) fp iface -#else -writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (hsc_dflags env) fp iface -#endif cannotFindModule :: HscEnv -> ModuleName -> FindResult -> SDoc cannotFindModule env modname fr = diff --git a/ghcide/src/Development/IDE/GHC/Compat/Logger.hs b/ghcide/src/Development/IDE/GHC/Compat/Logger.hs index 24922069ec..fb4d98d0fd 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Logger.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Logger.hs @@ -19,15 +19,12 @@ import GHC.Utils.Outputable -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,3,0) import GHC.Types.Error -#endif putLogHook :: Logger -> HscEnv -> HscEnv putLogHook logger env = env { hsc_logger = logger } -#if MIN_VERSION_ghc(9,3,0) type LogActionCompat = LogFlags -> Maybe DiagnosticReason -> Maybe Severity -> SrcSpan -> PrintUnqualified -> SDoc -> IO () -- alwaysQualify seems to still do the right thing here, according to the "unqualified warnings" test. @@ -41,11 +38,3 @@ logActionCompat logAction logFlags (MCDiagnostic severity wr) loc = logAction lo #endif logActionCompat logAction logFlags _cls loc = logAction logFlags Nothing Nothing loc alwaysQualify -#else -type LogActionCompat = DynFlags -> WarnReason -> Severity -> SrcSpan -> PrintUnqualified -> SDoc -> IO () - --- alwaysQualify seems to still do the right thing here, according to the "unqualified warnings" test. -logActionCompat :: LogActionCompat -> LogAction -logActionCompat logAction dynFlags wr severity loc = logAction dynFlags wr severity loc alwaysQualify - -#endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs b/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs index c751f7ae0b..87f2482853 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs @@ -24,7 +24,6 @@ module Development.IDE.GHC.Compat.Outputable ( initDiagOpts, pprMessages, #endif -#if MIN_VERSION_ghc(9,3,0) DiagnosticReason(..), renderDiagnosticMessageWithHints, pprMsgEnvelopeBagWithLoc, @@ -34,10 +33,6 @@ module Development.IDE.GHC.Compat.Outputable ( errMsgDiagnostic, unDecorated, diagnosticMessage, -#else - pprWarning, - pprError, -#endif -- * Error infrastructure DecoratedSDoc, MsgEnvelope, @@ -67,18 +62,11 @@ import GHC.Utils.Panic -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Parser.Errors -import qualified GHC.Parser.Errors.Ppr as Ppr -import GHC.Utils.Error hiding (mkWarnMsg) -#endif -#if MIN_VERSION_ghc(9,3,0) import Data.Maybe import GHC.Driver.Config.Diagnostic import GHC.Parser.Errors.Types import GHC.Utils.Error -#endif #if MIN_VERSION_ghc(9,5,0) import GHC.Driver.Errors.Types (DriverMessage, GhcMessage) @@ -114,43 +102,26 @@ printSDocQualifiedUnsafe unqual doc = doc' = pprWithUnitState emptyUnitState doc -#if !MIN_VERSION_ghc(9,3,0) -pprWarning :: PsWarning -> MsgEnvelope DecoratedSDoc -pprWarning = - Ppr.pprWarning - -pprError :: PsError -> MsgEnvelope DecoratedSDoc -pprError = - Ppr.pprError -#endif formatErrorWithQual :: DynFlags -> MsgEnvelope DecoratedSDoc -> String formatErrorWithQual dflags e = showSDoc dflags (pprNoLocMsgEnvelope e) -#if MIN_VERSION_ghc(9,3,0) pprNoLocMsgEnvelope :: MsgEnvelope DecoratedSDoc -> SDoc -#else -pprNoLocMsgEnvelope :: Error.RenderableDiagnostic e => MsgEnvelope e -> SDoc -#endif pprNoLocMsgEnvelope (MsgEnvelope { errMsgDiagnostic = e , errMsgContext = unqual }) = sdocWithContext $ \_ctx -> withErrStyle unqual $ #if MIN_VERSION_ghc(9,7,0) formatBulleted e -#elif MIN_VERSION_ghc(9,3,0) - formatBulleted _ctx $ e #else - formatBulleted _ctx $ Error.renderDiagnostic e + formatBulleted _ctx $ e #endif type ErrMsg = MsgEnvelope DecoratedSDoc -#if MIN_VERSION_ghc(9,3,0) type WarnMsg = MsgEnvelope DecoratedSDoc -#endif mkPrintUnqualifiedDefault :: HscEnv -> GlobalRdrEnv -> PrintUnqualified #if MIN_VERSION_ghc(9,5,0) @@ -165,7 +136,6 @@ mkPrintUnqualifiedDefault env = mkPrintUnqualified (hsc_unit_env env) #endif -#if MIN_VERSION_ghc(9,3,0) renderDiagnosticMessageWithHints :: forall a. Diagnostic a => a -> DecoratedSDoc renderDiagnosticMessageWithHints a = Error.unionDecoratedSDoc (diagnosticMessage @@ -173,16 +143,9 @@ renderDiagnosticMessageWithHints a = Error.unionDecoratedSDoc (defaultDiagnosticOpts @a) #endif a) (mkDecorated $ map ppr $ diagnosticHints a) -#endif -#if MIN_VERSION_ghc(9,3,0) mkWarnMsg :: DynFlags -> Maybe DiagnosticReason -> b -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc mkWarnMsg df reason _logFlags l st doc = fmap renderDiagnosticMessageWithHints $ mkMsgEnvelope (initDiagOpts df) l st (mkPlainDiagnostic (fromMaybe WarningWithoutFlag reason) [] doc) -#else -mkWarnMsg :: a -> b -> DynFlags -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc -mkWarnMsg _ _ = - const Error.mkWarnMsg -#endif textDoc :: String -> SDoc textDoc = text diff --git a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs index 0dc40673bc..fe3d6b5928 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs @@ -5,20 +5,16 @@ module Development.IDE.GHC.Compat.Parser ( initParserOpts, initParserState, - ApiAnns, PsSpan(..), pattern HsParsedModule, type GHC.HsParsedModule, Development.IDE.GHC.Compat.Parser.hpm_module, Development.IDE.GHC.Compat.Parser.hpm_src_files, - Development.IDE.GHC.Compat.Parser.hpm_annotations, pattern ParsedModule, Development.IDE.GHC.Compat.Parser.pm_parsed_source, type GHC.ParsedModule, Development.IDE.GHC.Compat.Parser.pm_mod_summary, Development.IDE.GHC.Compat.Parser.pm_extra_src_files, - Development.IDE.GHC.Compat.Parser.pm_annotations, - mkApiAnns, -- * API Annotations Anno.AnnKeywordId(..), pattern EpaLineComment, @@ -42,13 +38,8 @@ import GHC.Hs (hpm_module, hpm_src_files) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import qualified GHC.Driver.Config as Config -#endif -#if MIN_VERSION_ghc(9,3,0) import qualified GHC.Driver.Config.Parser as Config -#endif @@ -60,34 +51,28 @@ initParserState :: ParserOpts -> StringBuffer -> RealSrcLoc -> PState initParserState = Lexer.initParserState --- GHC 9.2 does not have ApiAnns anymore packaged in ParsedModule. Now the --- annotations are found in the ast. -type ApiAnns = () - #if MIN_VERSION_ghc(9,5,0) -pattern HsParsedModule :: Located (HsModule GhcPs) -> [FilePath] -> ApiAnns -> GHC.HsParsedModule +pattern HsParsedModule :: Located (HsModule GhcPs) -> [FilePath] -> GHC.HsParsedModule #else -pattern HsParsedModule :: Located HsModule -> [FilePath] -> ApiAnns -> GHC.HsParsedModule +pattern HsParsedModule :: Located HsModule -> [FilePath] -> GHC.HsParsedModule #endif pattern HsParsedModule { hpm_module , hpm_src_files - , hpm_annotations - } <- ( (,()) -> (GHC.HsParsedModule{..}, hpm_annotations)) + } <- GHC.HsParsedModule{..} where - HsParsedModule hpm_module hpm_src_files _hpm_annotations = + HsParsedModule hpm_module hpm_src_files = GHC.HsParsedModule hpm_module hpm_src_files -pattern ParsedModule :: ModSummary -> ParsedSource -> [FilePath] -> ApiAnns -> GHC.ParsedModule +pattern ParsedModule :: ModSummary -> ParsedSource -> [FilePath] -> GHC.ParsedModule pattern ParsedModule { pm_mod_summary , pm_parsed_source , pm_extra_src_files - , pm_annotations - } <- ( (,()) -> (GHC.ParsedModule{..}, pm_annotations)) + } <- GHC.ParsedModule{..} where - ParsedModule ms parsed extra_src_files _anns = + ParsedModule ms parsed extra_src_files = GHC.ParsedModule { pm_mod_summary = ms , pm_parsed_source = parsed @@ -95,6 +80,4 @@ pattern ParsedModule } {-# COMPLETE ParsedModule :: GHC.ParsedModule #-} -mkApiAnns :: PState -> ApiAnns -mkApiAnns = const () diff --git a/ghcide/src/Development/IDE/GHC/Compat/Plugins.hs b/ghcide/src/Development/IDE/GHC/Compat/Plugins.hs index c8c96b1e1f..c5b9d795ff 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Plugins.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Plugins.hs @@ -20,64 +20,37 @@ module Development.IDE.GHC.Compat.Plugins ( ) where import Development.IDE.GHC.Compat.Core -import Development.IDE.GHC.Compat.Env (hscSetFlags, hsc_dflags) -import Development.IDE.GHC.Compat.Parser as Parser +import Development.IDE.GHC.Compat.Env (hscSetFlags, hsc_dflags) +import Development.IDE.GHC.Compat.Parser as Parser -import qualified GHC.Driver.Env as Env -import GHC.Driver.Plugins (Plugin (..), - PluginWithArgs (..), - StaticPlugin (..), - defaultPlugin, - withPlugins) -import qualified GHC.Runtime.Loader as Loader +import qualified GHC.Driver.Env as Env +import GHC.Driver.Plugins (Plugin (..), + PluginWithArgs (..), + StaticPlugin (..), + defaultPlugin, withPlugins) +import qualified GHC.Runtime.Loader as Loader -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import Data.Bifunctor (bimap) -import Development.IDE.GHC.Compat.Outputable as Out -import Development.IDE.GHC.Compat.Util (Bag) -#endif -#if MIN_VERSION_ghc(9,3,0) -import GHC.Driver.Plugins (ParsedResult (..), - PsMessages (..), - staticPlugins) -import qualified GHC.Parser.Lexer as Lexer -#endif +import GHC.Driver.Plugins (ParsedResult (..), + PsMessages (..), + staticPlugins) +import qualified GHC.Parser.Lexer as Lexer -#if !MIN_VERSION_ghc(9,3,0) -type PsMessages = (Bag WarnMsg, Bag ErrMsg) -#endif getPsMessages :: PState -> PsMessages getPsMessages pst = -#if MIN_VERSION_ghc(9,3,0) uncurry PsMessages $ Lexer.getPsMessages pst -#else - bimap (fmap pprWarning) (fmap pprError) $ getMessages pst -#endif -applyPluginsParsedResultAction :: HscEnv -> ModSummary -> Parser.ApiAnns -> ParsedSource -> PsMessages -> IO (ParsedSource, PsMessages) -applyPluginsParsedResultAction env ms hpm_annotations parsed msgs = do +applyPluginsParsedResultAction :: HscEnv -> ModSummary -> ParsedSource -> PsMessages -> IO (ParsedSource, PsMessages) +applyPluginsParsedResultAction env ms parsed msgs = do -- Apply parsedResultAction of plugins let applyPluginAction p opts = parsedResultAction p opts ms -#if MIN_VERSION_ghc(9,3,0) fmap (\result -> (hpm_module (parsedResultModule result), (parsedResultMessages result))) $ runHsc env $ withPlugins -#else - fmap (\parsed_module -> (hpm_module parsed_module, msgs)) $ runHsc env $ withPlugins -#endif -#if MIN_VERSION_ghc(9,3,0) (Env.hsc_plugins env) -#else - env -#endif applyPluginAction -#if MIN_VERSION_ghc(9,3,0) - (ParsedResult (HsParsedModule parsed [] hpm_annotations) msgs) -#else - (HsParsedModule parsed [] hpm_annotations) -#endif + (ParsedResult (HsParsedModule parsed []) msgs) initializePlugins :: HscEnv -> IO HscEnv initializePlugins env = do @@ -91,8 +64,4 @@ initPlugins session modSummary = do return (modSummary{ms_hspp_opts = hsc_dflags session1}, session1) hsc_static_plugins :: HscEnv -> [StaticPlugin] -#if MIN_VERSION_ghc(9,3,0) hsc_static_plugins = staticPlugins . Env.hsc_plugins -#else -hsc_static_plugins = Env.hsc_static_plugins -#endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Units.hs b/ghcide/src/Development/IDE/GHC/Compat/Units.hs index 0456e3135a..4f5a320fa5 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Units.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Units.hs @@ -5,7 +5,6 @@ module Development.IDE.GHC.Compat.Units ( -- * UnitState UnitState, initUnits, - oldInitUnits, unitState, getUnitName, explicitUnits, @@ -71,15 +70,7 @@ import GHC.Unit.Types -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Data.FastString -import GHC.Unit.Env -import GHC.Unit.Finder hiding - (findImportedModule) -import qualified GHC.Unit.Types as Unit -#endif -#if MIN_VERSION_ghc(9,3,0) import Control.Monad import qualified Data.List.NonEmpty as NE import qualified Data.Map.Strict as Map @@ -87,7 +78,6 @@ import qualified GHC import qualified GHC.Driver.Session as DynFlags import GHC.Types.PkgQual (PkgQual (NoPkgQual)) import GHC.Unit.Home.ModInfo -#endif type PreloadUnitClosure = UniqSet UnitId @@ -95,7 +85,6 @@ type PreloadUnitClosure = UniqSet UnitId unitState :: HscEnv -> UnitState unitState = ue_units . hsc_unit_env -#if MIN_VERSION_ghc(9,3,0) createUnitEnvFromFlags :: NE.NonEmpty DynFlags -> HomeUnitGraph createUnitEnvFromFlags unitDflags = let @@ -135,25 +124,11 @@ initUnits unitDflags env = do , ue_eps = ue_eps (hsc_unit_env env) } pure $ hscSetFlags dflags1 $ hscSetUnitEnv unit_env env -#else -initUnits :: [DynFlags] -> HscEnv -> IO HscEnv -initUnits _df env = pure env -- Can't do anything here, oldInitUnits should already be called -#endif - --- | oldInitUnits only needs to modify DynFlags for GHC <9.2 --- For GHC >= 9.2, we need to set the hsc_unit_env also, that is --- done later by initUnits -oldInitUnits :: DynFlags -> IO DynFlags -oldInitUnits = pure explicitUnits :: UnitState -> [Unit] explicitUnits ue = -#if MIN_VERSION_ghc(9,3,0) map fst $ State.explicitUnits ue -#else - State.explicitUnits ue -#endif listVisibleModuleNames :: HscEnv -> [ModuleName] listVisibleModuleNames env = @@ -166,11 +141,7 @@ getUnitName env i = lookupModuleWithSuggestions :: HscEnv -> ModuleName -#if MIN_VERSION_ghc(9,3,0) -> GHC.PkgQual -#else - -> Maybe FastString -#endif -> LookupResult lookupModuleWithSuggestions env modname mpkg = State.lookupModuleWithSuggestions (unitState env) modname mpkg @@ -204,10 +175,6 @@ defUnitId = Definite installedModule :: unit -> ModuleName -> GenModule unit installedModule = Module -#if !MIN_VERSION_ghc(9,3,0) -moduleUnitId :: Module -> UnitId -moduleUnitId = Unit.toUnitId . Unit.moduleUnit -#endif filterInplaceUnits :: [UnitId] -> [PackageFlag] -> ([UnitId], [PackageFlag]) filterInplaceUnits us packageFlags = @@ -225,11 +192,7 @@ showSDocForUser' env = showSDocForUser (hsc_dflags env) (unitState env) findImportedModule :: HscEnv -> ModuleName -> IO (Maybe Module) findImportedModule env mn = do -#if MIN_VERSION_ghc(9,3,0) res <- GHC.findImportedModule env mn NoPkgQual -#else - res <- GHC.findImportedModule env mn Nothing -#endif case res of Found _ mod -> pure . pure $ mod _ -> pure Nothing diff --git a/ghcide/src/Development/IDE/GHC/Compat/Util.hs b/ghcide/src/Development/IDE/GHC/Compat/Util.hs index 2c60c35b15..ab6c1e7f03 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Util.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Util.hs @@ -82,10 +82,5 @@ import GHC.Utils.Panic hiding (try) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Utils.Misc -#endif -#if MIN_VERSION_ghc(9,3,0) import GHC.Data.Bool -#endif diff --git a/ghcide/src/Development/IDE/GHC/Error.hs b/ghcide/src/Development/IDE/GHC/Error.hs index 16663f8afd..651fa5a34d 100644 --- a/ghcide/src/Development/IDE/GHC/Error.hs +++ b/ghcide/src/Development/IDE/GHC/Error.hs @@ -157,17 +157,9 @@ spanContainsRange srcSpan range = (range `isSubrangeOf`) <$> srcSpanToRange srcS -- | Convert a GHC severity to a DAML compiler Severity. Severities below -- "Warning" level are dropped (returning Nothing). toDSeverity :: GHC.Severity -> Maybe D.DiagnosticSeverity -#if !MIN_VERSION_ghc(9,3,0) -toDSeverity SevOutput = Nothing -toDSeverity SevInteractive = Nothing -toDSeverity SevDump = Nothing -toDSeverity SevInfo = Just DiagnosticSeverity_Information -toDSeverity SevFatal = Just DiagnosticSeverity_Error -#else -toDSeverity SevIgnore = Nothing -#endif -toDSeverity SevWarning = Just DiagnosticSeverity_Warning -toDSeverity SevError = Just DiagnosticSeverity_Error +toDSeverity SevIgnore = Nothing +toDSeverity SevWarning = Just DiagnosticSeverity_Warning +toDSeverity SevError = Just DiagnosticSeverity_Error -- | Produce a bag of GHC-style errors (@ErrorMessages@) from the given @@ -208,9 +200,7 @@ catchSrcErrors dflags fromWhere ghcM = do where ghcExceptionToDiagnostics = return . Left . diagFromGhcException fromWhere dflags sourceErrorToDiagnostics = return . Left . diagFromErrMsgs fromWhere dflags -#if MIN_VERSION_ghc(9,3,0) . fmap (fmap Compat.renderDiagnosticMessageWithHints) . Compat.getMessages -#endif . srcErrorMessages diff --git a/ghcide/src/Development/IDE/GHC/Orphans.hs b/ghcide/src/Development/IDE/GHC/Orphans.hs index d7a85948cf..c19c8f6854 100644 --- a/ghcide/src/Development/IDE/GHC/Orphans.hs +++ b/ghcide/src/Development/IDE/GHC/Orphans.hs @@ -25,18 +25,12 @@ import GHC.Types.SrcLoc -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Types.Unique (getKey) -import GHC.Unit.Module.Graph (ModuleGraph) -#endif import Data.Bifunctor (Bifunctor (..)) import GHC.Parser.Annotation -#if MIN_VERSION_ghc(9,3,0) import GHC.Types.PkgQual -#endif #if MIN_VERSION_ghc(9,5,0) import GHC.Unit.Home.ModInfo @@ -88,9 +82,6 @@ instance NFData SB.StringBuffer where rnf = rwhnf instance Show Module where show = moduleNameString . moduleName -#if !MIN_VERSION_ghc(9,3,0) -instance Outputable a => Show (GenLocated SrcSpan a) where show = unpack . printOutputable -#endif #if !MIN_VERSION_ghc(9,5,0) instance (NFData l, NFData e) => NFData (GenLocated l e) where @@ -131,12 +122,6 @@ instance Show HieFile where instance NFData HieFile where rnf = rwhnf -#if !MIN_VERSION_ghc(9,3,0) -deriving instance Eq SourceModified -deriving instance Show SourceModified -instance NFData SourceModified where - rnf = rwhnf -#endif instance Hashable ModuleName where hashWithSalt salt = hashWithSalt salt . show @@ -222,7 +207,6 @@ instance NFData ModuleGraph where rnf = rwhnf instance NFData HomeModInfo where rnf (HomeModInfo iface dets link) = rwhnf iface `seq` rnf dets `seq` rnf link -#if MIN_VERSION_ghc(9,3,0) instance NFData PkgQual where rnf NoPkgQual = () rnf (ThisPkg uid) = rnf uid @@ -233,7 +217,6 @@ instance NFData UnitId where instance NFData NodeKey where rnf = rwhnf -#endif #if MIN_VERSION_ghc(9,5,0) instance NFData HomeModLinkable where diff --git a/ghcide/src/Development/IDE/GHC/Warnings.hs b/ghcide/src/Development/IDE/GHC/Warnings.hs index ff82af1d65..5e0d9b1d46 100644 --- a/ghcide/src/Development/IDE/GHC/Warnings.hs +++ b/ghcide/src/Development/IDE/GHC/Warnings.hs @@ -24,11 +24,7 @@ import Language.LSP.Protocol.Types (type (|?) (..)) -- https://github.com/ghc/ghc/blob/5f1d949ab9e09b8d95319633854b7959df06eb58/compiler/main/GHC.hs#L623-L640 -- which basically says that log_action is taken from the ModSummary when GHC feels like it. -- The given argument lets you refresh a ModSummary log_action -#if MIN_VERSION_ghc(9,3,0) withWarnings :: T.Text -> ((HscEnv -> HscEnv) -> IO a) -> IO ([(Maybe DiagnosticReason, FileDiagnostic)], a) -#else -withWarnings :: T.Text -> ((HscEnv -> HscEnv) -> IO a) -> IO ([(WarnReason, FileDiagnostic)], a) -#endif withWarnings diagSource action = do warnings <- newVar [] let newAction :: DynFlags -> LogActionCompat @@ -43,7 +39,6 @@ withWarnings diagSource action = do third3 :: (c -> d) -> (a, b, c) -> (a, b, d) third3 f (a, b, c) = (a, b, f c) -#if MIN_VERSION_ghc(9,3,0) attachReason :: Maybe DiagnosticReason -> Diagnostic -> Diagnostic attachReason Nothing d = d attachReason (Just wr) d = d{_code = InR <$> showReason wr} @@ -51,15 +46,6 @@ attachReason (Just wr) d = d{_code = InR <$> showReason wr} showReason = \case WarningWithFlag flag -> showFlag flag _ -> Nothing -#else -attachReason :: WarnReason -> Diagnostic -> Diagnostic -attachReason wr d = d{_code = InR <$> showReason wr} - where - showReason = \case - NoReason -> Nothing - Reason flag -> showFlag flag - ErrReason flag -> showFlag =<< flag -#endif showFlag :: WarningFlag -> Maybe T.Text showFlag flag = ("-W" <>) . T.pack . flagSpecName <$> find ((== flag) . flagSpecFlag) wWarningFlags diff --git a/ghcide/src/Development/IDE/Import/DependencyInformation.hs b/ghcide/src/Development/IDE/Import/DependencyInformation.hs index 95478fa25c..67adedb835 100644 --- a/ghcide/src/Development/IDE/Import/DependencyInformation.hs +++ b/ghcide/src/Development/IDE/Import/DependencyInformation.hs @@ -59,9 +59,6 @@ import Development.IDE.GHC.Compat -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Unit.Module.Graph (ModuleGraph) -#endif -- | The imports for a given module. newtype ModuleImports = ModuleImports diff --git a/ghcide/src/Development/IDE/Import/FindImports.hs b/ghcide/src/Development/IDE/Import/FindImports.hs index 3e3fc4d942..59e2a301cf 100644 --- a/ghcide/src/Development/IDE/Import/FindImports.hs +++ b/ghcide/src/Development/IDE/Import/FindImports.hs @@ -30,14 +30,9 @@ import System.FilePath -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import Development.IDE.GHC.Compat.Util -#endif -#if MIN_VERSION_ghc(9,3,0) import GHC.Types.PkgQual import GHC.Unit.State -#endif data Import = FileImport !ArtifactsLocation @@ -105,13 +100,8 @@ locateModuleFile import_dirss exts targetFor isSource modName = do -- It only returns Just for unit-ids which are possible to import into the -- current module. In particular, it will return Nothing for 'main' components -- as they can never be imported into another package. -#if MIN_VERSION_ghc(9,3,0) mkImportDirs :: HscEnv -> (UnitId, DynFlags) -> Maybe (UnitId, ([FilePath], S.Set ModuleName)) mkImportDirs _env (i, flags) = Just (i, (importPaths flags, reexportedModules flags)) -#else -mkImportDirs :: HscEnv -> (UnitId, DynFlags) -> Maybe (PackageName, (UnitId, [FilePath], S.Set ModuleName)) -mkImportDirs env (i, flags) = (, (i, importPaths flags, S.empty)) <$> getUnitName env i -#endif -- | locate a module in either the file system or the package database. Where we go from *daml to -- Haskell @@ -122,42 +112,22 @@ locateModule -> [String] -- ^ File extensions -> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath)) -- ^ does file exist predicate -> Located ModuleName -- ^ Module name -#if MIN_VERSION_ghc(9,3,0) -> PkgQual -- ^ Package name -#else - -> Maybe FastString -- ^ Package name -#endif -> Bool -- ^ Is boot module -> m (Either [FileDiagnostic] Import) locateModule env comp_info exts targetFor modName mbPkgName isSource = do case mbPkgName of -#if MIN_VERSION_ghc(9,3,0) -- 'ThisPkg' just means some home module, not the current unit ThisPkg uid | Just (dirs, reexports) <- lookup uid import_paths -> lookupLocal uid dirs reexports | otherwise -> return $ Left $ notFoundErr env modName $ LookupNotFound [] -#else - -- "this" means that we should only look in the current package - Just "this" -> do - lookupLocal (homeUnitId_ dflags) (importPaths dflags) S.empty -#endif -- if a package name is given we only go look for a package -#if MIN_VERSION_ghc(9,3,0) OtherPkg uid | Just (dirs, reexports) <- lookup uid import_paths -> lookupLocal uid dirs reexports -#else - Just pkgName - | Just (uid, dirs, reexports) <- lookup (PackageName pkgName) import_paths - -> lookupLocal uid dirs reexports -#endif | otherwise -> lookupInPackageDB -#if MIN_VERSION_ghc(9,3,0) NoPkgQual -> do -#else - Nothing -> do -#endif -- Reexports for current unit have to be empty because they only apply to other units depending on the -- current unit. If we set the reexports to be the actual reexports then we risk looping forever trying @@ -196,11 +166,7 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do -- This is particularly important for Paths_* modules which get generated for every component but unless you use it in -- each component will end up being found in the wrong place and cause a multi-cradle match failure. _import_paths' = -- import_paths' is only used in GHC < 9.4 -#if MIN_VERSION_ghc(9,3,0) import_paths -#else - map snd import_paths -#endif toModLocation uid file = liftIO $ do loc <- mkHomeModLocation dflags (unLoc modName) (fromNormalizedFilePath file) @@ -263,10 +229,5 @@ notFound = NotFound , fr_suggestions = [] } -#if MIN_VERSION_ghc(9,3,0) noPkgQual :: PkgQual noPkgQual = NoPkgQual -#else -noPkgQual :: Maybe a -noPkgQual = Nothing -#endif diff --git a/ghcide/src/Development/IDE/LSP/Outline.hs b/ghcide/src/Development/IDE/LSP/Outline.hs index 1c9d1971b3..879aed7122 100644 --- a/ghcide/src/Development/IDE/LSP/Outline.hs +++ b/ghcide/src/Development/IDE/LSP/Outline.hs @@ -19,21 +19,19 @@ import Development.IDE.Core.Shake import Development.IDE.GHC.Compat import Development.IDE.GHC.Error (rangeToRealSrcSpan, realSrcSpanToRange) -import Development.IDE.Types.Location import Development.IDE.GHC.Util (printOutputable) +import Development.IDE.Types.Location import Ide.Types -import Language.LSP.Protocol.Types (DocumentSymbol (..), +import Language.LSP.Protocol.Message +import Language.LSP.Protocol.Types (DocumentSymbol (..), DocumentSymbolParams (DocumentSymbolParams, _textDocument), SymbolKind (..), TextDocumentIdentifier (TextDocumentIdentifier), - type (|?) (InL, InR), uriToFilePath) -import Language.LSP.Protocol.Message + type (|?) (InL, InR), + uriToFilePath) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import qualified Data.Text as T -#endif moduleOutline :: PluginMethodHandler IdeState Method_TextDocumentDocumentSymbol @@ -118,21 +116,13 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam , L (locA -> RealSrcSpan l' _) n <- cs , let l'' = case con of L (locA -> RealSrcSpan l''' _) _ -> l''' - _ -> l' + _ -> l' ] } where cvtFld :: LFieldOcc GhcPs -> Maybe DocumentSymbol -#if MIN_VERSION_ghc(9,3,0) cvtFld (L (locA -> RealSrcSpan l' _) n) = Just $ (defDocumentSymbol l' :: DocumentSymbol) -#else - cvtFld (L (RealSrcSpan l' _) n) = Just $ (defDocumentSymbol l' :: DocumentSymbol) -#endif -#if MIN_VERSION_ghc(9,3,0) { _name = printOutputable (unLoc (foLabel n)) -#else - { _name = printOutputable (unLoc (rdrNameFieldOcc n)) -#endif , _kind = SymbolKind_Field } cvtFld _ = Nothing @@ -148,23 +138,13 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (InstD _ ClsInstD { cid_ins documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (InstD _ DataFamInstD { dfid_inst = DataFamInstDecl FamEqn { feqn_tycon, feqn_pats } })) = Just (defDocumentSymbol l :: DocumentSymbol) { _name = -#if MIN_VERSION_ghc(9,3,0) printOutputable $ pprHsArgsApp (unLoc feqn_tycon) Prefix (feqn_pats) -#else - printOutputable (unLoc feqn_tycon) <> " " <> T.unwords - (map printOutputable feqn_pats) -#endif , _kind = SymbolKind_Interface } documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (InstD _ TyFamInstD { tfid_inst = TyFamInstDecl _ FamEqn { feqn_tycon, feqn_pats } })) = Just (defDocumentSymbol l :: DocumentSymbol) { _name = -#if MIN_VERSION_ghc(9,3,0) printOutputable $ pprHsArgsApp (unLoc feqn_tycon) Prefix (feqn_pats) -#else - printOutputable (unLoc feqn_tycon) <> " " <> T.unwords - (map printOutputable feqn_pats) -#endif , _kind = SymbolKind_Interface } documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (DerivD _ DerivDecl { deriv_type })) = @@ -267,18 +247,16 @@ hsConDeclsBinders cons get_flds_h98 :: HsConDeclH98Details GhcPs -> [LFieldOcc GhcPs] get_flds_h98 (RecCon flds) = get_flds (reLoc flds) - get_flds_h98 _ = [] + get_flds_h98 _ = [] get_flds_gadt :: HsConDeclGADTDetails GhcPs -> [LFieldOcc GhcPs] #if MIN_VERSION_ghc(9,9,0) get_flds_gadt (RecConGADT _ flds) = get_flds (reLoc flds) -#elif MIN_VERSION_ghc(9,3,0) - get_flds_gadt (RecConGADT flds _) = get_flds (reLoc flds) #else - get_flds_gadt (RecConGADT flds) = get_flds (reLoc flds) + get_flds_gadt (RecConGADT flds _) = get_flds (reLoc flds) #endif - get_flds_gadt _ = [] + get_flds_gadt _ = [] get_flds :: Located [LConDeclField GhcPs] -> [LFieldOcc GhcPs] diff --git a/ghcide/src/Development/IDE/Plugin/Completions.hs b/ghcide/src/Development/IDE/Plugin/Completions.hs index 98ca6dc592..337f159424 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions.hs @@ -133,11 +133,7 @@ resolveCompletion ide _pid comp@CompletionItem{_detail,_documentation,_data_} ur $ runIdeActionE "CompletionResolve.GhcSessionDeps" (shakeExtras ide) $ useWithStaleFastE GhcSessionDeps file let nc = ideNc $ shakeExtras ide -#if MIN_VERSION_ghc(9,3,0) name <- liftIO $ lookupNameCache nc mod occ -#else - name <- liftIO $ upNameCache nc (lookupNameCache mod occ) -#endif mdkm <- liftIO $ runIdeAction "CompletionResolve.GetDocMap" (shakeExtras ide) $ useWithStaleFast GetDocMap file let (dm,km) = case mdkm of Just (DKMap docMap tyThingMap, _) -> (docMap,tyThingMap) diff --git a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs index 867c47719a..2ce70afeb7 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs @@ -74,10 +74,6 @@ import GHC.Plugins (Depth (AllTheWay), -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,3,0) -import GHC.Plugins (defaultSDocContext, - renderWithContext) -#endif #if MIN_VERSION_ghc(9,5,0) import Language.Haskell.Syntax.Basic @@ -514,13 +510,8 @@ findRecordCompl uri mn DataDecl {tcdLName, tcdDataDefn} = result -- -- is encoded as @[[arg1, arg2], [arg3], [arg4]]@ -- Hence, we must concat nested arguments into one to get all the fields. -#if MIN_VERSION_ghc(9,3,0) extract ConDeclField{..} = map (foLabel . unLoc) cd_fld_names -#else - extract ConDeclField{..} - = map (rdrNameFieldOcc . unLoc) cd_fld_names -#endif -- XConDeclField extract _ = [] findRecordCompl _ _ _ = [] diff --git a/ghcide/src/Development/IDE/Spans/Common.hs b/ghcide/src/Development/IDE/Spans/Common.hs index dbdacfcd5c..e265a617f6 100644 --- a/ghcide/src/Development/IDE/Spans/Common.hs +++ b/ghcide/src/Development/IDE/Spans/Common.hs @@ -54,13 +54,8 @@ safeTyThingId (AConLike (RealDataCon dataCon)) = Just (dataConWrapId dataCon) safeTyThingId _ = Nothing -- Possible documentation for an element in the code -#if MIN_VERSION_ghc(9,3,0) data SpanDoc = SpanDocString [HsDocString] SpanDocUris -#else -data SpanDoc - = SpanDocString HsDocString SpanDocUris -#endif | SpanDocText [T.Text] SpanDocUris deriving stock (Eq, Show, Generic) deriving anyclass NFData @@ -97,11 +92,7 @@ spanDocToMarkdown :: SpanDoc -> [T.Text] spanDocToMarkdown = \case (SpanDocString docs uris) -> let doc = T.pack $ haddockToMarkdown $ H.toRegular $ H._doc $ H.parseParas Nothing $ -#if MIN_VERSION_ghc(9,3,0) renderHsDocStrings docs -#else - unpackHDS docs -#endif in go [doc] uris (SpanDocText txt uris) -> go txt uris where diff --git a/ghcide/src/Development/IDE/Spans/Documentation.hs b/ghcide/src/Development/IDE/Spans/Documentation.hs index 6ab7b6ba9e..85f2ef1037 100644 --- a/ghcide/src/Development/IDE/Spans/Documentation.hs +++ b/ghcide/src/Development/IDE/Spans/Documentation.hs @@ -41,16 +41,8 @@ mkDocMap -> IO DocAndTyThingMap mkDocMap env rm this_mod = do -#if MIN_VERSION_ghc(9,3,0) (Just Docs{docs_decls = UniqMap this_docs}) <- extractDocs (hsc_dflags env) this_mod -#else - (_ , DeclDocMap this_docs, _) <- extractDocs this_mod -#endif -#if MIN_VERSION_ghc(9,3,0) d <- foldrM getDocs (fmap (\(_, x) -> (map hsDocString x) `SpanDocString` SpanDocUris Nothing Nothing) this_docs) names -#else - d <- foldrM getDocs (mkNameEnv $ M.toList $ fmap (`SpanDocString` SpanDocUris Nothing Nothing) this_docs) names -#endif k <- foldrM getType (tcg_type_env this_mod) names pure $ DKMap d k where @@ -84,11 +76,7 @@ getDocumentationsTryGhc env names = do Left _ -> return [] Right res -> zipWithM unwrap res names where -#if MIN_VERSION_ghc(9,3,0) unwrap (Right (Just docs, _)) n = SpanDocString (map hsDocString docs) <$> getUris n -#else - unwrap (Right (Just docs, _)) n = SpanDocString docs <$> getUris n -#endif unwrap _ n = mkSpanDocText n mkSpanDocText name = diff --git a/ghcide/src/Development/IDE/Types/HscEnvEq.hs b/ghcide/src/Development/IDE/Types/HscEnvEq.hs index dc2999dee6..10dc1b8f9f 100644 --- a/ghcide/src/Development/IDE/Types/HscEnvEq.hs +++ b/ghcide/src/Development/IDE/Types/HscEnvEq.hs @@ -1,25 +1,18 @@ module Development.IDE.Types.HscEnvEq ( HscEnvEq, hscEnv, newHscEnvEq, - hscEnvWithImportPaths, - newHscEnvEqPreserveImportPaths, - newHscEnvEqWithImportPaths, updateHscEnvEq, - envImportPaths, envPackageExports, envVisibleModuleNames, - deps ) where import Control.Concurrent.Async (Async, async, waitCatch) import Control.Concurrent.Strict (modifyVar, newVar) -import Control.DeepSeq (force) +import Control.DeepSeq (force, rwhnf) import Control.Exception (evaluate, mask, throwIO) import Control.Monad.Extra (eitherM, join, mapMaybeM) import Data.Either (fromRight) -import Data.Set (Set) -import qualified Data.Set as Set import Data.Unique (Unique) import qualified Data.Unique as Unique import Development.IDE.GHC.Compat hiding (newUnique) @@ -28,9 +21,7 @@ import Development.IDE.GHC.Error (catchSrcErrors) import Development.IDE.GHC.Util (lookupPackageConfig) import Development.IDE.Graph.Classes import Development.IDE.Types.Exports (ExportsMap, createExportsMap) -import Ide.PluginUtils (toAbsolute) import OpenTelemetry.Eventlog (withSpan) -import System.FilePath -- | An 'HscEnv' with equality. Two values are considered equal -- if they are created with the same call to 'newHscEnvEq' or @@ -38,13 +29,6 @@ import System.FilePath data HscEnvEq = HscEnvEq { envUnique :: !Unique , hscEnv :: !HscEnv - , deps :: [(UnitId, DynFlags)] - -- ^ In memory components for this HscEnv - -- This is only used at the moment for the import dirs in - -- the DynFlags - , envImportPaths :: Maybe (Set FilePath) - -- ^ If Just, import dirs originally configured in this env - -- If Nothing, the env import dirs are unaltered , envPackageExports :: IO ExportsMap , envVisibleModuleNames :: IO (Maybe [ModuleName]) -- ^ 'listVisibleModuleNames' is a pure function, @@ -59,19 +43,8 @@ updateHscEnvEq oldHscEnvEq newHscEnv = do update <$> Unique.newUnique -- | Wrap an 'HscEnv' into an 'HscEnvEq'. -newHscEnvEq :: FilePath -> FilePath -> HscEnv -> [(UnitId, DynFlags)] -> IO HscEnvEq -newHscEnvEq root cradlePath hscEnv0 deps = do - let relativeToCradle = (takeDirectory cradlePath ) - hscEnv = removeImportPaths hscEnv0 - - -- Make Absolute since targets are also absolute - let importPathsCanon = toAbsolute root . relativeToCradle <$> importPaths (hsc_dflags hscEnv0) - - newHscEnvEqWithImportPaths (Just $ Set.fromList importPathsCanon) hscEnv deps - -newHscEnvEqWithImportPaths :: Maybe (Set FilePath) -> HscEnv -> [(UnitId, DynFlags)] -> IO HscEnvEq -newHscEnvEqWithImportPaths envImportPaths hscEnv deps = do - +newHscEnvEq :: HscEnv -> IO HscEnvEq +newHscEnvEq hscEnv = do let dflags = hsc_dflags hscEnv envUnique <- Unique.newUnique @@ -112,23 +85,6 @@ newHscEnvEqWithImportPaths envImportPaths hscEnv deps = do return HscEnvEq{..} --- | Wrap an 'HscEnv' into an 'HscEnvEq'. -newHscEnvEqPreserveImportPaths - :: HscEnv -> [(UnitId, DynFlags)] -> IO HscEnvEq -newHscEnvEqPreserveImportPaths = newHscEnvEqWithImportPaths Nothing - --- | Unwrap the 'HscEnv' with the original import paths. --- Used only for locating imports -hscEnvWithImportPaths :: HscEnvEq -> HscEnv -hscEnvWithImportPaths HscEnvEq{..} - | Just imps <- envImportPaths - = hscSetFlags (setImportPaths (Set.toList imps) (hsc_dflags hscEnv)) hscEnv - | otherwise - = hscEnv - -removeImportPaths :: HscEnv -> HscEnv -removeImportPaths hsc = hscSetFlags (setImportPaths [] (hsc_dflags hsc)) hsc - instance Show HscEnvEq where show HscEnvEq{envUnique} = "HscEnvEq " ++ show (Unique.hashUnique envUnique) @@ -136,9 +92,9 @@ instance Eq HscEnvEq where a == b = envUnique a == envUnique b instance NFData HscEnvEq where - rnf (HscEnvEq a b c d _ _) = + rnf (HscEnvEq a b _ _) = -- deliberately skip the package exports map and visible module names - rnf (Unique.hashUnique a) `seq` b `seq` c `seq` rnf d + rnf (Unique.hashUnique a) `seq` rwhnf b instance Hashable HscEnvEq where hashWithSalt s = hashWithSalt s . envUnique diff --git a/ghcide/test/exe/CompletionTests.hs b/ghcide/test/exe/CompletionTests.hs index 26d8d17fc2..8b90244b76 100644 --- a/ghcide/test/exe/CompletionTests.hs +++ b/ghcide/test/exe/CompletionTests.hs @@ -276,8 +276,7 @@ nonLocalCompletionTests = where brokenForWinGhc = knownBrokenOnWindows "Windows has strange things in scope for some reason" brokenForWinOldGhc = - knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC92] "Windows (GHC == 9.2) has strange things in scope for some reason" - . knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC94] "Windows (GHC == 9.4) has strange things in scope for some reason" + knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC94] "Windows (GHC == 9.4) has strange things in scope for some reason" . knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC96] "Windows (GHC == 9.6) has strange things in scope for some reason" . knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC98] "Windows (GHC == 9.8) has strange things in scope for some reason" diff --git a/ghcide/test/exe/CradleTests.hs b/ghcide/test/exe/CradleTests.hs index cdfbb06ea2..de56060232 100644 --- a/ghcide/test/exe/CradleTests.hs +++ b/ghcide/test/exe/CradleTests.hs @@ -10,7 +10,6 @@ import Control.Applicative.Combinators import Control.Lens ((^.)) import Control.Monad.IO.Class (liftIO) import qualified Data.Text as T -import Development.IDE.GHC.Compat (GhcVersion (..)) import Development.IDE.GHC.Util import Development.IDE.Plugin.Test (WaitForIdeRuleResult (..)) import Development.IDE.Test (expectDiagnostics, @@ -30,7 +29,6 @@ import Language.LSP.Protocol.Types hiding import Language.LSP.Test import System.FilePath import System.IO.Extra hiding (withTempDir) -import Test.Hls (ignoreForGhcVersions) import Test.Tasty import Test.Tasty.HUnit @@ -41,11 +39,9 @@ tests = testGroup "cradle" ,testGroup "ignore-fatal" [ignoreFatalWarning] ,testGroup "loading" [loadCradleOnlyonce, retryFailedCradle] ,testGroup "multi" (multiTests "multi") - ,ignoreForGhcVersions [GHC92] "multiple units not supported on 9.2" - $ testGroup "multi-unit" (multiTests "multi-unit") + ,testGroup "multi-unit" (multiTests "multi-unit") ,testGroup "sub-directory" [simpleSubDirectoryTest] - ,ignoreForGhcVersions [GHC92] "multiple units not supported on 9.2" - $ testGroup "multi-unit-rexport" [multiRexportTest] + ,testGroup "multi-unit-rexport" [multiRexportTest] ] loadCradleOnlyonce :: TestTree diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index 5312276148..0a325deaf6 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -1,7 +1,7 @@ cabal-version: 3.4 category: Development name: haskell-language-server -version: 2.8.0.0 +version: 2.9.0.0 synopsis: LSP server for GHC description: Please see the README on GitHub at @@ -14,7 +14,7 @@ copyright: The Haskell IDE Team license: Apache-2.0 license-file: LICENSE build-type: Simple -tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 || ==9.2.8 +tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 extra-source-files: README.md ChangeLog.md @@ -129,8 +129,8 @@ library hls-cabal-fmt-plugin , base >=4.12 && <5 , directory , filepath - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp-types , mtl @@ -149,10 +149,10 @@ test-suite hls-cabal-fmt-plugin-tests , directory , filepath , haskell-language-server:hls-cabal-fmt-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 if flag(isolateCabalfmtTests) - build-tool-depends: cabal-fmt:cabal-fmt ^>=0.1.6 + build-tool-depends: cabal-fmt:cabal-fmt ^>=0.1.12 cpp-options: -Dhls_isolate_cabalfmt_tests ----------------------------- @@ -185,8 +185,8 @@ library hls-cabal-gild-plugin , base >=4.12 && <5 , directory , filepath - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp-types , text , mtl @@ -204,10 +204,11 @@ test-suite hls-cabal-gild-plugin-tests , directory , filepath , haskell-language-server:hls-cabal-gild-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 if flag(isolateCabalGildTests) - build-tool-depends: cabal-gild:cabal-gild ^>=1.3 + -- https://github.com/tfausak/cabal-gild/issues/89 + build-tool-depends: cabal-gild:cabal-gild >= 1.3 && < 1.3.2 cpp-options: -Dhls_isolate_cabalgild_tests ----------------------------- @@ -255,10 +256,10 @@ library hls-cabal-plugin , directory , filepath , extra >=1.7.4 - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable - , hls-plugin-api == 2.8.0.0 - , hls-graph == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 + , hls-graph == 2.9.0.0 , lens , lsp ^>=2.7 , lsp-types ^>=2.3 @@ -287,7 +288,7 @@ test-suite hls-cabal-plugin-tests , filepath , ghcide , haskell-language-server:hls-cabal-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -325,9 +326,9 @@ library hls-class-plugin , extra , ghc , ghc-exactprint >= 1.5 && < 1.10.0.0 - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hls-graph - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , mtl @@ -349,7 +350,7 @@ test-suite hls-class-plugin-tests , base , filepath , haskell-language-server:hls-class-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -384,9 +385,9 @@ library hls-call-hierarchy-plugin , base >=4.12 && <5 , containers , extra - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hiedb ^>= 0.6.0.0 - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp >=2.7 , sqlite-simple @@ -408,7 +409,7 @@ test-suite hls-call-hierarchy-plugin-tests , extra , filepath , haskell-language-server:hls-call-hierarchy-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp , lsp-test @@ -459,9 +460,9 @@ library hls-eval-plugin , filepath , ghc , ghc-boot-th - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hls-graph - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , lsp-types @@ -492,7 +493,7 @@ test-suite hls-eval-plugin-tests , filepath , haskell-language-server:hls-eval-plugin , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -523,9 +524,9 @@ library hls-explicit-imports-plugin , containers , deepseq , ghc - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hls-graph - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , mtl @@ -547,7 +548,7 @@ test-suite hls-explicit-imports-plugin-tests , extra , filepath , haskell-language-server:hls-explicit-imports-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -575,11 +576,11 @@ library hls-rename-plugin build-depends: , base >=4.12 && <5 , containers - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable , hiedb ^>= 0.6.0.0 , hie-compat - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , haskell-language-server:hls-refactor-plugin , lens , lsp-types @@ -605,7 +606,7 @@ test-suite hls-rename-plugin-tests , filepath , hls-plugin-api , haskell-language-server:hls-rename-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -620,13 +621,13 @@ flag retrie manual: True common retrie - if flag(retrie) + if flag(retrie) && impl(ghc < 9.10) build-depends: haskell-language-server:hls-retrie-plugin cpp-options: -Dhls_retrie library hls-retrie-plugin import: defaults, pedantic, warnings - if !flag(retrie) + if !(flag(retrie) && impl(ghc < 9.10)) buildable: False exposed-modules: Ide.Plugin.Retrie hs-source-dirs: plugins/hls-retrie-plugin/src @@ -637,9 +638,9 @@ library hls-retrie-plugin , containers , extra , ghc - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , haskell-language-server:hls-refactor-plugin , lens , lsp @@ -657,7 +658,7 @@ library hls-retrie-plugin test-suite hls-retrie-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(retrie) + if !(flag(retrie) && impl(ghc < 9.10)) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-retrie-plugin/test @@ -668,7 +669,7 @@ test-suite hls-retrie-plugin-tests , filepath , hls-plugin-api , haskell-language-server:{hls-refactor-plugin, hls-retrie-plugin} - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , text ----------------------------- @@ -688,13 +689,14 @@ flag hlint manual: True common hlint - if flag(hlint) + if flag(hlint) && impl(ghc < 9.10) build-depends: haskell-language-server:hls-hlint-plugin cpp-options: -Dhls_hlint library hls-hlint-plugin import: defaults, pedantic, warnings - if !flag(hlint) + -- https://github.com/ndmitchell/hlint/pull/1594 + if !(flag(hlint) && impl(ghc < 9.10)) buildable: False exposed-modules: Ide.Plugin.Hlint hs-source-dirs: plugins/hls-hlint-plugin/src @@ -705,10 +707,10 @@ library hls-hlint-plugin , containers , deepseq , filepath - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable , hlint >= 3.5 && < 3.9 - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , mtl @@ -736,7 +738,7 @@ library hls-hlint-plugin test-suite hls-hlint-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(hlint) + if !(flag(hlint) && impl(ghc < 9.10)) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-hlint-plugin/test @@ -748,7 +750,7 @@ test-suite hls-hlint-plugin-tests , filepath , haskell-language-server:hls-hlint-plugin , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -763,13 +765,13 @@ flag stan manual: True common stan - if flag(stan) && (impl(ghc > 8.8.1) && impl(ghc <= 9.2.3) || impl(ghc >= 9.4.0) && impl(ghc < 9.10.0)) + if flag(stan) && impl(ghc < 9.10.0) build-depends: haskell-language-server:hls-stan-plugin cpp-options: -Dhls_stan library hls-stan-plugin import: defaults, pedantic, warnings - if flag(stan) && (impl(ghc > 8.8.1) && impl(ghc <= 9.2.3) || impl(ghc >= 9.4.0) && impl(ghc < 9.10.0)) + if flag(stan) && impl(ghc < 9.10.0) buildable: True else buildable: False @@ -797,7 +799,7 @@ library hls-stan-plugin test-suite hls-stan-plugin-tests import: defaults, pedantic, test-defaults, warnings - if flag(stan) && (impl(ghc > 8.8.1) && impl(ghc <= 9.2.3) || impl(ghc >= 9.4.0) && impl(ghc < 9.10.0)) + if flag(stan) && impl(ghc < 9.10.0) buildable: True else buildable: False @@ -809,7 +811,7 @@ test-suite hls-stan-plugin-tests , filepath , haskell-language-server:hls-stan-plugin , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -841,8 +843,8 @@ library hls-module-name-plugin , base >=4.12 && <5 , containers , filepath - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp , text , transformers @@ -859,7 +861,7 @@ test-suite hls-module-name-plugin-tests , base , filepath , haskell-language-server:hls-module-name-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- -- pragmas plugin @@ -885,8 +887,8 @@ library hls-pragmas-plugin , base >=4.12 && <5 , extra , fuzzy - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , text @@ -905,7 +907,7 @@ test-suite hls-pragmas-plugin-tests , base , filepath , haskell-language-server:hls-pragmas-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-types , text @@ -920,13 +922,13 @@ flag splice manual: True common splice - if flag(splice) + if flag(splice) && impl(ghc < 9.10) build-depends: haskell-language-server:hls-splice-plugin cpp-options: -Dhls_splice library hls-splice-plugin import: defaults, pedantic, warnings - if !flag(splice) + if !(flag(splice) && impl(ghc < 9.10)) buildable: False exposed-modules: Ide.Plugin.Splice @@ -939,9 +941,8 @@ library hls-splice-plugin , extra , foldl , ghc - , ghc-exactprint - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , haskell-language-server:hls-refactor-plugin , lens , lsp @@ -956,7 +957,7 @@ library hls-splice-plugin test-suite hls-splice-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(splice) + if !(flag(splice) && impl(ghc < 9.10)) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-splice-plugin/test @@ -965,7 +966,7 @@ test-suite hls-splice-plugin-tests , base , filepath , haskell-language-server:hls-splice-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , text ----------------------------- @@ -993,10 +994,10 @@ library hls-alternate-number-format-plugin , base >=4.12 && < 5 , containers , extra - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , ghc-boot-th , hls-graph - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp ^>=2.7 , mtl @@ -1022,7 +1023,7 @@ test-suite hls-alternate-number-format-plugin-tests , base >=4.12 && < 5 , filepath , haskell-language-server:hls-alternate-number-format-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , regex-tdfa , tasty-quickcheck , text @@ -1055,8 +1056,8 @@ library hls-qualify-imported-names-plugin build-depends: , base >=4.12 && <5 , containers - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , text @@ -1078,7 +1079,7 @@ test-suite hls-qualify-imported-names-plugin-tests , text , filepath , haskell-language-server:hls-qualify-imported-names-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- -- code range plugin @@ -1109,9 +1110,9 @@ library hls-code-range-plugin , containers , deepseq , extra - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , mtl @@ -1134,7 +1135,7 @@ test-suite hls-code-range-plugin-tests , bytestring , filepath , haskell-language-server:hls-code-range-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp , lsp-test @@ -1163,8 +1164,8 @@ library hls-change-type-signature-plugin hs-source-dirs: plugins/hls-change-type-signature-plugin/src build-depends: , base >=4.12 && < 5 - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp-types , regex-tdfa , syb @@ -1189,7 +1190,7 @@ test-suite hls-change-type-signature-plugin-tests , base >=4.12 && < 5 , filepath , haskell-language-server:hls-change-type-signature-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , regex-tdfa , text default-extensions: @@ -1223,9 +1224,9 @@ library hls-gadt-plugin , containers , extra , ghc - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , ghc-exactprint - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , haskell-language-server:hls-refactor-plugin , lens , lsp >=2.7 @@ -1246,7 +1247,7 @@ test-suite hls-gadt-plugin-tests , base , filepath , haskell-language-server:hls-gadt-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , text ----------------------------- @@ -1274,9 +1275,9 @@ library hls-explicit-fixity-plugin , containers , deepseq , extra - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , hashable - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , lsp >=2.7 , text @@ -1293,7 +1294,7 @@ test-suite hls-explicit-fixity-plugin-tests , base , filepath , haskell-language-server:hls-explicit-fixity-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , text ----------------------------- @@ -1317,8 +1318,8 @@ library hls-explicit-record-fields-plugin exposed-modules: Ide.Plugin.ExplicitFields build-depends: , base >=4.12 && <5 - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp , lens , hls-graph @@ -1344,7 +1345,7 @@ test-suite hls-explicit-record-fields-plugin-tests , filepath , text , haskell-language-server:hls-explicit-record-fields-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- -- overloaded record dot plugin @@ -1392,7 +1393,7 @@ test-suite hls-overloaded-record-dot-plugin-tests , filepath , text , haskell-language-server:hls-overloaded-record-dot-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- @@ -1405,21 +1406,22 @@ flag floskell manual: True common floskell - if flag(floskell) + if flag(floskell) && impl(ghc < 9.10) build-depends: haskell-language-server:hls-floskell-plugin cpp-options: -Dhls_floskell library hls-floskell-plugin import: defaults, pedantic, warnings - if !flag(floskell) + -- https://github.com/ennocramer/floskell/pull/82 + if !(flag(floskell) && impl(ghc < 9.10)) buildable: False exposed-modules: Ide.Plugin.Floskell hs-source-dirs: plugins/hls-floskell-plugin/src build-depends: , base >=4.12 && <5 , floskell ^>=0.11.0 - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp-types ^>=2.3 , mtl , text @@ -1427,7 +1429,7 @@ library hls-floskell-plugin test-suite hls-floskell-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(floskell) + if !(flag(floskell) && impl(ghc < 9.10)) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-floskell-plugin/test @@ -1436,7 +1438,7 @@ test-suite hls-floskell-plugin-tests , base , filepath , haskell-language-server:hls-floskell-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- -- fourmolu plugin @@ -1463,8 +1465,8 @@ library hls-fourmolu-plugin , filepath , fourmolu ^>= 0.14 || ^>= 0.15 || ^>= 0.16 , ghc-boot-th - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , mtl @@ -1491,7 +1493,7 @@ test-suite hls-fourmolu-plugin-tests , filepath , haskell-language-server:hls-fourmolu-plugin , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lsp-test ----------------------------- @@ -1519,8 +1521,8 @@ library hls-ormolu-plugin , extra , filepath , ghc-boot-th - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp , mtl , process-extras >= 0.7.1 @@ -1547,7 +1549,7 @@ test-suite hls-ormolu-plugin-tests , filepath , haskell-language-server:hls-ormolu-plugin , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lsp-types , ormolu @@ -1561,13 +1563,14 @@ flag stylishHaskell manual: True common stylishHaskell - if flag(stylishHaskell) + if flag(stylishHaskell) && impl(ghc < 9.10) build-depends: haskell-language-server:hls-stylish-haskell-plugin cpp-options: -Dhls_stylishHaskell library hls-stylish-haskell-plugin import: defaults, pedantic, warnings - if !flag(stylishHaskell) + -- https://github.com/haskell/stylish-haskell/issues/479 + if !(flag(stylishHaskell) && impl(ghc < 9.10)) buildable: False exposed-modules: Ide.Plugin.StylishHaskell hs-source-dirs: plugins/hls-stylish-haskell-plugin/src @@ -1576,8 +1579,8 @@ library hls-stylish-haskell-plugin , directory , filepath , ghc-boot-th - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp-types , mtl , stylish-haskell ^>=0.12 || ^>=0.13 || ^>=0.14 @@ -1586,7 +1589,7 @@ library hls-stylish-haskell-plugin test-suite hls-stylish-haskell-plugin-tests import: defaults, pedantic, test-defaults, warnings - if !flag(stylishHaskell) + if !(flag(stylishHaskell) && impl(ghc < 9.10)) buildable: False type: exitcode-stdio-1.0 hs-source-dirs: plugins/hls-stylish-haskell-plugin/test @@ -1595,7 +1598,7 @@ test-suite hls-stylish-haskell-plugin-tests , base , filepath , haskell-language-server:hls-stylish-haskell-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 ----------------------------- -- refactor plugin @@ -1648,8 +1651,8 @@ library hls-refactor-plugin , bytestring , ghc-boot , regex-tdfa - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lsp , text , transformers @@ -1687,7 +1690,7 @@ test-suite hls-refactor-plugin-tests , filepath , ghcide:ghcide , haskell-language-server:hls-refactor-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-test , lsp-types @@ -1735,8 +1738,8 @@ library hls-semantic-tokens-plugin , extra , text-rope , mtl >= 2.2 - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp >=2.6 , text @@ -1746,7 +1749,7 @@ library hls-semantic-tokens-plugin , array , deepseq , dlist - , hls-graph == 2.8.0.0 + , hls-graph == 2.9.0.0 , template-haskell , data-default , stm @@ -1768,10 +1771,10 @@ test-suite hls-semantic-tokens-plugin-tests , containers , data-default , filepath - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , haskell-language-server:hls-semantic-tokens-plugin - , hls-plugin-api == 2.8.0.0 - , hls-test-utils == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp , lsp-test @@ -1802,9 +1805,9 @@ library hls-notes-plugin build-depends: , base >=4.12 && <5 , array - , ghcide == 2.8.0.0 - , hls-graph == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-graph == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp >=2.7 , mtl >= 2.2 @@ -1831,7 +1834,7 @@ test-suite hls-notes-plugin-tests , base , filepath , haskell-language-server:hls-notes-plugin - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 default-extensions: OverloadedStrings ---------------------------- @@ -1892,10 +1895,10 @@ library , extra , filepath , ghc - , ghcide == 2.8.0.0 + , ghcide == 2.9.0.0 , githash >=0.1.6.1 , hie-bios - , hls-plugin-api == 2.8.0.0 + , hls-plugin-api == 2.9.0.0 , optparse-applicative , optparse-simple , prettyprinter >= 1.7 @@ -2002,7 +2005,7 @@ test-suite func-test , ghcide:ghcide , hashable , hls-plugin-api - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , lens , lsp-test , lsp-types @@ -2028,7 +2031,7 @@ test-suite func-test if flag(eval) cpp-options: -Dhls_eval -- formatters - if flag(floskell) + if flag(floskell) && impl(ghc < 9.10) cpp-options: -Dhls_floskell if flag(fourmolu) cpp-options: -Dhls_fourmolu @@ -2047,7 +2050,7 @@ test-suite wrapper-test build-depends: , base >=4.16 && <5 , extra - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 , process hs-source-dirs: test/wrapper @@ -2131,7 +2134,7 @@ test-suite ghcide-tests , text , text-rope , unordered-containers - , hls-test-utils == 2.8.0.0 + , hls-test-utils == 2.9.0.0 if impl(ghc <9.3) build-depends: ghc-typelits-knownnat diff --git a/hie-compat/hie-compat.cabal b/hie-compat/hie-compat.cabal index 49bf9990a5..bb96ab88fb 100644 --- a/hie-compat/hie-compat.cabal +++ b/hie-compat/hie-compat.cabal @@ -35,7 +35,5 @@ library Compat.HieDebug Compat.HieUtils - if (impl(ghc >= 9.2) && impl(ghc < 9.3)) - hs-source-dirs: src-ghc92 src-reexport-ghc9 if (impl(ghc >= 9.4)) hs-source-dirs: src-reexport-ghc92 diff --git a/hls-graph/hls-graph.cabal b/hls-graph/hls-graph.cabal index 72adcc3cd1..a06766ae22 100644 --- a/hls-graph/hls-graph.cabal +++ b/hls-graph/hls-graph.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-graph -version: 2.8.0.0 +version: 2.9.0.0 synopsis: Haskell Language Server internal graph API description: Please see the README on GitHub at diff --git a/hls-plugin-api/hls-plugin-api.cabal b/hls-plugin-api/hls-plugin-api.cabal index 05d5a9ad1e..0a22379533 100644 --- a/hls-plugin-api/hls-plugin-api.cabal +++ b/hls-plugin-api/hls-plugin-api.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-plugin-api -version: 2.8.0.0 +version: 2.9.0.0 synopsis: Haskell Language Server API for plugin communication description: Please see the README on GitHub at @@ -66,7 +66,7 @@ library , filepath , ghc , hashable - , hls-graph == 2.8.0.0 + , hls-graph == 2.9.0.0 , lens , lens-aeson , lsp ^>=2.7 diff --git a/hls-test-utils/hls-test-utils.cabal b/hls-test-utils/hls-test-utils.cabal index 299d869b7b..be7a4aee6b 100644 --- a/hls-test-utils/hls-test-utils.cabal +++ b/hls-test-utils/hls-test-utils.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-test-utils -version: 2.8.0.0 +version: 2.9.0.0 synopsis: Utilities used in the tests of Haskell Language Server description: Please see the README on GitHub at @@ -43,8 +43,8 @@ library , directory , extra , filepath - , ghcide == 2.8.0.0 - , hls-plugin-api == 2.8.0.0 + , ghcide == 2.9.0.0 + , hls-plugin-api == 2.9.0.0 , lens , lsp , lsp-test ^>=0.17 diff --git a/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs b/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs index 3b463509c7..c26227d933 100644 --- a/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs +++ b/plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs @@ -68,13 +68,8 @@ getPattern (L (locA -> (RealSrcSpan patSpan _)) pat) = case pat of HsInt _ val -> fromIntegralLit patSpan val HsRat _ val _ -> fromFractionalLit patSpan val _ -> Nothing -#if __GLASGOW_HASKELL__ == 902 - NPat _ (L (RealSrcSpan sSpan _) overLit) _ _ -> fromOverLit overLit sSpan - NPlusKPat _ _ (L (RealSrcSpan sSpan _) overLit1) _ _ _ -> fromOverLit overLit1 sSpan -#else NPat _ (L (locA -> (RealSrcSpan sSpan _)) overLit) _ _ -> fromOverLit overLit sSpan NPlusKPat _ _ (L (locA -> (RealSrcSpan sSpan _)) overLit1) _ _ _ -> fromOverLit overLit1 sSpan -#endif _ -> Nothing getPattern _ = Nothing diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index d34e19ea4f..3a45058a57 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -39,7 +39,7 @@ test :: TestTree test = testGroup "changeTypeSignature" [ testRegexes , codeActionTest "TExpectedActual" 4 11 - , knownBrokenForGhcVersions [GHC92 .. GHC910] "Error Message in 9.2+ does not provide enough info" $ + , knownBrokenForGhcVersions [GHC94 .. GHC910] "Error Message in 9.2+ does not provide enough info" $ codeActionTest "TRigidType" 4 14 , codeActionTest "TRigidType2" 4 6 , codeActionTest "TLocalBinding" 7 22 diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs index 4d9ace1163..b3c2be60a6 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs @@ -151,14 +151,6 @@ codeLens recorder st plId CodeLensParams{_textDocument} = dbg $ LogCodeLensFp fp (comments, _) <- runActionE "eval.GetParsedModuleWithComments" st $ useWithStaleE GetEvalComments nfp - -- dbg "excluded comments" $ show $ DL.toList $ - -- foldMap (\(L a b) -> - -- case b of - -- AnnLineComment{} -> mempty - -- AnnBlockComment{} -> mempty - -- _ -> DL.singleton (a, b) - -- ) - -- $ apiAnnComments' pm_annotations dbg $ LogCodeLensComments comments -- Extract tests from source code diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs index 3d3fe5f704..7dac1d3ce0 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs @@ -25,12 +25,10 @@ import Development.IDE.GHC.Util (printOutputable) import GHC.LanguageExtensions.Type (Extension (..)) import Ide.Plugin.Eval.Util (gStrictTry) -#if MIN_VERSION_ghc(9,3,0) import GHC (setTopSessionDynFlags, setUnitDynFlags) import GHC.Driver.Env import GHC.Driver.Session (getDynFlags) -#endif {- $setup >>> import GHC @@ -174,13 +172,9 @@ vList = vcat . map text setSessionAndInteractiveDynFlags :: DynFlags -> Ghc () setSessionAndInteractiveDynFlags df = do -#if MIN_VERSION_ghc(9,3,0) _ <- setUnitDynFlags (homeUnitId_ df) df modifySession (hscUpdateLoggerFlags . hscSetActiveUnitId (homeUnitId_ df)) df' <- getDynFlags setTopSessionDynFlags df' -#else - _ <- setSessionDynFlags df -#endif sessDyns <- getSessionDynFlags setInteractiveDynFlags sessDyns diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs index 14b47f4d95..175b389398 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs @@ -77,7 +77,6 @@ gevaluate = liftIO . evaluate showErr :: Monad m => SomeException -> m String showErr e = -#if MIN_VERSION_ghc(9,3,0) case fromException e of -- On GHC 9.4+, the show instance adds the error message span -- We don't want this for the plugin @@ -93,7 +92,6 @@ showErr e = . errMsgDiagnostic) $ getMessages msgs _ -> -#endif return . show $ e #if MIN_VERSION_ghc(9,8,0) diff --git a/plugins/hls-eval-plugin/test/Main.hs b/plugins/hls-eval-plugin/test/Main.hs index 10158531d2..85c6980849 100644 --- a/plugins/hls-eval-plugin/test/Main.hs +++ b/plugins/hls-eval-plugin/test/Main.hs @@ -133,7 +133,6 @@ tests = GHC98 -> "ghc98.expected" GHC96 -> "ghc96.expected" GHC94 -> "ghc94.expected" - GHC92 -> "ghc92.expected" , goldenWithEval "Prelude has no special treatment, it is imported as stated in the module" "TPrelude" "hs" , goldenWithEval "Don't panic on {-# UNPACK #-} pragma" "TUNPACK" "hs" , goldenWithEval "Can handle eval inside nested comment properly" "TNested" "hs" diff --git a/plugins/hls-eval-plugin/test/testdata/TPropertyError.ghc92.expected.hs b/plugins/hls-eval-plugin/test/testdata/TPropertyError.ghc92.expected.hs deleted file mode 100644 index 46359c86ab..0000000000 --- a/plugins/hls-eval-plugin/test/testdata/TPropertyError.ghc92.expected.hs +++ /dev/null @@ -1,6 +0,0 @@ --- Support for property checking -module TProperty where - --- prop> \(l::[Bool]) -> head l --- *** Failed! Exception: 'Prelude.head: empty list' (after 1 test): --- [] diff --git a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs index 7db7b0378f..a85a449704 100644 --- a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs +++ b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs @@ -133,10 +133,8 @@ h98ToGADTConDecl dataName tyVars ctxt = \case #endif #if MIN_VERSION_ghc(9,9,0) renderDetails (RecCon recs) = RecConGADT NoEpUniTok recs -#elif MIN_VERSION_ghc(9,3,0) - renderDetails (RecCon recs) = RecConGADT recs noHsUniTok #else - renderDetails (RecCon recs) = RecConGADT recs + renderDetails (RecCon recs) = RecConGADT recs noHsUniTok #endif @@ -206,11 +204,7 @@ prettyGADTDecl df decl = adjustTyClD = \case Right (L _ (TyClD _ tycld)) -> Right $ adjustDataDecl tycld Right x -> Left $ "Expect TyClD but got " <> showAst x -#if MIN_VERSION_ghc(9,3,0) Left err -> Left $ printWithoutUniques err -#else - Left err -> Left $ show err -#endif adjustDataDecl DataDecl{..} = DataDecl { tcdDExt = adjustWhere tcdDExt diff --git a/plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs b/plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs index 5c3f4ba781..8bd4a0712b 100644 --- a/plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs +++ b/plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs @@ -38,8 +38,7 @@ import Development.IDE (GetParsedModule (GetParse Priority (Debug), Recorder, WithPriority, colon, evalGhcEnv, - hscEnvWithImportPaths, - logWith, + hscEnv, logWith, realSrcSpanToRange, rootDir, runAction, useWithStale, (<+>)) @@ -140,7 +139,7 @@ pathModuleNames recorder state normFilePath filePath | firstLetter isLower $ takeFileName filePath = return ["Main"] | otherwise = do (session, _) <- runActionE "ModuleName.ghcSession" state $ useWithStaleE GhcSession normFilePath - srcPaths <- liftIO $ evalGhcEnv (hscEnvWithImportPaths session) $ importPaths <$> getSessionDynFlags + srcPaths <- liftIO $ evalGhcEnv (hscEnv session) $ importPaths <$> getSessionDynFlags logWith recorder Debug (SrcPaths srcPaths) -- Append a `pathSeparator` to make the path looks like a directory, diff --git a/plugins/hls-overloaded-record-dot-plugin/src/Ide/Plugin/OverloadedRecordDot.hs b/plugins/hls-overloaded-record-dot-plugin/src/Ide/Plugin/OverloadedRecordDot.hs index d5dcde3c2a..c37bba6359 100644 --- a/plugins/hls-overloaded-record-dot-plugin/src/Ide/Plugin/OverloadedRecordDot.hs +++ b/plugins/hls-overloaded-record-dot-plugin/src/Ide/Plugin/OverloadedRecordDot.hs @@ -289,7 +289,6 @@ getRecSels (unLoc -> XExpr (ExpandedThingRn a _)) = (collectRecordSelectors a, T #else getRecSels (unLoc -> XExpr (HsExpanded a _)) = (collectRecordSelectors a, True) #endif -#if __GLASGOW_HASKELL__ >= 903 -- applied record selection: "selector record" or "selector (record)" or -- "selector selector2.record2" getRecSels e@(unLoc -> HsApp _ se@(unLoc -> HsRecSel _ _) re) = @@ -301,15 +300,6 @@ getRecSels e@(unLoc -> OpApp _ se@(unLoc -> HsRecSel _ _) (unLoc -> HsVar _ (unLoc -> d)) re) | d == dollarName = ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re | RealSrcSpan realSpan' _ <- [ getLoc e ] ], False ) -#else -getRecSels e@(unLoc -> HsApp _ se@(unLoc -> HsRecFld _ _) re) = - ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re - | RealSrcSpan realSpan' _ <- [ getLoc e ] ], False ) -getRecSels e@(unLoc -> OpApp _ se@(unLoc -> HsRecFld _ _) - (unLoc -> HsVar _ (unLoc -> d)) re) | d == dollarName = - ( [ RecordSelectorExpr (realSrcSpanToRange realSpan') se re - | RealSrcSpan realSpan' _ <- [ getLoc e ] ], False ) -#endif getRecSels _ = ([], False) collectRecSelResult :: MonadIO m => IdeState -> NormalizedFilePath diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs index 949e2a700b..6a157c4948 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs @@ -32,9 +32,6 @@ showAstDataHtml a0 = html $ li = tag "li" caret x = tag' [("class", text "caret")] "span" "" <+> x nested foo cts -#if !MIN_VERSION_ghc(9,3,0) - | cts == empty = foo -#endif | otherwise = foo $$ (caret $ ul cts) body cts = tag "body" $ cts $$ tag "script" (text js) header = tag "head" $ tag "style" $ text css diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs index e54db25d60..38080ca4e5 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs @@ -158,7 +158,7 @@ getAnnotatedParsedSourceRule recorder = define (cmapWithPrio LogShake recorder) return ([], fmap annotateParsedSource pm) annotateParsedSource :: ParsedModule -> ParsedSource -annotateParsedSource (ParsedModule _ ps _ _) = +annotateParsedSource (ParsedModule _ ps _) = #if MIN_VERSION_ghc(9,9,0) ps #else diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs index 175aced38f..35b67f1565 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs @@ -47,7 +47,6 @@ import Development.IDE.Core.Service import Development.IDE.Core.Shake hiding (Log) import Development.IDE.GHC.Compat hiding (ImplicitPrelude) -import Development.IDE.GHC.Compat.ExactPrint import Development.IDE.GHC.Compat.Util import Development.IDE.GHC.Error import Development.IDE.GHC.ExactPrint @@ -105,6 +104,7 @@ import Text.Regex.TDFA ((=~), (=~~)) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] #if !MIN_VERSION_ghc(9,9,0) +import Development.IDE.GHC.Compat.ExactPrint (makeDeltaAst) import GHC (Anchor (anchor_op), AnchorOperation (..), EpaLocation (..)) @@ -312,11 +312,7 @@ findSigOfBind range bind = msum [findSigOfBinds range (grhssLocalBinds grhs) -- where clause , do -#if MIN_VERSION_ghc(9,3,0) grhs <- findDeclContainingLoc (_start range) (grhssGRHSs grhs) -#else - grhs <- findDeclContainingLoc (_start range) (map reLocA $ grhssGRHSs grhs) -#endif case unLoc grhs of GRHS _ _ bd -> findSigOfExpr (unLoc bd) ] @@ -324,7 +320,7 @@ findSigOfBind range bind = findSigOfExpr :: HsExpr p -> Maybe (Sig p) findSigOfExpr = go where -#if MIN_VERSION_ghc(9,3,0) && !MIN_VERSION_ghc(9,9,0) +#if !MIN_VERSION_ghc(9,9,0) go (HsLet _ _ binds _ _) = findSigOfBinds range binds #else go (HsLet _ binds _) = findSigOfBinds range binds diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs index ed2d3b4a73..a7407b6791 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs @@ -126,7 +126,7 @@ appendFinalPatToMatches name = \case -- -- TODO instead of inserting a typed hole; use GHC's suggested type from the error addArgumentAction :: ParsedModule -> Range -> T.Text -> Maybe T.Text -> Either PluginError [(T.Text, [TextEdit])] -addArgumentAction (ParsedModule _ moduleSrc _ _) range name _typ = do +addArgumentAction (ParsedModule _ moduleSrc _) range name _typ = do (newSource, _, _) <- runTransformT $ do (moduleSrc', join -> matchedDeclNameMay) <- addNameAsLastArgOfMatchingDecl #if MIN_VERSION_ghc(9,9,0) diff --git a/plugins/hls-refactor-plugin/test/Main.hs b/plugins/hls-refactor-plugin/test/Main.hs index f913e71b55..aa5b5a2a4c 100644 --- a/plugins/hls-refactor-plugin/test/Main.hs +++ b/plugins/hls-refactor-plugin/test/Main.hs @@ -1347,8 +1347,7 @@ extendImportTests = testGroup "extend import actions" , "b :: A" , "b = ConstructorFoo" ]) - , brokenForGHC92 "On GHC 9.2, the error doesn't contain \"perhaps you want ...\" part from which import suggestion can be extracted." $ - testSession "extend single line import in presence of extra parens" $ template + , testSession "extend single line import in presence of extra parens" $ template [] ("Main.hs", T.unlines [ "import Data.Monoid (First)" @@ -1534,7 +1533,7 @@ extendImportTests = testGroup "extend import actions" , "import A (pattern Some)" , "k (Some x) = x" ]) - , ignoreForGhcVersions [GHC92, GHC94] "Diagnostic message has no suggestions" $ + , ignoreForGhcVersions [GHC94] "Diagnostic message has no suggestions" $ testSession "type constructor name same as data constructor name" $ template [("ModuleA.hs", T.unlines [ "module ModuleA where" @@ -3222,7 +3221,7 @@ exportUnusedTests = testGroup "export unused actions" ] (R 2 0 2 11) "Export ‘bar’" - , ignoreForGhcVersions [GHC92, GHC94] "Diagnostic message has no suggestions" $ + , ignoreForGhcVersions [GHC94] "Diagnostic message has no suggestions" $ testSession "type is exported but not the constructor of same name" $ templateNoAction [ "{-# OPTIONS_GHC -Wunused-top-binds #-}" , "module A (Foo) where" @@ -3850,6 +3849,3 @@ withTempDir f = System.IO.Extra.withTempDir $ \dir -> brokenForGHC94 :: String -> TestTree -> TestTree brokenForGHC94 = knownBrokenForGhcVersions [GHC94] - -brokenForGHC92 :: String -> TestTree -> TestTree -brokenForGHC92 = knownBrokenForGhcVersions [GHC92] diff --git a/plugins/hls-rename-plugin/test/Main.hs b/plugins/hls-rename-plugin/test/Main.hs index cd4d3f6f88..5f7fb818ff 100644 --- a/plugins/hls-rename-plugin/test/Main.hs +++ b/plugins/hls-rename-plugin/test/Main.hs @@ -20,18 +20,13 @@ main = defaultTestRunner tests renamePlugin :: PluginTestDescriptor Rename.Log renamePlugin = mkPluginTestDescriptor Rename.descriptor "rename" --- See https://github.com/wz1000/HieDb/issues/45 -recordConstructorIssue :: String -recordConstructorIssue = "HIE references for record fields incorrect with GHC versions >= 9" - tests :: TestTree tests = testGroup "Rename" [ goldenWithRename "Data constructor" "DataConstructor" $ \doc -> rename doc (Position 0 15) "Op" , goldenWithRename "Exported function" "ExportedFunction" $ \doc -> rename doc (Position 2 1) "quux" - , ignoreForGhcVersions [GHC92] recordConstructorIssue $ - goldenWithRename "Field Puns" "FieldPuns" $ \doc -> + , goldenWithRename "Field Puns" "FieldPuns" $ \doc -> rename doc (Position 7 13) "bleh" , goldenWithRename "Function argument" "FunctionArgument" $ \doc -> rename doc (Position 3 4) "y" @@ -45,8 +40,7 @@ tests = testGroup "Rename" rename doc (Position 3 8) "baz" , goldenWithRename "Import hiding" "ImportHiding" $ \doc -> rename doc (Position 0 22) "hiddenFoo" - , ignoreForGhcVersions [GHC92] recordConstructorIssue $ - goldenWithRename "Indirect Puns" "IndirectPuns" $ \doc -> + , goldenWithRename "Indirect Puns" "IndirectPuns" $ \doc -> rename doc (Position 4 23) "blah" , goldenWithRename "Let expression" "LetExpression" $ \doc -> rename doc (Position 5 11) "foobar" @@ -58,8 +52,7 @@ tests = testGroup "Rename" rename doc (Position 3 12) "baz" , goldenWithRename "Realigns do block indentation" "RealignDo" $ \doc -> rename doc (Position 0 2) "fooBarQuux" - , ignoreForGhcVersions [GHC92] recordConstructorIssue $ - goldenWithRename "Record field" "RecordField" $ \doc -> + , goldenWithRename "Record field" "RecordField" $ \doc -> rename doc (Position 6 9) "number" , goldenWithRename "Shadowed name" "ShadowedName" $ \doc -> rename doc (Position 1 1) "baz" diff --git a/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs b/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs index ca82fc73e8..242405274b 100644 --- a/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs +++ b/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs @@ -127,9 +127,7 @@ import Retrie.SYB (everything, extQ, import Retrie.Types import Retrie.Universe (Universe) -#if MIN_VERSION_ghc(9,3,0) import GHC.Types.PkgQual -#endif data Log = LogParsingModule FilePath @@ -735,11 +733,7 @@ toImportDecl AddImport {..} = GHC.ImportDecl {ideclSource = ideclSource', ..} ideclAs = toMod <$> ideclAsString ideclQualified = if ideclQualifiedBool then GHC.QualifiedPre else GHC.NotQualified -#if MIN_VERSION_ghc(9,3,0) ideclPkgQual = NoRawPkgQual -#else - ideclPkgQual = Nothing -#endif #if MIN_VERSION_ghc(9,5,0) ideclImportList = Nothing diff --git a/plugins/hls-semantic-tokens-plugin/test/SemanticTokensTest.hs b/plugins/hls-semantic-tokens-plugin/test/SemanticTokensTest.hs index f5613fa42a..6a0b0673c2 100644 --- a/plugins/hls-semantic-tokens-plugin/test/SemanticTokensTest.hs +++ b/plugins/hls-semantic-tokens-plugin/test/SemanticTokensTest.hs @@ -263,10 +263,9 @@ semanticTokensTests = goldenWithSemanticTokensWithDefaultConfig "pattern bind" "TPatternSynonym", goldenWithSemanticTokensWithDefaultConfig "type family" "TTypefamily", goldenWithSemanticTokensWithDefaultConfig "TUnicodeSyntax" "TUnicodeSyntax", - goldenWithSemanticTokensWithDefaultConfig "TQualifiedName" "TQualifiedName" + goldenWithSemanticTokensWithDefaultConfig "TQualifiedName" "TQualifiedName", + goldenWithSemanticTokensWithDefaultConfig "TDoc" "TDoc" ] - -- not supported in ghc92 - ++ [goldenWithSemanticTokensWithDefaultConfig "TDoc" "TDoc" | ghcVersion > GHC92] semanticTokensDataTypeTests :: TestTree semanticTokensDataTypeTests = diff --git a/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs b/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs index 6e913d8367..fbe59500ae 100644 --- a/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs +++ b/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs @@ -210,7 +210,7 @@ setupHscEnv ideState fp pm = do hscEnvEq <- runActionE "expandTHSplice.fallback.ghcSessionDeps" ideState $ useE GhcSessionDeps fp let ps = annotateParsedSource pm - hscEnv0 = hscEnvWithImportPaths hscEnvEq + hscEnv0 = hscEnv hscEnvEq modSum = pm_mod_summary pm hscEnv <- liftIO $ setupDynFlagsForGHCiLike hscEnv0 $ ms_hspp_opts modSum pure (ps, hscEnv, hsc_dflags hscEnv) diff --git a/test/functional/Main.hs b/test/functional/Main.hs index 7adf499c05..004c817d2b 100644 --- a/test/functional/Main.hs +++ b/test/functional/Main.hs @@ -12,7 +12,7 @@ main :: IO () main = defaultTestRunner $ testGroup "haskell-language-server" [ Config.tests , ConfigSchema.tests - , ignoreInEnv [HostOS Windows, GhcVer GHC92] "Tests gets stuck in ci" $ Format.tests + , ignoreInEnv [HostOS Windows] "Tests gets stuck in ci" $ Format.tests , FunctionalBadProject.tests , HieBios.tests , ignoreInEnv [HostOS Windows] "Tests gets stuck in ci" $ Progress.tests diff --git a/test/testdata/schema/ghc92/default-config.golden.json b/test/testdata/schema/ghc92/default-config.golden.json deleted file mode 100644 index be1a256f97..0000000000 --- a/test/testdata/schema/ghc92/default-config.golden.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "cabalFormattingProvider": "cabal-gild", - "checkParents": "CheckOnSave", - "checkProject": true, - "formattingProvider": "ormolu", - "maxCompletions": 40, - "plugin": { - "alternateNumberFormat": { - "globalOn": true - }, - "cabal": { - "codeActionsOn": true, - "completionOn": true, - "diagnosticsOn": true - }, - "cabal-fmt": { - "config": { - "path": "cabal-fmt" - } - }, - "cabal-gild": { - "config": { - "path": "cabal-gild" - } - }, - "callHierarchy": { - "globalOn": true - }, - "changeTypeSignature": { - "globalOn": true - }, - "class": { - "codeActionsOn": true, - "codeLensOn": true - }, - "eval": { - "config": { - "diff": true, - "exception": false - }, - "globalOn": true - }, - "explicit-fields": { - "globalOn": true - }, - "explicit-fixity": { - "globalOn": true - }, - "fourmolu": { - "config": { - "external": false, - "path": "fourmolu" - } - }, - "gadt": { - "globalOn": true - }, - "ghcide-code-actions-bindings": { - "globalOn": true - }, - "ghcide-code-actions-fill-holes": { - "globalOn": true - }, - "ghcide-code-actions-imports-exports": { - "globalOn": true - }, - "ghcide-code-actions-type-signatures": { - "globalOn": true - }, - "ghcide-completions": { - "config": { - "autoExtendOn": true, - "snippetsOn": true - }, - "globalOn": true - }, - "ghcide-hover-and-symbols": { - "hoverOn": true, - "symbolsOn": true - }, - "ghcide-type-lenses": { - "config": { - "mode": "always" - }, - "globalOn": true - }, - "hlint": { - "codeActionsOn": true, - "config": { - "flags": [] - }, - "diagnosticsOn": true - }, - "importLens": { - "codeActionsOn": true, - "codeLensOn": true - }, - "moduleName": { - "globalOn": true - }, - "ormolu": { - "config": { - "external": false - } - }, - "overloaded-record-dot": { - "globalOn": true - }, - "pragmas-completion": { - "globalOn": true - }, - "pragmas-disable": { - "globalOn": true - }, - "pragmas-suggest": { - "globalOn": true - }, - "qualifyImportedNames": { - "globalOn": true - }, - "rename": { - "config": { - "crossModule": false - }, - "globalOn": true - }, - "retrie": { - "globalOn": true - }, - "semanticTokens": { - "config": { - "classMethodToken": "method", - "classToken": "class", - "dataConstructorToken": "enumMember", - "functionToken": "function", - "moduleToken": "namespace", - "operatorToken": "operator", - "patternSynonymToken": "macro", - "recordFieldToken": "property", - "typeConstructorToken": "enum", - "typeFamilyToken": "interface", - "typeSynonymToken": "type", - "typeVariableToken": "typeParameter", - "variableToken": "variable" - }, - "globalOn": false - }, - "splice": { - "globalOn": true - } - }, - "sessionLoading": "singleComponent" -} diff --git a/test/testdata/schema/ghc92/vscode-extension-schema.golden.json b/test/testdata/schema/ghc92/vscode-extension-schema.golden.json deleted file mode 100644 index 027fe77b5a..0000000000 --- a/test/testdata/schema/ghc92/vscode-extension-schema.golden.json +++ /dev/null @@ -1,1016 +0,0 @@ -{ - "haskell.plugin.alternateNumberFormat.globalOn": { - "default": true, - "description": "Enables alternateNumberFormat plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal-fmt.config.path": { - "default": "cabal-fmt", - "markdownDescription": "Set path to 'cabal-fmt' executable", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.cabal-gild.config.path": { - "default": "cabal-gild", - "markdownDescription": "Set path to 'cabal-gild' executable", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.cabal.codeActionsOn": { - "default": true, - "description": "Enables cabal code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.completionOn": { - "default": true, - "description": "Enables cabal completions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.diagnosticsOn": { - "default": true, - "description": "Enables cabal diagnostics", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.callHierarchy.globalOn": { - "default": true, - "description": "Enables callHierarchy plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.changeTypeSignature.globalOn": { - "default": true, - "description": "Enables changeTypeSignature plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.class.codeActionsOn": { - "default": true, - "description": "Enables class code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.class.codeLensOn": { - "default": true, - "description": "Enables class code lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.config.diff": { - "default": true, - "markdownDescription": "Enable the diff output (WAS/NOW) of eval lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.config.exception": { - "default": false, - "markdownDescription": "Enable marking exceptions with `*** Exception:` similarly to doctest and GHCi.", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.globalOn": { - "default": true, - "description": "Enables eval plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.explicit-fields.globalOn": { - "default": true, - "description": "Enables explicit-fields plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.explicit-fixity.globalOn": { - "default": true, - "description": "Enables explicit-fixity plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.fourmolu.config.external": { - "default": false, - "markdownDescription": "Call out to an external \"fourmolu\" executable, rather than using the bundled library.", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.fourmolu.config.path": { - "default": "fourmolu", - "markdownDescription": "Set path to executable (for \"external\" mode).", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.gadt.globalOn": { - "default": true, - "description": "Enables gadt plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-bindings.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-bindings plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-fill-holes.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-fill-holes plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-imports-exports.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-imports-exports plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-type-signatures.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-type-signatures plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.config.autoExtendOn": { - "default": true, - "markdownDescription": "Extends the import list automatically when completing a out-of-scope identifier", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.config.snippetsOn": { - "default": true, - "markdownDescription": "Inserts snippets when using code completions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.globalOn": { - "default": true, - "description": "Enables ghcide-completions plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-hover-and-symbols.hoverOn": { - "default": true, - "description": "Enables ghcide-hover-and-symbols hover", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-hover-and-symbols.symbolsOn": { - "default": true, - "description": "Enables ghcide-hover-and-symbols symbols", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-type-lenses.config.mode": { - "default": "always", - "description": "Control how type lenses are shown", - "enum": [ - "always", - "exported", - "diagnostics" - ], - "enumDescriptions": [ - "Always displays type lenses of global bindings", - "Only display type lenses of exported global bindings", - "Follows error messages produced by GHC about missing signatures" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.ghcide-type-lenses.globalOn": { - "default": true, - "description": "Enables ghcide-type-lenses plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.hlint.codeActionsOn": { - "default": true, - "description": "Enables hlint code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.hlint.config.flags": { - "default": [], - "markdownDescription": "Flags used by hlint", - "scope": "resource", - "type": "array" - }, - "haskell.plugin.hlint.diagnosticsOn": { - "default": true, - "description": "Enables hlint diagnostics", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.importLens.codeActionsOn": { - "default": true, - "description": "Enables importLens code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.importLens.codeLensOn": { - "default": true, - "description": "Enables importLens code lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.moduleName.globalOn": { - "default": true, - "description": "Enables moduleName plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ormolu.config.external": { - "default": false, - "markdownDescription": "Call out to an external \"ormolu\" executable, rather than using the bundled library", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.overloaded-record-dot.globalOn": { - "default": true, - "description": "Enables overloaded-record-dot plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-completion.globalOn": { - "default": true, - "description": "Enables pragmas-completion plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-disable.globalOn": { - "default": true, - "description": "Enables pragmas-disable plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-suggest.globalOn": { - "default": true, - "description": "Enables pragmas-suggest plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.qualifyImportedNames.globalOn": { - "default": true, - "description": "Enables qualifyImportedNames plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.rename.config.crossModule": { - "default": false, - "markdownDescription": "Enable experimental cross-module renaming", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.rename.globalOn": { - "default": true, - "description": "Enables rename plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.retrie.globalOn": { - "default": true, - "description": "Enables retrie plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.semanticTokens.config.classMethodToken": { - "default": "method", - "description": "LSP semantic token type to use for typeclass methods", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.classToken": { - "default": "class", - "description": "LSP semantic token type to use for typeclasses", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.dataConstructorToken": { - "default": "enumMember", - "description": "LSP semantic token type to use for data constructors", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.functionToken": { - "default": "function", - "description": "LSP semantic token type to use for functions", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.moduleToken": { - "default": "namespace", - "description": "LSP semantic token type to use for modules", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.operatorToken": { - "default": "operator", - "description": "LSP semantic token type to use for operators", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.patternSynonymToken": { - "default": "macro", - "description": "LSP semantic token type to use for pattern synonyms", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.recordFieldToken": { - "default": "property", - "description": "LSP semantic token type to use for record fields", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeConstructorToken": { - "default": "enum", - "description": "LSP semantic token type to use for type constructors", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeFamilyToken": { - "default": "interface", - "description": "LSP semantic token type to use for type families", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeSynonymToken": { - "default": "type", - "description": "LSP semantic token type to use for type synonyms", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeVariableToken": { - "default": "typeParameter", - "description": "LSP semantic token type to use for type variables", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.variableToken": { - "default": "variable", - "description": "LSP semantic token type to use for variables", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.globalOn": { - "default": false, - "description": "Enables semanticTokens plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.splice.globalOn": { - "default": true, - "description": "Enables splice plugin", - "scope": "resource", - "type": "boolean" - } -} diff --git a/test/wrapper/testdata/stack-with-dist-newstyle/stack.yaml b/test/wrapper/testdata/stack-with-dist-newstyle/stack.yaml index e467bdb282..d95c1a7a03 100644 --- a/test/wrapper/testdata/stack-with-dist-newstyle/stack.yaml +++ b/test/wrapper/testdata/stack-with-dist-newstyle/stack.yaml @@ -1,2 +1,2 @@ # specific version does not matter -resolver: ghc-9.2.5 +resolver: ghc-9.6.5