From 98992af1343fb8ef6dff66a25c9b0810f99a77ef Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Thu, 12 May 2022 12:33:15 +0200 Subject: [PATCH] Workaround for HLS not finding files while running template haskell (#2388) https://github.com/haskell/haskell-language-server/issues/481 --- services/brig/brig.cabal | 1 + services/brig/package.yaml | 1 + services/brig/src/Brig/API/Public.hs | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/services/brig/brig.cabal b/services/brig/brig.cabal index 5785072b6fb..33e3de7687a 100644 --- a/services/brig/brig.cabal +++ b/services/brig/brig.cabal @@ -203,6 +203,7 @@ library , errors >=1.4 , exceptions >=0.5 , extended + , file-embed , file-embed-lzma , filepath >=1.3 , fsnotify >=0.2 diff --git a/services/brig/package.yaml b/services/brig/package.yaml index b187df72ad2..91c05a0b17c 100644 --- a/services/brig/package.yaml +++ b/services/brig/package.yaml @@ -48,6 +48,7 @@ library: - errors >=1.4 - exceptions >=0.5 - extended + - file-embed - file-embed-lzma - filepath >=1.3 - fsnotify >=0.2 diff --git a/services/brig/src/Brig/API/Public.hs b/services/brig/src/Brig/API/Public.hs index ff9fc9357cf..88efa357e9a 100644 --- a/services/brig/src/Brig/API/Public.hs +++ b/services/brig/src/Brig/API/Public.hs @@ -72,6 +72,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS import Data.CommaSeparatedList (CommaSeparatedList (fromCommaSeparatedList)) import Data.Containers.ListUtils (nubOrd) import Data.Domain +import Data.FileEmbed import Data.Handle (Handle, parseHandle) import Data.Id as Id import qualified Data.Map.Strict as Map @@ -146,7 +147,7 @@ swaggerDocsAPI (Just V2) = <> CannonAPI.swaggerDoc ) & S.info . S.title .~ "Wire-Server API" - & S.info . S.description ?~ $(embedText "docs/swagger.md") <> mempty + & S.info . S.description ?~ $(embedText =<< makeRelativeToProject "docs/swagger.md") & S.security %~ nub -- sanitise definitions & S.definitions . traverse %~ sanitise @@ -170,12 +171,12 @@ swaggerDocsAPI (Just V0) = swaggerSchemaUIServer . fromMaybe Aeson.Null . Aeson.decode - $ $(embedLazyByteString "docs/swagger-v0.json") + $ $(embedLazyByteString =<< makeRelativeToProject "docs/swagger-v0.json") swaggerDocsAPI (Just V1) = swaggerSchemaUIServer . fromMaybe Aeson.Null . Aeson.decode - $ $(embedLazyByteString "docs/swagger-v1.json") + $ $(embedLazyByteString =<< makeRelativeToProject "docs/swagger-v1.json") swaggerDocsAPI Nothing = swaggerDocsAPI (Just maxBound) servantSitemap :: ServerT BrigAPI (Handler r)