Skip to content

Commit 1b11a8f

Browse files
dschrempffendor
andauthored
Plugin tutorial, more changes (#4570)
* Plugin tutorial, more changes Some changes are mine, but many have been cherry picked and amended from PR #3655 by Christian Georgii <cgeorgii@gmail.com>. * Update Nix Flake lock (this makes GHC 9.8 the default) * Review comments and other improvments, thanks @VeryMilkyJoe. * Compile plugin-tutorial using markdown-unlit Makes sure the plugin-tutorial can never be out-of-date again. * Remove out-of-date references * Add plugin-tutorial to CI * Only build the plugin-tutorial with GHC 9.6 and 9.8 * Add explanation for preamble --------- Co-authored-by: fendor <fendor@posteo.de>
1 parent 3190da3 commit 1b11a8f

File tree

7 files changed

+311
-256
lines changed

7 files changed

+311
-256
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ jobs:
255255
name: Test hls-notes-plugin test suite
256256
run: cabal test hls-notes-plugin-tests || cabal test hls-notes-plugin-tests
257257

258+
# The plugin tutorial is only compatible with 9.6 and 9.8.
259+
# No particular reason, just to avoid excessive CPP.
260+
- if: matrix.test && matrix.ghc != '9.4' && matrix.ghc != '9.10' && matrix.ghc != '9.12'
261+
name: Compile the plugin-tutorial
262+
run: cabal build plugin-tutorial
263+
258264
test_post_job:
259265
if: always()
260266
runs-on: ubuntu-latest

docs/contributing/plugin-tutorial.lhs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plugin-tutorial.md

docs/contributing/plugin-tutorial.md

Lines changed: 272 additions & 248 deletions
Large diffs are not rendered by default.

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ghcide/src/Development/IDE/GHC/Compat/Core.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ module Development.IDE.GHC.Compat.Core (
225225
SrcLoc.noSrcSpan,
226226
SrcLoc.noSrcLoc,
227227
SrcLoc.noLoc,
228+
SrcLoc.srcSpanToRealSrcSpan,
228229
mapLoc,
229230
-- * Finder
230231
FindResult(..),

haskell-language-server.cabal

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,3 +2265,28 @@ test-suite ghcide-bench-test
22652265
OverloadedStrings
22662266
RecordWildCards
22672267
ViewPatterns
2268+
2269+
executable plugin-tutorial
2270+
import: defaults
2271+
-- The plugin tutorial is only compatible with 9.6 and 9.8.
2272+
-- No particular reason, just to avoid excessive CPP.
2273+
if (impl(ghc >= 9.6) && impl(ghc < 9.10))
2274+
buildable: True
2275+
else
2276+
buildable: False
2277+
ghc-options: -pgmL markdown-unlit
2278+
main-is: docs/contributing/plugin-tutorial.lhs
2279+
build-tool-depends: markdown-unlit:markdown-unlit
2280+
build-depends:
2281+
base,
2282+
ghcide,
2283+
hls-plugin-api,
2284+
aeson,
2285+
lsp,
2286+
lsp-types,
2287+
markdown-unlit,
2288+
text,
2289+
unordered-containers,
2290+
containers,
2291+
transformers,
2292+
ghc,

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,13 @@ import GHC (AddEpAnn (Ad
121121
EpaLocation,
122122
EpaLocation' (..),
123123
HasLoc (..))
124-
import GHC.Types.SrcLoc (srcSpanToRealSrcSpan)
125124
#endif
126125
#if MIN_VERSION_ghc(9,11,0)
127126
import GHC (EpaLocation,
128127
AnnsModule (am_where),
129128
EpaLocation' (..),
130129
HasLoc (..),
131130
EpToken (..))
132-
import GHC.Types.SrcLoc (srcSpanToRealSrcSpan)
133131
#endif
134132

135133

0 commit comments

Comments
 (0)