Date: Friday, October 14, 2022 @ 17:32:16
  Author: felixonmars
Revision: 1328613

archrelease: copy trunk to community-staging-x86_64

Added:
  haskell-hls-plugin-api/repos/community-staging-x86_64/
  haskell-hls-plugin-api/repos/community-staging-x86_64/PKGBUILD
    (from rev 1328611, haskell-hls-plugin-api/trunk/PKGBUILD)
  
haskell-hls-plugin-api/repos/community-staging-x86_64/hls-plugin-api-aeson-2.patch
    (from rev 1328612, 
haskell-hls-plugin-api/trunk/hls-plugin-api-aeson-2.patch)

------------------------------+
 PKGBUILD                     |   53 +++++++
 hls-plugin-api-aeson-2.patch |  301 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 354 insertions(+)

Copied: haskell-hls-plugin-api/repos/community-staging-x86_64/PKGBUILD (from 
rev 1328611, haskell-hls-plugin-api/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD                           (rev 0)
+++ community-staging-x86_64/PKGBUILD   2022-10-14 17:32:16 UTC (rev 1328613)
@@ -0,0 +1,53 @@
+# Maintainer: Felix Yan <felixonm...@archlinux.org>
+
+_hkgname=hls-plugin-api
+pkgname=haskell-hls-plugin-api
+pkgver=1.2.0.2
+pkgrel=10
+pkgdesc="Haskell Language Server API for plugin communication"
+url="https://github.com/haskell/haskell-language-server/hls-plugin-api";
+license=("Apache")
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-diff' 'haskell-aeson' 'haskell-data-default' 
'haskell-dependent-map'
+         'haskell-dependent-sum' 'haskell-dlist' 'haskell-ghc' 
'haskell-ghc-api-compat'
+         'haskell-hashable' 'haskell-hls-graph' 'haskell-hslogger' 
'haskell-lens'
+         'haskell-lens-aeson' 'haskell-lsp' 'haskell-optparse-applicative' 
'haskell-opentelemetry'
+         'haskell-regex-tdfa' 'haskell-unordered-containers')
+makedepends=('ghc' 'uusi')
+source=("https://hackage.haskell.org/packages/archive/$_hkgname/$pkgver/$_hkgname-$pkgver.tar.gz";
+        hls-plugin-api-aeson-2.patch)
+sha512sums=('8654b38529ad8804dfb3296fe789ceafe111f1d7807ffa49a92af8a8cae9b5331167d64f01263efec37b280b1e029e4513455c8a9329349cb0aeba9b85233232'
+            
'330d5a02d13df720252a0de3da311c7d3e549b6d31d7dc936b8a93b3dc5fc555d16f911ba1b59ba6388f93205757b2ecba1bcf3fe4e3558c9767d04df82c18c3')
+
+prepare() {
+  cd $_hkgname-$pkgver
+  patch -p2 -i ../hls-plugin-api-aeson-2.patch
+  gen-setup
+  uusi -r ghc:ghc,ghc-api-compat $_hkgname.cabal
+}
+
+build() {
+  cd $_hkgname-$pkgver
+
+  runhaskell Setup configure -O --enable-shared --enable-executable-dynamic 
--disable-library-vanilla \
+    --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname 
--enable-tests \
+    --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid 
--ghc-option=-fllvm \
+    --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
+    --ghc-option='-pie'
+
+  runhaskell Setup build $MAKEFLAGS
+  runhaskell Setup register --gen-script
+  runhaskell Setup unregister --gen-script
+  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+package() {
+  cd $_hkgname-$pkgver
+
+  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
+  install -D -m744 unregister.sh 
"$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
+  runhaskell Setup copy --destdir="$pkgdir"
+  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
+  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
+}

Copied: 
haskell-hls-plugin-api/repos/community-staging-x86_64/hls-plugin-api-aeson-2.patch
 (from rev 1328612, haskell-hls-plugin-api/trunk/hls-plugin-api-aeson-2.patch)
===================================================================
--- community-staging-x86_64/hls-plugin-api-aeson-2.patch                       
        (rev 0)
+++ community-staging-x86_64/hls-plugin-api-aeson-2.patch       2022-10-14 
17:32:16 UTC (rev 1328613)
@@ -0,0 +1,301 @@
+From 2625689ad4308f5ca207b24fbec2a569ed229347 Mon Sep 17 00:00:00 2001
+From: Javier Neira <atreyu....@gmail.com>
+Date: Wed, 12 Jan 2022 17:24:53 +0100
+Subject: [PATCH] Add support for brittany (needs aeson-2) and floskell with
+ ghc-9.0.1 (#2551)
+
+* Enable tests for brittany and 9.0.2
+
+* Enable tests for floskell plugin
+
+* cabal-ghc901.project: naively enable brittany
+
+* haskell-language-server.cabal: bump brittany flag <(9.0.1->9.2.1)
+
+* Trying to add support for brittany
+
+* Use last hackage floskell version
+
+* Activate floskell in func-test suite
+
+* Restrict brittany in hackage for ghc<9.0.1
+
+* Adapt to Aeson.Key
+
+* Update lsp source repo package
+
+* Refer pr for butcher
+
+* Add missing prefix
+
+* Adapt to aeson-2 (incomplete)
+
+* Use compat module
+
+* Support for aeson-2 and extra-1.7.10
+
+* Remove lsp
+
+* Allow newer aeson for stylish-haskell
+
+* Add needed import for non windows
+
+* Remove insertJson and toJsonKey
+
+* Update cabal-ghc901.project
+
+* Missing import
+
+* Avoid CPP by using lens-aeson
+
+* Update hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
+
+* Use ghcide compat module
+
+* Use type alias in cpp
+
+* Fix stack build for ghc-8.6.5
+
+* Use lens-aeson key
+
+* Use lens-aeson in func-test
+
+* Fixup shake-bench
+
+* Update docs
+
+* Switch to lens ix
+
+* Try this
+
+Co-authored-by: Anton-Latukha <anton.latu...@gmail.com>
+Co-authored-by: Michael Peyton Jones <m...@michaelpj.com>
+Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
+---
+ .github/workflows/test.yml                    |  2 +-
+ cabal-ghc901.project                          | 15 ++++---
+ ghcide/ghcide.cabal                           |  3 +-
+ ghcide/src/Control/Concurrent/Strict.hs       | 11 +++---
+ ghcide/src/Development/IDE/GHC/Orphans.hs     | 23 ++++++-----
+ haskell-language-server.cabal                 |  5 ++-
+ hls-plugin-api/hls-plugin-api.cabal           |  1 +
+ hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs  | 39 +++++++++----------
+ hls-plugin-api/src/Ide/Plugin/Properties.hs   | 27 ++++++-------
+ hls-plugin-api/src/Ide/Types.hs               |  2 +-
+ .../hls-brittany-plugin.cabal                 |  1 -
+ .../src/Ide/Plugin/Brittany.hs                | 32 ++++++++-------
+ shake-bench/shake-bench.cabal                 |  2 +
+ .../src/Development/Benchmark/Rules.hs        | 31 ++++++++-------
+ stack-8.10.6.yaml                             |  2 +
+ stack-8.10.7.yaml                             |  2 +
+ stack-8.6.5.yaml                              |  5 ++-
+ stack-8.8.4.yaml                              |  3 +-
+ stack-9.0.1.yaml                              | 12 ++++--
+ stack.yaml                                    |  2 +
+ test/functional/FunctionalCodeAction.hs       | 20 +++++-----
+ 21 files changed, 134 insertions(+), 106 deletions(-)
+
+diff --git a/hls-plugin-api/hls-plugin-api.cabal 
b/hls-plugin-api/hls-plugin-api.cabal
+index 12c66bc3cd..1516d1b591 100644
+--- a/hls-plugin-api/hls-plugin-api.cabal
++++ b/hls-plugin-api/hls-plugin-api.cabal
+@@ -49,6 +49,7 @@ library
+     , hls-graph             ^>=1.4
+     , hslogger
+     , lens
++    , lens-aeson
+     , lsp                   ^>=1.2.0.1
+     , opentelemetry
+     , optparse-applicative
+diff --git a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs 
b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
+index 411311106d..cea719a995 100644
+--- a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
++++ b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
+@@ -5,13 +5,16 @@
+ 
+ module Ide.Plugin.ConfigUtils where
+ 
++import           Control.Lens          (at, ix, (&), (?~))
+ import qualified Data.Aeson            as A
++import           Data.Aeson.Lens       (_Object)
+ import qualified Data.Aeson.Types      as A
+ import           Data.Default          (def)
+ import qualified Data.Dependent.Map    as DMap
+ import qualified Data.Dependent.Sum    as DSum
+-import qualified Data.HashMap.Lazy     as HMap
+ import           Data.List             (nub)
++import           Data.String           (IsString (fromString))
++import qualified Data.Text             as T
+ import           Ide.Plugin.Config
+ import           Ide.Plugin.Properties (toDefaultJSON, 
toVSCodeExtensionSchema)
+ import           Ide.Types
+@@ -25,17 +28,12 @@ import           Language.LSP.Types
+ -- | Generates a default 'Config', but remains only effective items
+ pluginsToDefaultConfig :: IdePlugins a -> A.Value
+ pluginsToDefaultConfig IdePlugins {..} =
+-  A.Object $
+-    HMap.adjust
+-      ( \(unsafeValueToObject -> o) ->
+-          A.Object $ HMap.insert "plugin" elems o -- inplace the "plugin" 
section with our 'elems', leaving others unchanged
+-      )
+-      "haskell"
+-      (unsafeValueToObject (A.toJSON defaultConfig))
++  -- Use 'ix' to look at all the "haskell" keys in the outer value (since 
we're not
++  -- setting it if missing), then we use '_Object' and 'at' to get at the 
"plugin" key
++  -- and actually set it.
++  A.toJSON defaultConfig & ix "haskell" . _Object . at "plugin" ?~ elems
+   where
+     defaultConfig@Config {} = def
+-    unsafeValueToObject (A.Object o) = o
+-    unsafeValueToObject _            = error "impossible"
+     elems = A.object $ mconcat $ singlePlugin <$> map snd ipMap
+     -- Splice genericDefaultConfig and dedicatedDefaultConfig
+     -- Example:
+@@ -52,7 +50,7 @@ pluginsToDefaultConfig IdePlugins {..} =
+     -- }
+     singlePlugin PluginDescriptor {pluginConfigDescriptor = ConfigDescriptor 
{..}, ..} =
+       let x = genericDefaultConfig <> dedicatedDefaultConfig
+-       in [pId A..= A.object x | not $ null x]
++       in [fromString (T.unpack pId) A..= A.object x | not $ null x]
+       where
+         (PluginHandlers (DMap.toList -> handlers)) = pluginHandlers
+         customConfigToDedicatedDefaultConfig (CustomConfig p) = toDefaultJSON 
p
+@@ -107,22 +105,22 @@ pluginsToVSCodeExtensionSchema IdePlugins {..} = 
A.object $ mconcat $ singlePlug
+         (PluginId pId) = pluginId
+         genericSchema =
+           let x =
+-                [withIdPrefix "diagnosticsOn" A..= schemaEntry "diagnostics" 
| configHasDiagnostics]
++                [toKey' "diagnosticsOn" A..= schemaEntry "diagnostics" | 
configHasDiagnostics]
+                   <> nub (mconcat (handlersToGenericSchema <$> handlers))
+            in case x of
+                 -- If the plugin has only one capability, we produce globalOn 
instead of the specific one;
+                 -- otherwise we don't produce globalOn at all
+-                [_] -> [withIdPrefix "globalOn" A..= schemaEntry "plugin"]
++                [_] -> [toKey' "globalOn" A..= schemaEntry "plugin"]
+                 _   -> x
+         dedicatedSchema = customConfigToDedicatedSchema configCustomConfig
+         handlersToGenericSchema (IdeMethod m DSum.:=> _) = case m of
+-          STextDocumentCodeAction -> [withIdPrefix "codeActionsOn" A..= 
schemaEntry "code actions"]
+-          STextDocumentCodeLens -> [withIdPrefix "codeLensOn" A..= 
schemaEntry "code lenses"]
+-          STextDocumentRename -> [withIdPrefix "renameOn" A..= schemaEntry 
"rename"]
+-          STextDocumentHover -> [withIdPrefix "hoverOn" A..= schemaEntry 
"hover"]
+-          STextDocumentDocumentSymbol -> [withIdPrefix "symbolsOn" A..= 
schemaEntry "symbols"]
+-          STextDocumentCompletion -> [withIdPrefix "completionOn" A..= 
schemaEntry "completions"]
+-          STextDocumentPrepareCallHierarchy -> [withIdPrefix 
"callHierarchyOn" A..= schemaEntry "call hierarchy"]
++          STextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry 
"code actions"]
++          STextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry 
"code lenses"]
++          STextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename"]
++          STextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover"]
++          STextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry 
"symbols"]
++          STextDocumentCompletion -> [toKey' "completionOn" A..= schemaEntry 
"completions"]
++          STextDocumentPrepareCallHierarchy -> [toKey' "callHierarchyOn" A..= 
schemaEntry "call hierarchy"]
+           _ -> []
+         schemaEntry desc =
+           A.object
+@@ -132,3 +130,4 @@ pluginsToVSCodeExtensionSchema IdePlugins {..} = A.object 
$ mconcat $ singlePlug
+               "description" A..= A.String ("Enables " <> pId <> " " <> desc)
+             ]
+         withIdPrefix x = "haskell.plugin." <> pId <> "." <> x
++        toKey' = fromString . T.unpack . withIdPrefix
+diff --git a/hls-plugin-api/src/Ide/Plugin/Properties.hs 
b/hls-plugin-api/src/Ide/Plugin/Properties.hs
+index 2201cf2a53..9baaf26833 100644
+--- a/hls-plugin-api/src/Ide/Plugin/Properties.hs
++++ b/hls-plugin-api/src/Ide/Plugin/Properties.hs
+@@ -11,7 +11,6 @@
+ {-# LANGUAGE TypeFamilies          #-}
+ {-# LANGUAGE TypeOperators         #-}
+ {-# LANGUAGE UndecidableInstances  #-}
+-{-# LANGUAGE ViewPatterns          #-}
+ -- See Note [Constraints]
+ {-# OPTIONS_GHC -Wno-redundant-constraints #-}
+ 
+@@ -47,6 +46,7 @@ import           Data.Function        ((&))
+ import           Data.Kind            (Constraint, Type)
+ import qualified Data.Map.Strict      as Map
+ import           Data.Proxy           (Proxy (..))
++import           Data.String          (IsString (fromString))
+ import qualified Data.Text            as T
+ import           GHC.OverloadedLabels (IsLabel (..))
+ import           GHC.TypeLits
+@@ -162,6 +162,7 @@ type HasProperty s k t r = (k ~ 'PropertyKey s t, Elem s 
r, FindByKeyName s r ~
+ --      "Description of exampleNumber"
+ --      233
+ -- @
++
+ emptyProperties :: Properties '[]
+ emptyProperties = Properties Map.empty
+ 
+@@ -235,7 +236,7 @@ parseProperty kn k x = case k of
+   (SEnum _, EnumMetaData {..}) ->
+     A.parseEither
+       ( \o -> do
+-          txt <- o A..: keyName
++          txt <- o A..: key
+           if txt `elem` enumValues
+             then pure txt
+             else
+@@ -247,9 +248,9 @@ parseProperty kn k x = case k of
+       )
+       x
+   where
+-    keyName = T.pack $ symbolVal kn
++    key = fromString $ symbolVal kn
+     parseEither :: forall a. A.FromJSON a => Either String a
+-    parseEither = A.parseEither (A..: keyName) x
++    parseEither = A.parseEither (A..: key) x
+ 
+ -- ---------------------------------------------------------------------
+ 
+@@ -352,26 +353,26 @@ toDefaultJSON :: Properties r -> [A.Pair]
+ toDefaultJSON (Properties p) = [toEntry s v | (s, v) <- Map.toList p]
+   where
+     toEntry :: String -> SomePropertyKeyWithMetaData -> A.Pair
+-    toEntry (T.pack -> s) = \case
++    toEntry s = \case
+       (SomePropertyKeyWithMetaData SNumber MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData SInteger MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData SString MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData SBoolean MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData (SObject _) MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData (SArray _) MetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+       (SomePropertyKeyWithMetaData (SEnum _) EnumMetaData {..}) ->
+-        s A..= defaultValue
++        fromString s A..= defaultValue
+ 
+ -- | Converts a properties definition into kv pairs as vscode schema
+ toVSCodeExtensionSchema :: T.Text -> Properties r -> [A.Pair]
+ toVSCodeExtensionSchema prefix (Properties p) =
+-  [(prefix <> T.pack k) A..= toEntry v | (k, v) <- Map.toList p]
++  [fromString (T.unpack prefix <> k) A..= toEntry v | (k, v) <- Map.toList p]
+   where
+     toEntry :: SomePropertyKeyWithMetaData -> A.Value
+     toEntry = \case
+diff --git a/hls-plugin-api/src/Ide/Types.hs b/hls-plugin-api/src/Ide/Types.hs
+index 4d655cee0c..b20eb890d6 100644
+--- a/hls-plugin-api/src/Ide/Types.hs
++++ b/hls-plugin-api/src/Ide/Types.hs
+@@ -24,11 +24,11 @@ module Ide.Types
+ #ifdef mingw32_HOST_OS
+ import qualified System.Win32.Process            as P (getCurrentProcessId)
+ #else
++import           Control.Monad                   (void)
+ import qualified System.Posix.Process            as P (getProcessID)
+ import           System.Posix.Signals
+ #endif
+ import           Control.Lens                    ((^.))
+-import           Control.Monad
+ import           Data.Aeson                      hiding (defaultOptions)
+ import qualified Data.DList                      as DList
+ import qualified Data.Default

Reply via email to