Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splice Plugin: expands TH splices and QuasiQuotes #759

Merged
merged 64 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5da1599
Implements splice location detection
konn Dec 29, 2020
cd052b0
Corrects detection logic
konn Dec 29, 2020
52a8446
Changed to use (bogus) message for code action
konn Dec 29, 2020
1648d19
Splice location
konn Dec 29, 2020
fd39e57
Extract `Ide.TreeTransform` as an independent package
konn Dec 30, 2020
f6de0ab
It once worked, but stops...
konn Dec 30, 2020
3cbfba9
Now it works for inplace expansion for expressions
konn Dec 30, 2020
41b2164
generalises tree transformation to general AST element
konn Dec 30, 2020
a959ad0
Done for Types and Patterns!
konn Dec 30, 2020
313134a
Disabled "commented" style of expansion
konn Dec 30, 2020
7d050c6
kills redundant imports
konn Dec 30, 2020
affa5ca
Merge branch 'master' into expand-splice-plugin
konn Dec 30, 2020
05e4d7d
Updates cabal.project
konn Dec 30, 2020
cfca363
Nix fix
konn Dec 30, 2020
520fdfd
Nix fix, fix
konn Dec 30, 2020
107519c
Throws away loading hacks entirely
konn Dec 30, 2020
3ed97db
Merge branch 'master' into expand-splice-plugin
konn Dec 31, 2020
1d4ea8f
Type adjusted for inverse dependency
konn Dec 31, 2020
4ca09d2
Resolves merge conflicts
konn Dec 31, 2020
1624f76
WIP: Support hover and goto definition for top-level splices
mpickering Oct 5, 2020
217f69b
Modifies splice information to store both spliced expression and expa…
konn Dec 31, 2020
7e2d4a9
Avoid name collision
konn Dec 31, 2020
1dab48b
formatting erros
konn Dec 31, 2020
6bcb18a
Safer error handling
konn Dec 31, 2020
a915a1f
Rewrote using updated ghcide `TypeCheck` results
konn Dec 31, 2020
794b771
Use `liftRnf rwhnf` to force spine of lists
konn Dec 31, 2020
9cf55c4
Stop using `defaultRunMeta` directly to avoid override of preexisting…
konn Dec 31, 2020
f7e7e65
Error report
konn Dec 31, 2020
cd18dde
Add splice information into HIE generation.
mpickering Oct 5, 2020
39a1cc4
Resolves interace conflict
konn Dec 31, 2020
7876914
Add test
mpickering Oct 5, 2020
5d46ac0
Changes to use ParsedModule to detect Splice CodeLens
konn Dec 31, 2020
b29fb59
formatted
konn Dec 31, 2020
8cb16ff
Implements golden test
konn Dec 31, 2020
58f58ac
mzero for HsDecl
konn Dec 31, 2020
f8b66dd
Decl Splice
konn Dec 31, 2020
210c818
Workaround for Decl expansion and support type-errored macro expansion.
konn Jan 1, 2021
df59922
Merge branch 'master' into expand-splice-plugin
konn Jan 1, 2021
6e57b13
Only setting up dflags correcly would suffice
konn Jan 1, 2021
9f8a868
Removes lines accidentally added
konn Jan 1, 2021
45a1388
Regression tests for Declaration splice and kind-error ones
konn Jan 1, 2021
056f769
Workaround for GHC 8.8
konn Jan 1, 2021
8fa549d
Revert "Workaround for GHC 8.8"
konn Jan 1, 2021
d3e0185
Unsupport pattern splices GHC 8.8
konn Jan 1, 2021
e62b03e
Corrects line position in GoToHover
konn Jan 1, 2021
23a6781
Merge branch 'master' into expand-splice-plugin
konn Jan 2, 2021
41dfc7e
Merge branch 'master' into expand-splice-plugin
konn Jan 2, 2021
a3ff03a
Merge branch 'master' into expand-splice-plugin
konn Jan 3, 2021
10b7ce4
Increases wait time
konn Jan 3, 2021
0b02765
Includes only related changes only
konn Jan 3, 2021
8068a33
Merge branch 'master' into expand-splice-plugin
konn Jan 3, 2021
f2efe7c
Optimises `something'`
konn Jan 3, 2021
f71b51d
Adds hie.yaml
konn Jan 3, 2021
96a14b1
circie ci: Modifies stack-8.10.3.yaml
konn Jan 3, 2021
2e80296
Merge branch 'master' into expand-splice-plugin
konn Jan 4, 2021
1c42421
Forgot to update dflags in auto-expansion with default strategy
konn Jan 4, 2021
981fb40
Forgot to add golden file
konn Jan 4, 2021
1191344
A dummy commit to run CI
konn Jan 4, 2021
f6f7bba
Merge branch 'master' into expand-splice-plugin
konn Jan 4, 2021
27eba15
Merge branch 'master' into expand-splice-plugin
konn Jan 5, 2021
c4f19e4
Merge branch 'master' into expand-splice-plugin
konn Jan 5, 2021
0c53a70
Merge branch 'master' into expand-splice-plugin
konn Jan 5, 2021
3032c32
Workaround for GHC 8.8 pattern splices
konn Jan 5, 2021
6341b39
Merge branch 'master' into expand-splice-plugin
mergify[bot] Jan 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions exe/Plugins.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Plugins where

import Ide.Types (IdePlugins)
import Ide.Plugin (pluginDescToIdePlugins)
module Plugins where

import Ide.Plugin (pluginDescToIdePlugins)
-- fixed plugins
import Ide.Plugin.Example as Example
import Ide.Plugin.Example2 as Example2
import Ide.Plugin.GhcIde as GhcIde
import Ide.Plugin.Example as Example
import Ide.Plugin.Example2 as Example2
import Ide.Plugin.GhcIde as GhcIde
import Ide.Types (IdePlugins)

-- haskell-language-server optional plugins

Expand Down Expand Up @@ -44,6 +44,11 @@ import Ide.Plugin.ModuleName as ModuleName
import Ide.Plugin.Pragmas as Pragmas
#endif

#if defined(splice)
import Ide.Plugin.Splice as Splice
#endif


-- formatters

#if floskell
Expand All @@ -68,14 +73,14 @@ import Ide.Plugin.Brittany as Brittany

-- ---------------------------------------------------------------------

-- | The plugins configured for use in this instance of the language
-- server.
-- These can be freely added or removed to tailor the available
-- features of the server.

{- | The plugins configured for use in this instance of the language
server.
These can be freely added or removed to tailor the available
features of the server.
-}
idePlugins :: Bool -> IdePlugins
idePlugins includeExamples = pluginDescToIdePlugins allPlugins
where
where
allPlugins = if includeExamples
then basePlugins ++ examplePlugins
else basePlugins
Expand Down Expand Up @@ -119,6 +124,9 @@ idePlugins includeExamples = pluginDescToIdePlugins allPlugins
#endif
#if hlint
, Hlint.descriptor "hlint"
#endif
#if defined(splice)
, Splice.descriptor "splice"
#endif
]
examplePlugins =
Expand Down
11 changes: 11 additions & 0 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ flag pragmas
default: False
manual: True

flag splice
description: Enable splice plugin
default: False
manual: True

-- formatters

flag floskell
Expand Down Expand Up @@ -212,6 +217,11 @@ common pragmas
other-modules: Ide.Plugin.Pragmas
cpp-options: -Dpragmas

common splice
if flag(splice) || flag(all-plugins)
build-depends: hls-splice-plugin
cpp-options: -Dsplice

-- formatters

common floskell
Expand Down Expand Up @@ -262,6 +272,7 @@ executable haskell-language-server
, hlint
, moduleName
, pragmas
, splice
, floskell
, fourmolu
, ormolu
Expand Down
6 changes: 6 additions & 0 deletions hie-cabal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ cradle:
- path: "./hls-plugin-api/src"
component: "lib:hls-plugin-api"

- path: "./hls-exactprint-utils/src"
component: "lib:hls-exactprint-utils"

- path: "./plugins/hls-class-plugin/src"
component: "lib:hls-class-plugin"

Expand All @@ -115,6 +118,9 @@ cradle:
- path: "./plugins/hls-retrie-plugin/src"
component: "lib:hls-retrie-plugin"

- path: "./plugins/hls-splice-plugin/src"
component: "hls-splice-plugin:lib"

- path: "./plugins/tactics/src"
component: "lib:hls-tactics-plugin"

Expand Down
6 changes: 6 additions & 0 deletions hie-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ cradle:
- path: "./hls-plugin-api/src"
component: "hls-plugin-api:lib"

- path: "./hls-exactprint-utils/src"
component: "hls-exactprint-utils:lib"

# Plugins:

- path: "./plugins/hls-class-plugin/src"
Expand All @@ -54,6 +57,9 @@ cradle:
- path: "./plugins/hls-retrie-plugin/src"
component: "hls-retrie-plugin:lib"

- path: "./plugins/hls-splice-plugin/src"
component: "hls-splice-plugin:lib"

- path: "./plugins/tactics/src"
component: "hls-tactics-plugin:lib"

Expand Down
47 changes: 47 additions & 0 deletions hls-exactprint-utils/hls-exactprint-utils.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cabal-version: 2.2
name: hls-exactprint-utils
version: 0.5.0.1
synopsis: Common residence package of ExactPrint related tree-transformation utilities for HLS plugins (ported from tactics plugin).
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
homepage: https://github.com/haskell/haskell-language-server/hls-exactprint-utils
bug-reports: https://github.com/haskell/haskell-language-server/issues
author: Sandy Maguire, Reed Mullanix
maintainer: [email protected]
copyright: Sandy Maguire, Reed Mullanix
category: Web
build-type: Simple

flag pedantic
description: Enable -Werror
default: False
manual: True

source-repository head
type: git
location: https://github.com/haskell/haskell-language-server

library
exposed-modules:
Ide.TreeTransform

hs-source-dirs: src
build-depends:
base >=4.12 && <5
, ghc
, ghc-exactprint
, ghcide
, haskell-lsp-types
, hls-plugin-api
, retrie
, syb
, text
, transformers


ghc-options: -Wall -Wredundant-constraints -Wincomplete-uni-patterns

if flag(pedantic)
ghc-options: -Werror

default-language: Haskell2010
Loading